vitepress 0.20.1 → 0.20.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.
@@ -86,17 +86,17 @@ function initialize(userOptions: any) {
86
86
  }),
87
87
 
88
88
  navigator: {
89
- navigate: ({ suggestionUrl }: { suggestionUrl: string }) => {
89
+ navigate: ({ itemUrl }: { itemUrl: string }) => {
90
90
  const { pathname: hitPathname } = new URL(
91
- window.location.origin + suggestionUrl
91
+ window.location.origin + itemUrl
92
92
  )
93
93
 
94
94
  // Router doesn't handle same-page navigation so we use the native
95
95
  // browser location API for anchor navigation
96
96
  if (route.path === hitPathname) {
97
- window.location.assign(window.location.origin + suggestionUrl)
97
+ window.location.assign(window.location.origin + itemUrl)
98
98
  } else {
99
- router.go(suggestionUrl)
99
+ router.go(itemUrl)
100
100
  }
101
101
  }
102
102
  },
@@ -148,7 +148,8 @@ function initialize(userOptions: any) {
148
148
  router.go(relativeHit)
149
149
  },
150
150
  children
151
- }
151
+ },
152
+ __v: null
152
153
  }
153
154
  }
154
155
  })
package/dist/node/cli.js CHANGED
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var serve = require('./serve-3fdbda2c.js');
3
+ var serve = require('./serve-f83deb60.js');
4
+ require('fs');
5
+ require('path');
6
+ require('url');
4
7
  require('vite');
5
8
  require('readline');
6
9
  require('assert');
@@ -8,12 +11,8 @@ require('events');
8
11
  require('stream');
9
12
  require('util');
10
13
  require('buffer');
11
- require('path');
12
- require('fs');
13
14
  require('punycode');
14
15
  require('prismjs');
15
- require('url');
16
- require('@vitejs/plugin-vue');
17
16
  require('querystring');
18
17
  require('tty');
19
18
  require('net');
@@ -11,6 +11,8 @@ export declare function build(root: string, buildOptions?: BuildOptions & {
11
11
  mpa?: string;
12
12
  }): Promise<void>;
13
13
 
14
+ export declare const createMarkdownRenderer: (srcDir: string, options?: MarkdownOptions) => MarkdownRenderer;
15
+
14
16
  export declare function createServer(root?: string, serverOptions?: ServerOptions): Promise<ViteDevServer>;
15
17
 
16
18
  /**
@@ -22,6 +24,12 @@ export declare type HeadConfig =
22
24
  | [string, Record<string, string>]
23
25
  | [string, Record<string, string>, string]
24
26
 
27
+ export declare interface Header {
28
+ level: number
29
+ title: string
30
+ slug: string
31
+ }
32
+
25
33
  export declare interface LocaleConfig {
26
34
  lang: string
27
35
  title?: string
@@ -46,6 +54,20 @@ export declare interface MarkdownOptions extends MarkdownIt.Options {
46
54
  externalLinks?: Record<string, string>;
47
55
  }
48
56
 
57
+ export declare interface MarkdownParsedData {
58
+ hoistedTags?: string[];
59
+ links?: string[];
60
+ headers?: Header[];
61
+ }
62
+
63
+ export declare interface MarkdownRenderer {
64
+ __data: MarkdownParsedData;
65
+ render: (src: string, env?: any) => {
66
+ html: string;
67
+ data: any;
68
+ };
69
+ }
70
+
49
71
  export declare type RawConfigExports = UserConfig | Promise<UserConfig> | (() => UserConfig | Promise<UserConfig>);
50
72
 
51
73
  export declare function resolveConfig(root?: string, command?: 'serve' | 'build', mode?: string): Promise<SiteConfig>;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var serve = require('./serve-3fdbda2c.js');
5
+ var serve = require('./serve-f83deb60.js');
6
6
  require('vite');
7
7
  require('readline');
8
8
  require('assert');
@@ -15,7 +15,6 @@ require('fs');
15
15
  require('punycode');
16
16
  require('prismjs');
17
17
  require('url');
18
- require('@vitejs/plugin-vue');
19
18
  require('querystring');
20
19
  require('tty');
21
20
  require('net');
@@ -27,6 +26,7 @@ require('http');
27
26
 
28
27
 
29
28
  exports.build = serve.build;
29
+ exports.createMarkdownRenderer = serve.createMarkdownRenderer;
30
30
  exports.createServer = serve.createServer;
31
31
  exports.defineConfig = serve.defineConfig;
32
32
  exports.resolveConfig = serve.resolveConfig;
@@ -12,7 +12,6 @@ var fs$v = require('fs');
12
12
  var require$$8 = require('punycode');
13
13
  var prism = require('prismjs');
14
14
  var url$1 = require('url');
15
- var createVuePlugin = require('@vitejs/plugin-vue');
16
15
  var qs = require('querystring');
17
16
  var require$$0$9 = require('tty');
18
17
  var require$$4 = require('net');
@@ -52,7 +51,6 @@ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$v);
52
51
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs$v);
53
52
  var require$$8__default = /*#__PURE__*/_interopDefaultLegacy(require$$8);
