vitepress 1.0.0-alpha.21 → 1.0.0-alpha.23

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.
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Test](https://github.com/vuejs/vitepress/workflows/Test/badge.svg)](https://github.com/vuejs/vitepress/actions)
4
4
  [![npm](https://img.shields.io/npm/v/vitepress)](https://www.npmjs.com/package/vitepress)
5
+ [![chat](https://img.shields.io/badge/chat-discord-blue?logo=discord)](https://chat.vuejs.org)
5
6
 
6
7
  ---
7
8
 
@@ -1,4 +1,4 @@
1
- import { shallowRef, readonly, computed, inject } from 'vue';
1
+ import { computed, inject, readonly, ref, shallowRef } from 'vue';
2
2
  import siteData from '@siteData';
3
3
  import { resolveSiteDataByRoute, createTitle } from '../shared.js';
4
4
  import { withBase } from './utils.js';
@@ -32,7 +32,8 @@ export function initData(route) {
32
32
  }),
33
33
  description: computed(() => {
34
34
  return route.data.description || site.value.description;
35
- })
35
+ }),
36
+ isDark: ref(false)
36
37
  };
37
38
  }
38
39
  export function useData() {
@@ -28,6 +28,7 @@ interface VitePressData<T = any> {
28
28
  description: Ref<string>;
29
29
  lang: Ref<string>;
30
30
  localePath: Ref<string>;
31
+ isDark: Ref<boolean>;
31
32
  }
32
33
  declare function useData<T = any>(): VitePressData<T>;
33
34
 
@@ -63,7 +63,7 @@ const NotFound = inject('NotFound')
63
63
 
64
64
  @media (min-width: 960px) {
65
65
  .VPContent {
66
- padding-top: var(--vp-nav-height);
66
+ padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px));
67
67
  }
68
68
 
69
69
  .VPContent.has-sidebar {
@@ -120,8 +120,8 @@ provide('onContentUpdated', onContentUpdated)
120
120
  .aside-container {
121
121
  position: sticky;
122
122
  top: 0;
123
- margin-top: calc(var(--vp-nav-height-desktop) * -1 - 32px);
124
- padding-top: calc(var(--vp-nav-height-desktop) + 32px);
123
+ margin-top: calc((var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px)) * -1 - 32px);
124
+ padding-top: calc(var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px) + 32px);
125
125
  height: 100vh;
126
126
  overflow-x: hidden;
127
127
  overflow-y: auto;
@@ -144,7 +144,7 @@ provide('onContentUpdated', onContentUpdated)
144
144
  .aside-content {
145
145
  display: flex;
146
146
  flex-direction: column;
147
- min-height: calc(100vh - (var(--vp-nav-height-desktop) + 32px));
147
+ min-height: calc(100vh - (var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px) + 32px));
148
148
  padding-bottom: 32px;
149
149
  }
150
150
 
@@ -53,19 +53,19 @@ defineProps<{
53
53
 
54
54
  <style scoped>
55
55
  .VPHero {
56
- margin-top: calc(var(--vp-nav-height) * -1);
57
- padding: calc(var(--vp-nav-height) + 48px) 24px 48px;
56
+ margin-top: calc((var(--vp-nav-height) + var(--vp-layout-top-height, 0px)) * -1);
57
+ padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 48px) 24px 48px;
58
58
  }
59
59
 
60
60
  @media (min-width: 640px) {
61
61
  .VPHero {
62
- padding: calc(var(--vp-nav-height) + 80px) 48px 64px;
62
+ padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 48px 64px;
63
63
  }
64
64
  }
65
65
 
66
66
  @media (min-width: 960px) {
67
67
  .VPHero {
68
- padding: calc(var(--vp-nav-height) + 80px) 64px 64px;
68
+ padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 64px 64px;
69
69
  }
70
70
  }
71
71
 
@@ -29,7 +29,7 @@ provide('close-screen', closeScreen)
29
29
  <style scoped>
