vitepress 0.20.0 → 0.20.4
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: ({
|
|
89
|
+
navigate: ({ itemUrl }: { itemUrl: string }) => {
|
|
90
90
|
const { pathname: hitPathname } = new URL(
|
|
91
|
-
window.location.origin +
|
|
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 +
|
|
97
|
+
window.location.assign(window.location.origin + itemUrl)
|
|
98
98
|
} else {
|
|
99
|
-
router.go(
|
|
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-
|
|
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');
|
package/dist/node/index.d.ts
CHANGED
|
@@ -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>;
|
package/dist/node/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var serve = require('./serve-
|
|
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);
|
|
@@ -36332,7 +36330,6 @@ function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, i
|
|
|
36332
36330
|
let includes = [];
|
|
36333
36331
|
src = src.replace(includesRE, (_, m1) => {
|
|
36334
36332
|
const includePath = path__default["default"].join(dir, m1);
|
|
36335
|
-
console.log(includePath);
|
|
36336
36333
|
const content2 = fs__default["default"].readFileSync(includePath, "utf-8");
|
|
36337
36334
|
includes.push(slash(includePath));
|
|
36338
36335
|
return content2;
|
|
@@ -36454,8 +36451,8 @@ var __spreadValues$1 = (a, b) => {
|
|
|
36454
36451
|
};
|
|
36455
36452
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
36456
36453
|
const hashRE = /\.(\w+)\.js$/;
|
|
36457
|
-
const staticInjectMarkerRE = /\b(const _hoisted_\d+ =
|
|
36458
|
-
const staticStripRE = /__VP_STATIC_START__
|
|
36454
|
+
const staticInjectMarkerRE = /\b(const _hoisted_\d+ = \/\*(?:#|@)__PURE__\*\/\s*createStaticVNode)\("(.*)", (\d+)\)/g;
|
|
36455
|
+
const staticStripRE = /['"`]__VP_STATIC_START__[^]*?__VP_STATIC_END__['"`]/g;
|
|
36459
36456
|
const staticRestoreRE = /__VP_STATIC_(START|END)__/g;
|
|
36460
36457
|
const scriptClientRE = /<script\b[^>]*client\b[^>]*>([^]*?)<\/script>/;
|
|
36461
36458
|
const isPageChunk = (chunk) => !!(chunk.type === "chunk" && chunk.isEntry && chunk.facadeModuleId && chunk.facadeModuleId.endsWith(".md"));
|
|
@@ -36471,7 +36468,7 @@ function createVitePressPlugin(root, siteConfig, ssr = false, pageToHashMap, cli
|
|
|
36471
36468
|
pages
|
|
36472
36469
|
} = siteConfig;
|
|
36473
36470
|
let markdownToVue;
|
|
36474
|
-
const vuePlugin =
|
|
36471
|
+
const vuePlugin = require("@vitejs/plugin-vue")(__spreadValues$1({
|
|
36475
36472
|
include: [/\.vue$/, /\.md$/]
|
|
36476
36473
|
}, userVuePluginOptions));
|
|
36477
36474
|
const processClientJS = (code, id) => {
|
|
@@ -36595,7 +36592,7 @@ function createVitePressPlugin(root, siteConfig, ssr = false, pageToHashMap, cli
|
|
|
36595
36592
|
pageToHashMap[chunk.name.toLowerCase()] = hash;
|
|
36596
36593
|
bundle[name + "-lean"] = __spreadProps$1(__spreadValues$1({}, chunk), {
|
|
36597
36594
|
fileName: chunk.fileName.replace(/\.js$/, ".lean.js"),
|
|
36598
|
-
code: chunk.code.replace(staticStripRE,
|
|
36595
|
+
code: chunk.code.replace(staticStripRE, `""`)
|
|
36599
36596
|
});
|
|
36600
36597
|
chunk.code = chunk.code.replace(staticRestoreRE, "");
|
|
36601
36598
|
}
|
|
@@ -36623,9 +36620,7 @@ function createVitePressPlugin(root, siteConfig, ssr = false, pageToHashMap, cli
|
|
|
36623
36620
|
pageData
|
|
36624
36621
|
}
|
|
36625
36622
|
});
|
|
36626
|
-
|
|
36627
|
-
read: () => vueSrc
|
|
36628
|
-
}));
|
|
36623
|
+
ctx.read = () => vueSrc;
|
|
36629
36624
|
}
|
|
36630
36625
|
}
|
|
36631
36626
|
};
|
|
@@ -65025,6 +65020,7 @@ async function serve(options = {}) {
|
|
|
65025
65020
|
}
|
|
65026
65021
|
|
|
65027
65022
|
exports.build = build;
|
|
65023
|
+
exports.createMarkdownRenderer = createMarkdownRenderer;
|
|
65028
65024
|
exports.createServer = createServer;
|
|
65029
65025
|
exports.defineConfig = defineConfig;
|
|
65030
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.
|
|
3
|
+
"version": "0.20.4",
|
|
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": "^
|
|
46
|
-
"@docsearch/js": "^
|
|
47
|
-
"@vitejs/plugin-vue": "^1.
|
|
45
|
+
"@docsearch/css": "^3.0.0-alpha.41",
|
|
46
|
+
"@docsearch/js": "^3.0.0-alpha.41",
|
|
47
|
+
"@vitejs/plugin-vue": "^1.10.1",
|
|
48
48
|
"prismjs": "^1.25.0",
|
|
49
|
-
"vite": "^2.
|
|
50
|
-
"vue": "^3.2.
|
|
49
|
+
"vite": "^2.7.0-beta.8",
|
|
50
|
+
"vue": "^3.2.24"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@microsoft/api-extractor": "^7.18.9",
|