54
53
  var prism__default = /*#__PURE__*/_interopDefaultLegacy(prism);
55
- var createVuePlugin__default = /*#__PURE__*/_interopDefaultLegacy(createVuePlugin);
56
54
  var qs__namespace = /*#__PURE__*/_interopNamespace(qs);
57
55
  var qs__default = /*#__PURE__*/_interopDefaultLegacy(qs);
58
56
  var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9);
@@ -36453,8 +36451,8 @@ var __spreadValues$1 = (a, b) => {
36453
36451
  };
36454
36452
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
36455
36453
  const hashRE = /\.(\w+)\.js$/;
36456
- const staticInjectMarkerRE = /\b(const _hoisted_\d+ = \/\*#__PURE__\*\/createStaticVNode)\("(.*)", (\d+)\)/g;
36457
- const staticStripRE = /__VP_STATIC_START__.*?__VP_STATIC_END__/g;
36454
+ const staticInjectMarkerRE = /\b(const _hoisted_\d+ = \/\*(?:#|@)__PURE__\*\/\s*createStaticVNode)\("(.*)", (\d+)\)/g;
36455
+ const staticStripRE = /['"`]__VP_STATIC_START__[^]*?__VP_STATIC_END__['"`]/g;
36458
36456
  const staticRestoreRE = /__VP_STATIC_(START|END)__/g;
36459
36457
  const scriptClientRE = /<script\b[^>]*client\b[^>]*>([^]*?)<\/script>/;
36460
36458
  const isPageChunk = (chunk) => !!(chunk.type === "chunk" && chunk.isEntry && chunk.facadeModuleId && chunk.facadeModuleId.endsWith(".md"));
@@ -36470,7 +36468,7 @@ function createVitePressPlugin(root, siteConfig, ssr = false, pageToHashMap, cli
36470
36468
  pages
36471
36469
  } = siteConfig;
36472
36470
  let markdownToVue;
36473
- const vuePlugin = createVuePlugin__default["default"](__spreadValues$1({
36471
+ const vuePlugin = require("@vitejs/plugin-vue")(__spreadValues$1({
36474
36472
  include: [/\.vue$/, /\.md$/]
36475
36473
  }, userVuePluginOptions));
36476
36474
  const processClientJS = (code, id) => {
@@ -36594,7 +36592,7 @@ function createVitePressPlugin(root, siteConfig, ssr = false, pageToHashMap, cli
36594
36592
  pageToHashMap[chunk.name.toLowerCase()] = hash;
36595
36593
  bundle[name + "-lean"] = __spreadProps$1(__spreadValues$1({}, chunk), {
36596
36594
  fileName: chunk.fileName.replace(/\.js$/, ".lean.js"),
36597
- code: chunk.code.replace(staticStripRE, ``)
36595
+ code: chunk.code.replace(staticStripRE, `""`)
36598
36596
  });
36599
36597
  chunk.code = chunk.code.replace(staticRestoreRE, "");
36600
36598
  }
@@ -65022,6 +65020,7 @@ async function serve(options = {}) {
65022
65020
  }
65023
65021
 
65024
65022
  exports.build = build;
65023
+ exports.createMarkdownRenderer = createMarkdownRenderer;
65025
65024
  exports.createServer = createServer;
65026
65025
  exports.defineConfig = defineConfig;
65027
65026
  exports.resolveConfig = resolveConfig;
@@ -0,0 +1,163 @@
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) => MarkdownRenderer;
15
+
16
+ export declare function createServer(root?: string, serverOptions?: ServerOptions): Promise<ViteDevServer>;
17
+
18
+ /**
19
+ * Type config helper
20
+ */
21
+ export declare function defineConfig(config: RawConfigExports): RawConfigExports;
22
+
23
+ export declare type HeadConfig =
24
+ | [string, Record<string, string>]
25
+ | [string, Record<string, string>, string]
26
+
27
+ export declare interface Header {
28
+ level: number
29
+ title: string
30
+ slug: string
31
+ }
32
+
33
+ export declare interface LocaleConfig {
34
+ lang: string
35
+ title?: string
36
+ description?: string
37
+ head?: HeadConfig[]
38
+ label?: string
39
+ selectText?: string
40
+ }
41
+
42
+ export declare interface MarkdownOptions extends MarkdownIt.Options {
43
+ lineNumbers?: boolean;
44
+ config?: (md: MarkdownIt) => void;
45
+ anchor?: {
46
+ permalink?: anchor.AnchorOptions['permalink'];
47
+ };
48
+ attrs?: {
49
+ leftDelimiter?: string;
50
+ rightDelimiter?: string;
51
+ allowedAttributes?: string[];
52
+ };
53
+ toc?: any;
54
+ externalLinks?: Record<string, string>;
55
+ }
56
+
57
+ export declare interface MarkdownParsedData {
58
+ hoistedTags?: string[];
59
+ links?: string[];
60
+ headers?: Header[];
61
+ }
62
+
63
+ export declare interface MarkdownRenderer {
64
+ __data: MarkdownParsedData;
65
+ render: (src: string, env?: any) => {
66
+ html: string;
67
+ data: any;
68
+ };
69
+ }
70
+
71
+ export declare type RawConfigExports = UserConfig | Promise<UserConfig> | (() => UserConfig | Promise<UserConfig>);
72
+
73
+ export declare function resolveConfig(root?: string, command?: 'serve' | 'build', mode?: string): Promise<SiteConfig>;
74
+
75
+ export declare function resolveSiteData(root: string, userConfig?: UserConfig, command?: 'serve' | 'build', mode?: string): Promise<SiteData>;
76
+
77
+ export declare function resolveSiteDataByRoute(siteData: SiteData, route: string): SiteData;
78
+
79
+ export declare function serve(options?: ServeOptions): Promise<void>;
80
+
81
+ export declare interface ServeOptions {
82
+ root?: string;
83
+ port?: number;
84
+ }
85
+
86
+ export declare interface SiteConfig<ThemeConfig = any> {
87
+ root: string;
88
+ srcDir: string;
89
+ site: SiteData<ThemeConfig>;
90
+ configPath: string | undefined;
91
+ themeDir: string;
92
+ outDir: string;
93
+ tempDir: string;
94
+ alias: AliasOptions;
95
+ pages: string[];
96
+ markdown: MarkdownOptions | undefined;
97
+ vue: Options | undefined;
98
+ vite: UserConfig_2 | undefined;
99
+ mpa: boolean;
100
+ }
101
+
102
+ export declare interface SiteData<ThemeConfig = any> {
103
+ base: string
104
+ /**
105
+ * Language of the site as it should be set on the `html` element.
106
+ * @example `en-US`, `zh-CN`
107
+ */
108
+ lang: string
109
+ title: string
110
+ description: string
111
+ head: HeadConfig[]
112
+ themeConfig: ThemeConfig
113
+ locales: Record<string, LocaleConfig>
114
+ /**
115
+ * Available locales for the site when it has defined `locales` in its
116
+ * `themeConfig`. This object is otherwise empty. Keys are paths like `/` or
117
+ * `/zh/`.
118
+ */
119
+ langs: Record<
120
+ string,
121
+ {
122
+ /**
123
+ * Lang attribute as set on the `<html>` element.
124
+ * @example `en-US`, `zh-CN`
125
+ */
126
+ lang: string
127
+ /**
128
+ * Label to display in the language menu.
129
+ * @example `English`, `简体中文`
130
+ */
131
+ label: string
132
+ }
133
+ >
134
+ }
135
+
136
+ export declare interface UserConfig<ThemeConfig = any> {
137
+ extends?: RawConfigExports;
138
+ lang?: string;
139
+ base?: string;
140
+ title?: string;
141
+ description?: string;
142
+ head?: HeadConfig[];
143
+ themeConfig?: ThemeConfig;
144
+ locales?: Record<string, LocaleConfig>;
145
+ markdown?: MarkdownOptions;
146
+ /**
147
+ * Opitons to pass on to `@vitejs/plugin-vue`
148
+ */
149
+ vue?: Options;
150
+ /**
151
+ * Vite config
152
+ */
153
+ vite?: UserConfig_2;
154
+ srcDir?: string;
155
+ srcExclude?: string[];
156
+ /**
157
+ * Enable MPA / zero-JS mode
158
+ * @experimental
159
+ */
160
+ mpa?: boolean;
161
+ }
162
+
163
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress",
3
- "version": "0.20.1",
3
+ "version": "0.20.5",
4
4
  "description": "Vite & Vue powered static site generator",
5
5
  "main": "dist/node/index.js",
6
6
  "typings": "types/index.d.ts",
@@ -42,12 +42,12 @@
42
42
  "url": "https://github.com/vuejs/vitepress/issues"
43
43
  },
44
44
  "dependencies": {
45
- "@docsearch/css": "^1.0.0-alpha.28",
46
- "@docsearch/js": "^1.0.0-alpha.28",
47
- "@vitejs/plugin-vue": "^1.9.0",
45
+ "@docsearch/css": "^3.0.0-alpha.41",
46
+ "@docsearch/js": "^3.0.0-alpha.41",
47
+ "@vitejs/plugin-vue": "^2.0.0",
48
48
  "prismjs": "^1.25.0",
49
- "vite": "^2.6.5",
50
- "vue": "^3.2.19"
49
+ "vite": "^2.7.0",
50
+ "vue": "^3.2.26"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@microsoft/api-extractor": "^7.18.9",