30
30
  .VPNav {
31
31
  position: relative;
32
- top: 0;
32
+ top: var(--vp-layout-top-height, 0px);
33
33
  left: 0;
34
34
  z-index: var(--vp-z-index-nav);
35
35
  width: 100%;
@@ -43,7 +43,7 @@ function unlockBodyScroll() {
43
43
  <style scoped>
44
44
  .VPNavScreen {
45
45
  position: fixed;
46
- top: var(--vp-nav-height-mobile);
46
+ top: calc(var(--vp-nav-height-mobile) + var(--vp-layout-top-height, 0px));
47
47
  right: 0;
48
48
  bottom: 0;
49
49
  left: 0;
@@ -59,7 +59,7 @@ watchPostEffect(async () => {
59
59
  <style scoped>
60
60
  .VPSidebar {
61
61
  position: fixed;
62
- top: 0;
62
+ top: var(--vp-layout-top-height, 0px);
63
63
  bottom: 0;
64
64
  left: 0;
65
65
  z-index: var(--vp-z-index-sidebar);
@@ -41,7 +41,7 @@ function toggle() {
41
41
  :role="collapsible ? 'button' : undefined"
42
42
  @click="toggle"
43
43
  >
44
- <h2 class="title-text">{{ text }}</h2>
44
+ <h2 v-html="text" class="title-text"></h2>
45
45
  <div class="action">
46
46
  <VPIconMinusSquare class="icon minus" />
47
47
  <VPIconPlusSquare class="icon plus" />
@@ -25,7 +25,7 @@ const closeSideBar = inject('close-sidebar') as () => void
25
25
  :href="item.link"
26
26
  @click="closeSideBar"
27
27
  >
28
- <span class="link-text" :class="{ light: depth > 1 }">{{ item.text }}</span>
28
+ <span v-html="item.text" class="link-text" :class="{ light: depth > 1 }"></span>
29
29
  </VPLink>
30
30
  <template
31
31
  v-if="'items' in item && depth < maxDepth"
@@ -1,10 +1,12 @@
1
1
  <script lang="ts" setup>
2
- import { ref, onMounted } from 'vue'
2
+ import { ref, onMounted, watch } from 'vue'
3
+ import { useData } from 'vitepress'
3
4
  import { APPEARANCE_KEY } from '../../shared.js'
4
5
  import VPSwitch from './VPSwitch.vue'
5
6
  import VPIconSun from './icons/VPIconSun.vue'
6
7
  import VPIconMoon from './icons/VPIconMoon.vue'
7
8
 
9
+ const { site, isDark } = useData()
8
10
  const checked = ref(false)
9
11
  const toggle = typeof localStorage !== 'undefined' ? useAppearance() : () => {}
10
12
 
@@ -16,11 +18,13 @@ function useAppearance() {
16
18
  const query = window.matchMedia('(prefers-color-scheme: dark)')
17
19
  const classList = document.documentElement.classList
18
20
 
19
- let userPreference = localStorage.getItem(APPEARANCE_KEY) || 'auto'
21
+ let userPreference =
22
+ localStorage.getItem(APPEARANCE_KEY) || site.value.appearance !== true
23
+ ? site.value.appearance
24
+ : 'auto'
20
25
 
21
- let isDark = userPreference === 'auto'
22
- ? query.matches
23
- : userPreference === 'dark'
26
+ let isDark =
27
+ userPreference === 'auto' ? query.matches : userPreference === 'dark'
24
28
 
25
29
  query.onchange = (e) => {
26
30
  if (userPreference === 'auto') {
@@ -64,6 +68,10 @@ function useAppearance() {
64
68
 
65
69
  return toggle
66
70
  }
71
+
72
+ watch(checked, (newIsDark) => {
73
+ isDark.value = newIsDark
74
+ })
67
75
  </script>
68
76
 
69
77
  <template>
@@ -26,7 +26,7 @@ body {
26
26
  color: var(--vp-c-text-1);
27
27
  background-color: var(--vp-c-bg);
28
28
  direction: ltr;
29
- font-synthesis: none;
29
+ font-synthesis: style;
30
30
  text-rendering: optimizeLegibility;
31
31
  -webkit-font-smoothing: antialiased;
32
32
  -moz-osx-font-smoothing: grayscale;
@@ -329,6 +329,62 @@
329
329
  display: inline-block;
330
330
  }
331
331
 
332
+ .vp-doc [class*='language-'] code .highlighted.error {
333
+ background-color: var(--vp-code-line-error-color);
334
+ }
335
+
336
+ .vp-doc [class*='language-'] code .highlighted.warning {
337
+ background-color: var(--vp-code-line-warning-color);
338
+ }
339
+
340
+ .vp-doc [class*='language-'] code .diff {
341
+ transition: background-color 0.5s;
342
+ margin: 0 -24px;
343
+ padding: 0 24px;
344
+ width: calc(100% + 2 * 24px);
345
+ display: inline-block;
346
+ }
347
+
348
+ .vp-doc [class*='language-'] code .diff::before {
349
+ position: absolute;
350
+ left: 1rem;
351
+ }
352
+
353
+ .vp-doc [class*='language-'] .has-focused-lines .line:not(.has-focus) {
354
+ filter: blur(0.095rem);
355
+ opacity: 0.4;
356
+ transition: filter 0.35s, opacity 0.35s;
357
+ }
358
+
359
+ .vp-doc [class*='language-'] .has-focused-lines .line:not(.has-focus) {
360
+ opacity: 0.7;
361
+ transition: filter 0.35s, opacity 0.35s;
362
+ }
363
+
364
+ .vp-doc [class*='language-']:hover .has-focused-lines .line:not(.has-focus) {
365
+ filter: blur(0);
366
+ opacity: 1;
367
+ }
368
+
369
+ .vp-doc [class*='language-'] code .diff.remove {
370
+ background-color: var(--vp-code-line-diff-remove-color);
371
+ opacity: 0.7;
372
+ }
373
+
374
+ .vp-doc [class*='language-'] code .diff.remove::before {
375
+ content: '-';
376
+ color: var(--vp-code-line-diff-remove-symbol-color);
377
+ }
378
+
379
+ .vp-doc [class*='language-'] code .diff.add {
380
+ background-color: var(--vp-code-line-diff-add-color);
381
+ }
382
+
383
+ .vp-doc [class*='language-'] code .diff.add::before {
384
+ content: '+';
385
+ color: var(--vp-code-line-diff-add-symbol-color);
386
+ }
387
+
332
388
  .vp-doc div[class*='language-'].line-numbers-mode {
333
389
  padding-left: 32px;
334
390
  }
@@ -1,3 +1,7 @@
1
+ /* webfont-marker-begin */
2
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');
3
+ /* webfont-marker-end */
4
+
1
5
  @font-face {
2
6
  font-family: 'Inter var';
3
7
  font-weight: 100 900;
@@ -145,9 +145,9 @@
145
145
  * -------------------------------------------------------------------------- */
146
146
 
147
147
  :root {
148
- --vp-font-family-base: 'Inter var experimental', 'Inter var', ui-sans-serif,
149
- system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
150
- 'Helvetica Neue', Helvetica, Arial, 'Noto Sans', sans-serif,
148
+ --vp-font-family-base: 'Inter var experimental', 'Inter var', 'Inter',
149
+ ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
150
+ Roboto, 'Helvetica Neue', Helvetica, Arial, 'Noto Sans', sans-serif,
151
151
  'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
152
152
  --vp-font-family-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco,
153
153
  Consolas, 'Liberation Mono', 'Courier New', monospace;
@@ -172,9 +172,10 @@
172
172
  :root {
173
173
  --vp-z-index-local-nav: 10;
174
174
  --vp-z-index-nav: 20;
175
- --vp-z-index-backdrop: 30;
176
- --vp-z-index-sidebar: 40;
177
- --vp-z-index-footer: 50;
175
+ --vp-z-index-layout-top: 30;
176
+ --vp-z-index-backdrop: 40;
177
+ --vp-z-index-sidebar: 50;
178
+ --vp-z-index-footer: 60;
178
179
  }
179
180
 
180
181
  /**
@@ -208,6 +209,15 @@
208
209
  --vp-code-line-highlight-color: rgba(0, 0, 0, 0.5);
209
210
  --vp-code-line-number-color: var(--vp-c-text-dark-3);
210
211
 
212
+ --vp-code-line-diff-add-color: rgba(125, 191, 123, 0.1);
213
+ --vp-code-line-diff-add-symbol-color: rgba(125, 191, 123, 0.5);
214
+
215
+ --vp-code-line-diff-remove-color: rgba(255, 128, 128, 0.05);
216
+ --vp-code-line-diff-remove-symbol-color: rgba(255, 128, 128, 0.5);
217
+
218
+ --vp-code-line-error-color: var(--vp-c-red-dimm-2);
219
+ --vp-code-line-warning-color: var(--vp-c-yellow-dimm-2);
220
+
211
221
  --vp-code-copy-code-hover-bg: rgba(255, 255, 255, 0.05);
212
222
  --vp-code-copy-code-active-text: var(--vp-c-text-dark-2);
213
223
  }
package/dist/node/cli.js CHANGED
@@ -1,5 +1,4 @@
1
- import { p as picocolors, g as build, s as serve, e as createServer } from './serve-ce51a050.js';
2
- import 'shiki';
1
+ import { p as picocolors, g as build, s as serve, e as createServer } from './serve-afe9b056.js';
3
2
  import 'fs';
4
3
  import 'path';
5
4
  import 'url';
@@ -13,6 +12,7 @@ import 'events';
13
12
  import 'stream';
14
13
  import 'buffer';
15
14
  import 'child_process';
15
+ import 'shiki-processor';
16
16
  import 'module';
17
17
  import 'util';
18
18
  import 'net';
@@ -271,7 +271,7 @@ function isConstructorOrProto (obj, key) {
271
271
  return key === 'constructor' && typeof obj[key] === 'function' || key === '__proto__';
272
272
  }
273
273
 
274
- var version = "1.0.0-alpha.21";
274
+ var version = "1.0.0-alpha.23";
275
275
 
276
276
  const argv = minimist(process.argv.slice(2));
277
277
  console.log(picocolors.exports.cyan(`vitepress v${version}`));
@@ -296,7 +296,9 @@ if (!command || command === "dev") {
296
296
  process.exit(1);
297
297
  });
298
298
  } else if (command === "build") {
299
- build(root, argv).catch((err) => {
299
+ build(root, argv).then(() => {
300
+ process.exit();
301
+ }).catch((err) => {
300
302
  console.error(picocolors.exports.red(`build error:
301
303
  `), err);
302
304
  process.exit(1);
@@ -1729,7 +1729,7 @@ interface UserConfig<ThemeConfig = any> {
1729
1729
  titleTemplate?: string | boolean;
1730
1730
  description?: string;
1731
1731
  head?: HeadConfig[];
1732
- appearance?: boolean;
1732
+ appearance?: boolean | 'dark';
1733
1733
  themeConfig?: ThemeConfig;
1734
1734
  locales?: Record<string, LocaleConfig>;
1735
1735
  markdown?: MarkdownOptions;
@@ -1774,6 +1774,15 @@ interface UserConfig<ThemeConfig = any> {
1774
1774
  * @default 'disabled'
1775
1775
  */
1776
1776
  cleanUrls?: CleanUrlsMode;
1777
+ /**
1778
+ * Use web fonts instead of emitting font files to dist.
1779
+ * The used theme should import a file named `fonts.(s)css` for this to work.
1780
+ * If you are a theme author, to support this, place your web font import
1781
+ * between `webfont-marker-begin` and `webfont-marker-end` comments.
1782
+ *
1783
+ * @default true in webcontainers, else false
1784
+ */
1785
+ useWebFonts?: boolean;
1777
1786
  /**
1778
1787
  * Build end hook: called when SSG finish.
1779
1788
  * @param siteConfig The resolved configuration.
@@ -1789,6 +1798,12 @@ interface UserConfig<ThemeConfig = any> {
1789
1798
  * HTML transform hook: runs before writing HTML to dist.
1790
1799
  */
1791
1800
  transformHtml?: (code: string, id: string, ctx: TransformContext) => Awaitable<string | void>;
1801
+ /**
1802
+ * PageData transform hook: runs when rendering markdown to vue
1803
+ */
1804
+ transformPageData?: (pageData: PageData) => Awaitable<Partial<PageData> | {
1805
+ [key: string]: any;
1806
+ } | void>;
1792
1807
  }
1793
1808
  interface TransformContext {
1794
1809
  siteConfig: SiteConfig;
@@ -1800,7 +1815,7 @@ interface TransformContext {
1800
1815
  content: string;
1801
1816
  }
1802
1817
  declare type RawConfigExports<ThemeConfig = any> = Awaitable<UserConfig<ThemeConfig>> | (() => Awaitable<UserConfig<ThemeConfig>>);
1803
- interface SiteConfig<ThemeConfig = any> extends Pick<UserConfig, 'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa' | 'lastUpdated' | 'ignoreDeadLinks' | 'cleanUrls' | 'buildEnd' | 'transformHead' | 'transformHtml'> {
1818
+ interface SiteConfig<ThemeConfig = any> extends Pick<UserConfig, 'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa' | 'lastUpdated' | 'ignoreDeadLinks' | 'cleanUrls' | 'useWebFonts' | 'buildEnd' | 'transformHead' | 'transformHtml' | 'transformPageData'> {
1804
1819
  root: string;
1805
1820
  srcDir: string;
1806
1821
  site: SiteData<ThemeConfig>;
@@ -1,4 +1,4 @@
1
- export { g as build, f as createMarkdownRenderer, e as createServer, d as defineConfig, a as defineConfigWithTheme, r as resolveConfig, b as resolveSiteData, c as resolveSiteDataByRoute, s as serve } from './serve-ce51a050.js';
1
+ export { g as build, f as createMarkdownRenderer, e as createServer, d as defineConfig, a as defineConfigWithTheme, r as resolveConfig, b as resolveSiteData, c as resolveSiteDataByRoute, s as serve } from './serve-afe9b056.js';
2
2
  import 'dns';
3
3
  import 'vite';
4
4
  import 'path';
@@ -12,7 +12,7 @@ import 'buffer';
12
12
  import 'url';
13
13
  import 'fs';
14
14
  import 'child_process';
15
- import 'shiki';
15
+ import 'shiki-processor';
16
16
  import 'module';
17
17
  import 'util';
18
18
  import 'net';
@@ -12,7 +12,7 @@ import { fileURLToPath, URL, pathToFileURL } from 'url';
12
12
  import * as require$$0$4 from 'fs';
13
13
  import require$$0__default, { readdirSync, statSync as statSync$1 } from 'fs';
14
14
  import require$$0$9 from 'child_process';
15
- import { getHighlighter } from 'shiki';
15
+ import { defineProcessor, createRangeProcessor, createFocusProcessor, createHighlightProcessor, createDiffProcessor, getHighlighter, addClass } from 'shiki-processor';
16
16
  import { createRequire } from 'module';
17
17
  import require$$1 from 'util';
18
18
  import require$$4 from 'net';
@@ -10774,9 +10774,11 @@ async function resolveConfig(root = process.cwd(), command = "serve", mode = "de
10774
10774
  mpa: !!userConfig.mpa,
10775
10775
  ignoreDeadLinks: userConfig.ignoreDeadLinks,
10776
10776
  cleanUrls: userConfig.cleanUrls || "disabled",
10777
+ useWebFonts: userConfig.useWebFonts ?? typeof process.versions.webcontainer === "string",
10777
10778
  buildEnd: userConfig.buildEnd,
10778
10779
  transformHead: userConfig.transformHead,
10779
- transformHtml: userConfig.transformHtml
10780
+ transformHtml: userConfig.transformHtml,
10781
+ transformPageData: userConfig.transformPageData
10780
10782
  };
10781
10783
  return config;
10782
10784
  }
@@ -10858,14 +10860,15 @@ async function resolveSiteData(root, userConfig, command = "serve", mode = "deve
10858
10860
  function resolveSiteDataHead(userConfig) {
10859
10861
  const head = (userConfig == null ? void 0 : userConfig.head) ?? [];
10860
10862
  if ((userConfig == null ? void 0 : userConfig.appearance) ?? true) {
10863
+ const fallbackPreference = (userConfig == null ? void 0 : userConfig.appearance) !== true ? (userConfig == null ? void 0 : userConfig.appearance) ?? "" : "auto";
10861
10864
  head.push([
10862
10865
  "script",
10863
10866
  { id: "check-dark-light" },
10864
10867
  `
10865
10868
  ;(() => {
10866
- const saved = localStorage.getItem('${APPEARANCE_KEY}')
10867
- const prefereDark = window.matchMedia('(prefers-color-scheme: dark)').matches
10868
- if (!saved || saved === 'auto' ? prefereDark : saved === 'dark') {
10869
+ const preference = localStorage.getItem('${APPEARANCE_KEY}') || '${fallbackPreference}'
10870
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
10871
+ if (!preference || preference === 'auto' ? prefersDark : preference === 'dark') {
10869
10872
  document.documentElement.classList.add('dark')
10870
10873
  }
10871
10874
  })()
@@ -34764,23 +34767,65 @@ const attrsToLines = (attrs) => {
34764
34767
  classes: ["highlighted"]
34765
34768
  }));
34766
34769
  };
34770
+ const errorLevelProcessor = defineProcessor({
34771
+ name: "error-level",
34772
+ handler: createRangeProcessor({
34773
+ error: ["highlighted", "error"],
34774
+ warning: ["highlighted", "warning"]
34775
+ })
34776
+ });
34767
34777
  async function highlight(theme = "material-palenight") {
34768
34778
  const hasSingleTheme = typeof theme === "string" || "name" in theme;
34769
34779
  const getThemeName = (themeValue) => typeof themeValue === "string" ? themeValue : themeValue.name;
34780
+ const processors = [
34781
+ createFocusProcessor(),
34782
+ createHighlightProcessor({ hasHighlightClass: "highlighted" }),
34783
+ createDiffProcessor(),
34784
+ errorLevelProcessor
34785
+ ];
34770
34786
  const highlighter = await getHighlighter({
34771
- themes: hasSingleTheme ? [theme] : [theme.dark, theme.light]
34787
+ themes: hasSingleTheme ? [theme] : [theme.dark, theme.light],
34788
+ processors
34772
34789
  });
34773
- const preRE = /^<pre.*?>/;
34790
+ const styleRE = /<pre .* (style=".*")><code>/;
34791
+ const preRE = /^<pre(.*?)>/;
34774
34792
  const vueRE = /-vue$/;
34775
34793
  return (str, lang, attrs) => {
34776
34794
  const vPre = vueRE.test(lang) ? "" : "v-pre";
34777
34795
  lang = lang.replace(vueRE, "").toLowerCase();
34778
34796
  const lineOptions = attrsToLines(attrs);
34797
+ const cleanup = (str2) => str2.replace(preRE, (_, attributes) => `<pre ${vPre}${attributes}>`).replace(styleRE, (_, style) => _.replace(style, ""));
34779
34798
  if (hasSingleTheme) {
34780
- return highlighter.codeToHtml(str, { lang, lineOptions, theme: getThemeName(theme) }).replace(preRE, `<pre ${vPre}>`);
34799
+ return cleanup(
34800
+ highlighter.codeToHtml(str, {
34801
+ lang,
34802
+ lineOptions,
34803
+ theme: getThemeName(theme)
34804
+ })
34805
+ );
34781
34806
  }
34782
- const dark = highlighter.codeToHtml(str, { lang, lineOptions, theme: getThemeName(theme.dark) }).replace(preRE, `<pre ${vPre} class="vp-code-dark">`);
34783
- const light = highlighter.codeToHtml(str, { lang, lineOptions, theme: getThemeName(theme.light) }).replace(preRE, `<pre ${vPre} class="vp-code-light">`);
34807
+ const dark = addClass(
34808
+ cleanup(
34809
+ highlighter.codeToHtml(str, {
34810
+ lang,
34811
+ lineOptions,
34812
+ theme: getThemeName(theme.dark)
34813
+ })
34814
+ ),
34815
+ "vp-code-dark",
34816
+ "pre"
34817
+ );
34818
+ const light = addClass(
34819
+ cleanup(
34820
+ highlighter.codeToHtml(str, {
34821
+ lang,
34822
+ lineOptions,
34823
+ theme: getThemeName(theme.light)
34824
+ })
34825
+ ),
34826
+ "vp-code-light",
34827
+ "pre"
34828
+ );
34784
34829
  return dark + light;
34785
34830
  };
34786
34831
  }
@@ -35575,7 +35620,7 @@ const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
35575
35620
  function clearCache() {
35576
35621
  cache$1.clear();
35577
35622
  }
35578
- async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, isBuild = false, base = "/", includeLastUpdatedData = false, cleanUrls = "disabled") {
35623
+ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, isBuild = false, base = "/", includeLastUpdatedData = false, cleanUrls = "disabled", siteConfig = null) {
35579
35624
  const md = await createMarkdownRenderer(srcDir, options, base);
35580
35625
  pages = pages.map((p) => slash(p.replace(/\.md$/, "")));
35581
35626
  const replaceRegex = genReplaceRegexp(userDefines, isBuild);
@@ -35651,7 +35696,7 @@ If it is intended, you can use:
35651
35696
  }
35652
35697
  }
35653
35698
  }
35654
- const pageData = {
35699
+ let pageData = {
35655
35700
  title: inferTitle(md, frontmatter, title),
35656
35701
  titleTemplate: frontmatter.titleTemplate,
35657
35702
  description: inferDescription(frontmatter),
@@ -35662,6 +35707,15 @@ If it is intended, you can use:
35662
35707
  if (includeLastUpdatedData) {
35663
35708
  pageData.lastUpdated = await getGitTimestamp(file);
35664
35709
  }
35710
+ if (siteConfig == null ? void 0 : siteConfig.transformPageData) {
35711
+ const dataToMerge = await siteConfig.transformPageData(pageData);
35712
+ if (dataToMerge) {
35713
+ pageData = {
35714
+ ...pageData,
35715
+ ...dataToMerge
35716
+ };
35717
+ }
35718
+ }
35665
35719
  const vueSrc = [
35666
35720
  ...injectPageDataCode(
35667
35721
  (sfcBlocks == null ? void 0 : sfcBlocks.scripts.map((item) => item.content)) ?? [],
@@ -35837,6 +35891,22 @@ const staticDataPlugin = {
35837
35891
  }
35838
35892
  };
35839
35893
 
35894
+ const webfontMarkerRE = /\/(?:\*|\/) *webfont-marker-begin *(?:\*\/|\n|\r|\n\r|\r\n)([^]*?)\/(?:\*|\/) *webfont-marker-end *(?:\*\/|\n|\r|\n\r|\r\n|$)/;
35895
+ const webFontsPlugin = (enabled = false) => ({
35896
+ name: "vitepress:webfonts",
35897
+ enforce: "pre",
35898
+ transform(code, id) {
35899
+ var _a;
35900
+ if (/[\\/]fonts\.s?css/.test(id)) {
35901
+ if (enabled) {
35902
+ return (_a = code.match(webfontMarkerRE)) == null ? void 0 : _a[1];
35903
+ } else {
35904
+ return code.replace(webfontMarkerRE, "");
35905
+ }
35906
+ }
35907
+ }
35908
+ });
35909
+
35840
35910
  const hashRE = /\.(\w+)\.js$/;
35841
35911
  const staticInjectMarkerRE = /\b(const _hoisted_\d+ = \/\*(?:#|@)__PURE__\*\/\s*createStaticVNode)\("(.*)", (\d+)\)/g;
35842
35912
  const staticStripRE = /['"`]__VP_STATIC_START__[^]*?__VP_STATIC_END__['"`]/g;
@@ -35888,7 +35958,8 @@ async function createVitePressPlugin(siteConfig, ssr = false, pageToHashMap, cli
35888
35958
  config.command === "build",
35889
35959
  config.base,
35890
35960
  lastUpdated,
35891
- cleanUrls
35961
+ cleanUrls,
35962
+ siteConfig
35892
35963
  );
35893
35964
  },
35894
35965
  config() {
@@ -36070,6 +36141,7 @@ ${path$s.relative(
36070
36141
  return [
36071
36142
  vitePressPlugin,
36072
36143
  vuePlugin,
36144
+ webFontsPlugin(siteConfig.useWebFonts),
36073
36145
  ...(userViteConfig == null ? void 0 : userViteConfig.plugins) || [],
36074
36146
  staticDataPlugin
36075
36147
  ];
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var serve = require('./serve-a3f7cc3d.cjs');
4
- require('shiki');
3
+ var serve = require('./serve-350713c3.cjs');
5
4
  require('fs');
6
5
  require('path');
7
6
  require('url');
@@ -15,6 +14,7 @@ require('events');
15
14
  require('stream');
16
15
  require('buffer');
17
16
  require('child_process');
17
+ require('shiki-processor');
18
18
  require('module');
19
19
  require('util');
20
20
  require('net');
@@ -273,7 +273,7 @@ function isConstructorOrProto (obj, key) {
273
273
  return key === 'constructor' && typeof obj[key] === 'function' || key === '__proto__';
274
274
  }
275
275
 
276
- var version = "1.0.0-alpha.21";
276
+ var version = "1.0.0-alpha.23";
277
277
 
278
278
  const argv = minimist(process.argv.slice(2));
279
279
  console.log(serve.picocolors.exports.cyan(`vitepress v${version}`));
@@ -298,7 +298,9 @@ if (!command || command === "dev") {
298
298
  process.exit(1);
299
299
  });
300
300
  } else if (command === "build") {
301
- serve.build(root, argv).catch((err) => {
301
+ serve.build(root, argv).then(() => {
302
+ process.exit();
303
+ }).catch((err) => {
302
304
  console.error(serve.picocolors.exports.red(`build error:
303
305
  `), err);
304
306
  process.exit(1);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var serve = require('./serve-a3f7cc3d.cjs');
5
+ var serve = require('./serve-350713c3.cjs');
6
6
  require('dns');
7
7
  require('vite');
8
8
  require('path');
@@ -16,7 +16,7 @@ require('buffer');
16
16
  require('url');
17
17
  require('fs');
18
18
  require('child_process');
19
- require('shiki');
19
+ require('shiki-processor');
20
20
  require('module');
21
21
  require('util');
22
22
  require('net');
@@ -13,7 +13,7 @@ var require$$0$a = require('buffer');
13
13
  var url = require('url');
14
14
  var require$$0$6 = require('fs');
15
15
  var require$$0$9 = require('child_process');
16
- var shiki = require('shiki');
16
+ var shikiProcessor = require('shiki-processor');
17
17
  var module$1 = require('module');
18
18
  var require$$1 = require('util');
19
19
  var require$$4 = require('net');
@@ -9681,8 +9681,8 @@ function sanitizeFileName(name) {
9681
9681
  return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, "_").replace(/(^|\/)_+(?=[^/]*$)/, "$1");
9682
9682
  }
9683
9683
 
9684
- const require$1 = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-a3f7cc3d.cjs', document.baseURI).href)));
9685
- const PKG_ROOT = path$s.resolve(url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-a3f7cc3d.cjs', document.baseURI).href))), "../..");
9684
+ const require$1 = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-350713c3.cjs', document.baseURI).href)));
9685
+ const PKG_ROOT = path$s.resolve(url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-350713c3.cjs', document.baseURI).href))), "../..");
9686
9686
  const DIST_CLIENT_PATH = path$s.resolve(PKG_ROOT, "client");
9687
9687
  const APP_PATH = path$s.join(DIST_CLIENT_PATH, "app");
9688
9688
  path$s.join(DIST_CLIENT_PATH, "shared");
@@ -10814,9 +10814,11 @@ async function resolveConfig(root = process.cwd(), command = "serve", mode = "de
10814
10814
  mpa: !!userConfig.mpa,
10815
10815
  ignoreDeadLinks: userConfig.ignoreDeadLinks,
10816
10816
  cleanUrls: userConfig.cleanUrls || "disabled",
10817
+ useWebFonts: userConfig.useWebFonts ?? typeof process.versions.webcontainer === "string",
10817
10818
  buildEnd: userConfig.buildEnd,
10818
10819
  transformHead: userConfig.transformHead,
10819
- transformHtml: userConfig.transformHtml
10820
+ transformHtml: userConfig.transformHtml,
10821
+ transformPageData: userConfig.transformPageData
10820
10822
  };
10821
10823
  return config;
10822
10824
  }
@@ -10898,14 +10900,15 @@ async function resolveSiteData(root, userConfig, command = "serve", mode = "deve
10898
10900
  function resolveSiteDataHead(userConfig) {
10899
10901
  const head = (userConfig == null ? void 0 : userConfig.head) ?? [];
10900
10902
  if ((userConfig == null ? void 0 : userConfig.appearance) ?? true) {
10903
+ const fallbackPreference = (userConfig == null ? void 0 : userConfig.appearance) !== true ? (userConfig == null ? void 0 : userConfig.appearance) ?? "" : "auto";
10901
10904
  head.push([
10902
10905
  "script",
10903
10906
  { id: "check-dark-light" },
10904
10907
  `
10905
10908
  ;(() => {
10906
- const saved = localStorage.getItem('${APPEARANCE_KEY}')
10907
- const prefereDark = window.matchMedia('(prefers-color-scheme: dark)').matches
10908
- if (!saved || saved === 'auto' ? prefereDark : saved === 'dark') {
10909
+ const preference = localStorage.getItem('${APPEARANCE_KEY}') || '${fallbackPreference}'
10910
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
10911
+ if (!preference || preference === 'auto' ? prefersDark : preference === 'dark') {
10909
10912
  document.documentElement.classList.add('dark')
10910
10913
  }
10911
10914
  })()
@@ -34804,23 +34807,65 @@ const attrsToLines = (attrs) => {
34804
34807
  classes: ["highlighted"]
34805
34808
  }));
34806
34809
  };
34810
+ const errorLevelProcessor = shikiProcessor.defineProcessor({
34811
+ name: "error-level",
34812
+ handler: shikiProcessor.createRangeProcessor({
34813
+ error: ["highlighted", "error"],
34814
+ warning: ["highlighted", "warning"]
34815
+ })
34816
+ });
34807
34817
  async function highlight(theme = "material-palenight") {
34808
34818
  const hasSingleTheme = typeof theme === "string" || "name" in theme;
34809
34819
  const getThemeName = (themeValue) => typeof themeValue === "string" ? themeValue : themeValue.name;
34810
- const highlighter = await shiki.getHighlighter({
34811
- themes: hasSingleTheme ? [theme] : [theme.dark, theme.light]
34820
+ const processors = [
34821
+ shikiProcessor.createFocusProcessor(),
34822
+ shikiProcessor.createHighlightProcessor({ hasHighlightClass: "highlighted" }),
34823
+ shikiProcessor.createDiffProcessor(),
34824
+ errorLevelProcessor
34825
+ ];
34826
+ const highlighter = await shikiProcessor.getHighlighter({
34827
+ themes: hasSingleTheme ? [theme] : [theme.dark, theme.light],
34828
+ processors
34812
34829
  });
34813
- const preRE = /^<pre.*?>/;
34830
+ const styleRE = /<pre .* (style=".*")><code>/;
34831
+ const preRE = /^<pre(.*?)>/;
34814
34832
  const vueRE = /-vue$/;
34815
34833
  return (str, lang, attrs) => {
34816
34834
  const vPre = vueRE.test(lang) ? "" : "v-pre";
34817
34835
  lang = lang.replace(vueRE, "").toLowerCase();
34818
34836
  const lineOptions = attrsToLines(attrs);
34837
+ const cleanup = (str2) => str2.replace(preRE, (_, attributes) => `<pre ${vPre}${attributes}>`).replace(styleRE, (_, style) => _.replace(style, ""));
34819
34838
  if (hasSingleTheme) {
34820
- return highlighter.codeToHtml(str, { lang, lineOptions, theme: getThemeName(theme) }).replace(preRE, `<pre ${vPre}>`);
34839
+ return cleanup(
34840
+ highlighter.codeToHtml(str, {
34841
+ lang,
34842
+ lineOptions,
34843
+ theme: getThemeName(theme)
34844
+ })
34845
+ );
34821
34846
  }
34822
- const dark = highlighter.codeToHtml(str, { lang, lineOptions, theme: getThemeName(theme.dark) }).replace(preRE, `<pre ${vPre} class="vp-code-dark">`);
34823
- const light = highlighter.codeToHtml(str, { lang, lineOptions, theme: getThemeName(theme.light) }).replace(preRE, `<pre ${vPre} class="vp-code-light">`);
34847
+ const dark = shikiProcessor.addClass(
34848
+ cleanup(
34849
+ highlighter.codeToHtml(str, {
34850
+ lang,
34851
+ lineOptions,
34852
+ theme: getThemeName(theme.dark)
34853
+ })
34854
+ ),
34855
+ "vp-code-dark",
34856
+ "pre"
34857
+ );
34858
+ const light = shikiProcessor.addClass(
34859
+ cleanup(
34860
+ highlighter.codeToHtml(str, {
34861
+ lang,
34862
+ lineOptions,
34863
+ theme: getThemeName(theme.light)
34864
+ })
34865
+ ),
34866
+ "vp-code-light",
34867
+ "pre"
34868
+ );
34824
34869
  return dark + light;
34825
34870
  };
34826
34871
  }
@@ -35615,7 +35660,7 @@ const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
35615
35660
  function clearCache() {
35616
35661
  cache$1.clear();
35617
35662
  }
35618
- async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, isBuild = false, base = "/", includeLastUpdatedData = false, cleanUrls = "disabled") {
35663
+ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, isBuild = false, base = "/", includeLastUpdatedData = false, cleanUrls = "disabled", siteConfig = null) {
35619
35664
  const md = await createMarkdownRenderer(srcDir, options, base);
35620
35665
  pages = pages.map((p) => slash(p.replace(/\.md$/, "")));
35621
35666
  const replaceRegex = genReplaceRegexp(userDefines, isBuild);
@@ -35691,7 +35736,7 @@ If it is intended, you can use:
35691
35736
  }
35692
35737
  }
35693
35738
  }
35694
- const pageData = {
35739
+ let pageData = {
35695
35740
  title: inferTitle(md, frontmatter, title),
35696
35741
  titleTemplate: frontmatter.titleTemplate,
35697
35742
  description: inferDescription(frontmatter),
@@ -35702,6 +35747,15 @@ If it is intended, you can use:
35702
35747
  if (includeLastUpdatedData) {
35703
35748
  pageData.lastUpdated = await getGitTimestamp(file);
35704
35749
  }
35750
+ if (siteConfig == null ? void 0 : siteConfig.transformPageData) {
35751
+ const dataToMerge = await siteConfig.transformPageData(pageData);
35752
+ if (dataToMerge) {
35753
+ pageData = {
35754
+ ...pageData,
35755
+ ...dataToMerge
35756
+ };
35757
+ }
35758
+ }
35705
35759
  const vueSrc = [
35706
35760
  ...injectPageDataCode(
35707
35761
  (sfcBlocks == null ? void 0 : sfcBlocks.scripts.map((item) => item.content)) ?? [],
@@ -35877,6 +35931,22 @@ const staticDataPlugin = {
35877
35931
  }
35878
35932
  };
35879
35933
 
35934
+ const webfontMarkerRE = /\/(?:\*|\/) *webfont-marker-begin *(?:\*\/|\n|\r|\n\r|\r\n)([^]*?)\/(?:\*|\/) *webfont-marker-end *(?:\*\/|\n|\r|\n\r|\r\n|$)/;
35935
+ const webFontsPlugin = (enabled = false) => ({
35936
+ name: "vitepress:webfonts",
35937
+ enforce: "pre",
35938
+ transform(code, id) {
35939
+ var _a;
35940
+ if (/[\\/]fonts\.s?css/.test(id)) {
35941
+ if (enabled) {
35942
+ return (_a = code.match(webfontMarkerRE)) == null ? void 0 : _a[1];
35943
+ } else {
35944
+ return code.replace(webfontMarkerRE, "");
35945
+ }
35946
+ }
35947
+ }
35948
+ });
35949
+
35880
35950
  const hashRE = /\.(\w+)\.js$/;
35881
35951
  const staticInjectMarkerRE = /\b(const _hoisted_\d+ = \/\*(?:#|@)__PURE__\*\/\s*createStaticVNode)\("(.*)", (\d+)\)/g;
35882
35952
  const staticStripRE = /['"`]__VP_STATIC_START__[^]*?__VP_STATIC_END__['"`]/g;
@@ -35928,7 +35998,8 @@ async function createVitePressPlugin(siteConfig, ssr = false, pageToHashMap, cli
35928
35998
  config.command === "build",
35929
35999
  config.base,
35930
36000
  lastUpdated,
35931
- cleanUrls
36001
+ cleanUrls,
36002
+ siteConfig
35932
36003
  );
35933
36004
  },
35934
36005
  config() {
@@ -36110,6 +36181,7 @@ ${path__default["default"].relative(
36110
36181
  return [
36111
36182
  vitePressPlugin,
36112
36183
  vuePlugin,
36184
+ webFontsPlugin(siteConfig.useWebFonts),
36113
36185
  ...(userViteConfig == null ? void 0 : userViteConfig.plugins) || [],
36114
36186
  staticDataPlugin
36115
36187
  ];
@@ -42188,7 +42260,7 @@ function linkVue() {
42188
42260
  if (root) {
42189
42261
  const dest = path__default["default"].resolve(root, "node_modules/vue");
42190
42262
  if (!fs$c.existsSync(dest)) {
42191
- const src = path__default["default"].dirname(module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-a3f7cc3d.cjs', document.baseURI).href))).resolve("vue"));
42263
+ const src = path__default["default"].dirname(module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-350713c3.cjs', document.baseURI).href))).resolve("vue"));
42192
42264
  fs$c.ensureSymlinkSync(src, dest, "junction");
42193
42265
  return () => {
42194
42266
  fs$c.unlinkSync(dest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.23",
4
4
  "description": "Vite & Vue powered static site generator",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@7.9.2",
@@ -49,15 +49,16 @@
49
49
  "url": "https://github.com/vuejs/vitepress/issues"
50
50
  },
51
51
  "dependencies": {
52
- "@docsearch/css": "^3.2.1",
53
- "@docsearch/js": "^3.2.1",
52
+ "@docsearch/css": "^3.3.0",
53
+ "@docsearch/js": "^3.3.0",
54
54
  "@vitejs/plugin-vue": "^3.1.2",
55
- "@vue/devtools-api": "^6.4.4",
56
- "@vueuse/core": "^9.3.0",
55
+ "@vue/devtools-api": "^6.4.5",
56
+ "@vueuse/core": "^9.4.0",
57
57
  "body-scroll-lock": "4.0.0-beta.0",
58
58
  "shiki": "^0.11.1",
59
- "vite": "^3.1.6",
60
- "vue": "^3.2.40"
59
+ "shiki-processor": "^0.1.0",
60
+ "vite": "^3.1.8",
61
+ "vue": "^3.2.41"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@mdit-vue/plugin-component": "^0.11.1",
@@ -67,11 +68,11 @@
67
68
  "@mdit-vue/plugin-title": "^0.11.1",
68
69
  "@mdit-vue/plugin-toc": "^0.11.1",
69
70
  "@mdit-vue/shared": "^0.11.0",
70
- "@rollup/plugin-alias": "^4.0.0",
71
- "@rollup/plugin-commonjs": "^22.0.2",
72
- "@rollup/plugin-json": "^4.1.0",
73
- "@rollup/plugin-node-resolve": "^14.1.0",
74
- "@rollup/plugin-replace": "^4.0.0",
71
+ "@rollup/plugin-alias": "^4.0.2",
72
+ "@rollup/plugin-commonjs": "^23.0.2",
73
+ "@rollup/plugin-json": "^5.0.1",
74
+ "@rollup/plugin-node-resolve": "^15.0.1",
75
+ "@rollup/plugin-replace": "^5.0.1",
75
76
  "@types/body-scroll-lock": "^3.1.0",
76
77
  "@types/compression": "^1.7.2",
77
78
  "@types/cross-spawn": "^6.0.2",
@@ -87,7 +88,7 @@
87
88
  "@types/markdown-it-emoji": "^2.0.2",
88
89
  "@types/micromatch": "^4.0.2",
89
90
  "@types/minimist": "^1.2.2",
90
- "@types/node": "^18.8.3",
91
+ "@types/node": "^18.11.5",
91
92
  "@types/prompts": "^2.4.1",
92
93
  "chokidar": "^3.5.3",
93
94
  "compression": "^1.7.4",
@@ -96,7 +97,7 @@
96
97
  "debug": "^4.3.4",
97
98
  "diacritics": "^1.3.0",
98
99
  "enquirer": "^2.3.6",
99
- "esbuild": "^0.15.10",
100
+ "esbuild": "^0.15.12",
100
101
  "escape-html": "^1.0.3",
101
102
  "execa": "^6.1.0",
102
103
  "fast-glob": "^3.2.12",
@@ -109,27 +110,27 @@
109
110
  "markdown-it-container": "^3.0.0",
110
111
  "markdown-it-emoji": "^2.0.2",
111
112
  "micromatch": "^4.0.5",
112
- "minimist": "^1.2.6",
113
+ "minimist": "^1.2.7",
113
114
  "npm-run-all": "^4.1.5",
114
115
  "ora": "^5.4.1",
115
116
  "picocolors": "^1.0.0",
116
117
  "pkg-dir": "^5.0.0",
117
- "playwright-chromium": "^1.27.0",
118
+ "playwright-chromium": "^1.27.1",
118
119
  "polka": "1.0.0-next.22",
119
120
  "prettier": "^2.7.1",
120
121
  "prompts": "^2.4.2",
121
122
  "punycode": "^2.1.1",
122
123
  "rimraf": "^3.0.2",
123
124
  "rollup": "^2.79.1",
124
- "rollup-plugin-dts": "^4.2.2",
125
+ "rollup-plugin-dts": "^4.2.3",
125
126
  "rollup-plugin-esbuild": "^4.10.1",
126
127
  "semver": "^7.3.8",
127
- "simple-git-hooks": "^2.8.0",
128
+ "simple-git-hooks": "^2.8.1",
128
129
  "sirv": "^2.0.2",
129
130
  "supports-color": "^9.2.3",
130
131
  "typescript": "~4.8.4",
131
- "vitest": "^0.24.0",
132
- "vue-tsc": "^1.0.0",
132
+ "vitest": "^0.24.3",
133
+ "vue-tsc": "^1.0.9",
133
134
  "wait-on": "^6.0.1"
134
135
  },
135
136
  "simple-git-hooks": {
package/theme.d.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  // so that users can do `import DefaultTheme from 'vitepress/theme'`
2
- import type { ComponentOptions } from 'vue'
2
+ import type { DefineComponent } from 'vue'
3
3
 
4
- export const VPHomeHero: ComponentOptions
5
- export const VPHomeFeatures: ComponentOptions
6
- export const VPHomeSponsors: ComponentOptions
7
- export const VPDocAsideSponsors: ComponentOptions
8
- export const VPTeamPage: ComponentOptions
9
- export const VPTeamPageTitle: ComponentOptions
10
- export const VPTeamPageSection: ComponentOptions
11
- export const VPTeamMembers: ComponentOptions
4
+ // TODO: add props for these
5
+ export const VPHomeHero: DefineComponent
6
+ export const VPHomeFeatures: DefineComponent
7
+ export const VPHomeSponsors: DefineComponent
8
+ export const VPDocAsideSponsors: DefineComponent
9
+ export const VPTeamPage: DefineComponent
10
+ export const VPTeamPageTitle: DefineComponent
11
+ export const VPTeamPageSection: DefineComponent
12
+ export const VPTeamMembers: DefineComponent
12
13
 
13
14
  declare const theme: {
14
- Layout: ComponentOptions
15
- NotFound: ComponentOptions
15
+ Layout: DefineComponent
16
+ NotFound: DefineComponent
16
17
  }
17
18
 
18
19
  export default theme
package/types/shared.d.ts CHANGED
@@ -62,7 +62,7 @@ export interface SiteData<ThemeConfig = any> {
62
62
  titleTemplate?: string | boolean
63
63
  description: string
64
64
  head: HeadConfig[]
65
- appearance: boolean
65
+ appearance: boolean | 'dark'
66
66
  themeConfig: ThemeConfig
67
67
  scrollOffset: number | string
68
68
  locales: Record<string, LocaleConfig>