vitepress 0.21.5 → 0.21.6

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.
@@ -5,7 +5,8 @@ import { withBase } from './utils';
5
5
  export const dataSymbol = Symbol();
6
6
  export const siteDataRef = shallowRef(parse(serializedSiteData));
7
7
  function parse(data) {
8
- return readonly(JSON.parse(data));
8
+ const parsed = JSON.parse(data);
9
+ return (import.meta.env.DEV ? readonly(parsed) : parsed);
9
10
  }
10
11
  // hmr
11
12
  if (import.meta.hot) {
@@ -1,4 +1,5 @@
1
1
  export const EXTERNAL_URL_RE = /^https?:/i;
2
+ // @ts-ignore
2
3
  export const inBrowser = typeof window !== 'undefined';
3
4
  function findMatchRoot(route, roots) {
4
5
  // first match to the routes with the most deep level.
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var serve = require('./serve-322f3382.js');
3
+ var serve = require('./serve-9874c5ac.js');
4
4
  require('fs');
5
5
  require('path');
6
6
  require('url');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var serve = require('./serve-322f3382.js');
5
+ var serve = require('./serve-9874c5ac.js');
6
6
  require('vite');
7
7
  require('readline');
8
8
  require('assert');
@@ -12302,7 +12302,7 @@ function cleanRoute(siteData, route) {
12302
12302
  const PKG_ROOT = path__default["default"].join(__dirname, "../../");
12303
12303
  const DIST_CLIENT_PATH = path__default["default"].join(__dirname, "../client");
12304
12304
  const APP_PATH = path__default["default"].join(DIST_CLIENT_PATH, "app");
12305
- const SHARED_PATH = path__default["default"].join(DIST_CLIENT_PATH, "shared");
12305
+ path__default["default"].join(DIST_CLIENT_PATH, "shared");
12306
12306
  const DEFAULT_THEME_PATH = path__default["default"].join(DIST_CLIENT_PATH, "theme-default");
12307
12307
  const SITE_DATA_ID = "@siteData";
12308
12308
  const SITE_DATA_REQUEST_PATH = "/" + SITE_DATA_ID;
@@ -12310,7 +12310,7 @@ const vueRuntimePath = "vue/dist/vue.runtime.esm-bundler.js";
12310
12310
  function resolveAliases(root, themeDir) {
12311
12311
  const paths = {
12312
12312
  "/@theme": themeDir,
12313
- "/@shared": SHARED_PATH,
12313
+ "@theme": themeDir,
12314
12314
  [SITE_DATA_ID]: SITE_DATA_REQUEST_PATH
12315
12315
  };
12316
12316
  let vuePath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress",
3
- "version": "0.21.5",
3
+ "version": "0.21.6",
4
4
  "description": "Vite & Vue powered static site generator",
5
5
  "main": "dist/node/index.js",
6
6
  "typings": "types/index.d.ts",
@@ -14,6 +14,33 @@
14
14
  "client.d.ts",
15
15
  "theme.d.ts"
16
16
  ],
17
+ "scripts": {
18
+ "dev": "run-s dev-shared dev-start",
19
+ "dev-start": "run-p dev-client dev-node dev-watch",
20
+ "dev-client": "tsc -w -p src/client",
21
+ "dev-node": "tsc -w -p src/node",
22
+ "dev-shared": "node scripts/copyShared",
23
+ "dev-watch": "node scripts/watchAndCopy",
24
+ "build": "run-s build-prepare build-client build-node build-types",
25
+ "build-prepare": "rimraf -rf dist && node scripts/copyShared",
26
+ "build-client": "tsc -p src/client && node scripts/copyClient",
27
+ "build-node": "rollup -c scripts/rollup.config.js",
28
+ "build-types": "run-s build-types-client build-types-node",
29
+ "build-types-client": "tsc -p src/client --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.client.json && rimraf dist/temp",
30
+ "build-types-node": "tsc -p src/node --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.node.json && rimraf dist/temp",
31
+ "lint": "run-s lint:js lint:ts",
32
+ "lint:js": "prettier --check --write \"{bin,docs,scripts,src}/**/*.js\"",
33
+ "lint:ts": "prettier --check --write --parser typescript \"{__tests__,src,docs,types}/**/*.ts\"",
34
+ "test": "vitest run __tests__ -c __tests__/vitest.config.js --global",
35
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
36
+ "release": "node scripts/release.js",
37
+ "docs": "run-p dev docs-dev",
38
+ "docs-dev": "node ./bin/vitepress dev docs",
39
+ "docs-debug": "node --inspect-brk ./bin/vitepress dev docs",
40
+ "docs-build": "npm run build && node ./bin/vitepress build docs",
41
+ "docs-serve": "node ./bin/vitepress serve docs",
42
+ "ci-docs": "run-s build docs-build"
43
+ },
17
44
  "engines": {
18
45
  "node": ">=12.0.0"
19
46
  },
@@ -60,7 +87,6 @@
60
87
  "@types/compression": "^1.7.0",
61
88
  "@types/debug": "^4.1.7",
62
89
  "@types/fs-extra": "^9.0.11",
63
- "@types/jest": "^27.0.0",
64
90
  "@types/koa": "^2.13.1",
65
91
  "@types/koa-static": "^4.0.1",
66
92
  "@types/lru-cache": "^5.1.0",
@@ -82,7 +108,6 @@
82
108
  "fs-extra": "^10.0.0",
83
109
  "globby": "^11.0.3",
84
110
  "gray-matter": "^4.0.3",
85
- "jest": "^27.0.1",
86
111
  "lint-staged": "^11.0.0",
87
112
  "lru-cache": "^6.0.0",
88
113
  "markdown-it": "^12.3.2",
@@ -102,36 +127,18 @@
102
127
  "rollup-plugin-esbuild": "^4.8.2",
103
128
  "semver": "^7.3.5",
104
129
  "sirv": "^1.0.12",
105
- "ts-jest": "^27.0.1",
106
130
  "typescript": "^4.3.2",
131
+ "vitest": "^0.1.19",
107
132
  "yorkie": "^2.0.0"
108
133
  },
109
- "scripts": {
110
- "dev": "run-s dev-shared dev-start",
111
- "dev-start": "run-p dev-client dev-node dev-watch",
112
- "dev-client": "tsc -w -p src/client",
113
- "dev-node": "tsc -w -p src/node",
114
- "dev-shared": "node scripts/copyShared",
115
- "dev-watch": "node scripts/watchAndCopy",
116
- "build": "run-s build-prepare build-client build-node build-types",
117
- "build-prepare": "rimraf -rf dist && node scripts/copyShared",
118
- "build-client": "tsc -p src/client && node scripts/copyClient",
119
- "build-node": "rollup -c scripts/rollup.config.js",
120
- "build-types": "run-s build-types-client build-types-node",
121
- "build-types-client": "tsc -p src/client --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.client.json && rimraf dist/temp",
122
- "build-types-node": "tsc -p src/node --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.node.json && rimraf dist/temp",
123
- "lint": "run-s lint:js lint:ts",
124
- "lint:js": "prettier --check --write \"{bin,docs,scripts,src}/**/*.js\"",
125
- "lint:ts": "prettier --check --write --parser typescript \"{__tests__,src,docs,types}/**/*.ts\"",
126
- "test": "jest",
127
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
128
- "release": "node scripts/release.js",
129
- "docs": "run-p dev docs-dev",
130
- "docs-dev": "node ./bin/vitepress dev docs",
131
- "docs-debug": "node --inspect-brk ./bin/vitepress dev docs",
132
- "docs-build": "npm run build && node ./bin/vitepress build docs",
133
- "docs-serve": "node ./bin/vitepress serve docs",
134
- "ci-docs": "run-s build docs-build"
135
- },
136
- "readme": "# (WIP) VitePress 📝💨\n\n[![Test](https://github.com/vuejs/vitepress/workflows/Test/badge.svg)](https://github.com/vuejs/vitepress/actions)\n[![npm](https://img.shields.io/npm/v/vitepress)](https://www.npmjs.com/package/vitepress)\n\n---\n\nVitePress is [VuePress](http://vuepress.vuejs.org/)' spiritual successor, built on top of [vite](https://github.com/vuejs/vite).\n\n## Documentation\n\nTo check out docs, visit [vitepress.vuejs.org](https://vitepress.vuejs.org).\n\n## Changelog\n\nDetailed changes for each release are documented in the [CHANGELOG](https://github.com/vuejs/vitepress/blob/master/CHANGELOG.md).\n\n## Contribution\n\nPlease make sure to read the [Contributing Guide](./.github/contributing.md) before making a pull request.\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n\nCopyright (c) 2019-present, Yuxi (Evan) You\n"
137
- }
134
+ "pnpm": {
135
+ "peerDependencyRules": {
136
+ "ignoreMissing": [
137
+ "@algolia/client-search",
138
+ "react",
139
+ "react-dom",
140
+ "@types/react"
141
+ ]
142
+ }
143
+ }
144
+ }
@@ -1,317 +0,0 @@
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
- export declare namespace DefaultTheme {
19
- export interface Config {
20
- logo?: string
21
- nav?: NavItem[] | false
22
- sidebar?: SideBarConfig | MultiSideBarConfig
23
-
24
- /**
25
- * GitHub repository following the format <user>/<project>.
26
- *
27
- * @example `"vuejs/vue-next"`
28
- */
29
- repo?: string
30
-
31
- /**
32
- * Customize the header label. Defaults to GitHub/Gitlab/Bitbucket
33
- * depending on the provided repo.
34
- *
35
- * @example `"Contribute!"`
36
- */
37
- repoLabel?: string
38
-
39
- /**
40
- * If your docs are in a different repository from your main project.
41
- *
42
- * @example `"vuejs/docs-next"`
43
- */
44
- docsRepo?: string
45
-
46
- /**
47
- * If your docs are not at the root of the repo.
48
- *
49
- * @example `"docs"`
50
- */
51
- docsDir?: string
52
-
53
- /**
54
- * If your docs are in a different branch. Defaults to `master`.
55
- *
56
- * @example `"next"`
57
- */
58
- docsBranch?: string
59
-
60
- /**
61
- * Enable links to edit pages at the bottom of the page.
62
- */
63
- editLinks?: boolean
64
-
65
- /**
66
- * Custom text for edit link. Defaults to "Edit this page".
67
- */
68
- editLinkText?: string
69
-
70
- /**
71
- * Show last updated time at the bottom of the page. Defaults to `false`.
72
- * If given a string, it will be displayed as a prefix (default value:
73
- * "Last Updated").
74
- */
75
- lastUpdated?: string | boolean
76
-
77
- prevLinks?: boolean
78
- nextLinks?: boolean
79
-
80
- locales?: Record<string, LocaleConfig & Omit<Config, 'locales'>>
81
-
82
- algolia?: AlgoliaSearchOptions
83
-
84
- carbonAds?: {
85
- carbon: string
86
- custom?: string
87
- placement: string
88
- }
89
- }
90
-
91
- // navbar --------------------------------------------------------------------
92
-
93
- export type NavItem = NavItemWithLink | NavItemWithChildren
94
-
95
- export interface NavItemBase {
96
- text: string
97
- target?: string
98
- rel?: string
99
- ariaLabel?: string
100
- activeMatch?: string
101
- }
102
-
103
- export interface NavItemWithLink extends NavItemBase {
104
- link: string
105
- }
106
-
107
- export interface NavItemWithChildren extends NavItemBase {
108
- items: NavItemWithLink[]
109
- }
110
-
111
- // sidebar -------------------------------------------------------------------
112
-
113
- export type SideBarConfig = SideBarItem[] | 'auto' | false
114
-
115
- export interface MultiSideBarConfig {
116
- [path: string]: SideBarConfig
117
- }
118
-
119
- export type SideBarItem = SideBarLink | SideBarGroup
120
-
121
- export interface SideBarLink {
122
- text: string
123
- link: string
124
- }
125
-
126
- export interface SideBarGroup {
127
- text: string
128
- link?: string
129
-
130
- /**
131
- * @default false
132
- */
133
- collapsable?: boolean
134
-
135
- children: SideBarItem[]
136
- }
137
-
138
- // algolia ------------------------------------------------------------------
139
- // partially copied from @docsearch/react/dist/esm/DocSearch.d.ts
140
- export interface AlgoliaSearchOptions {
141
- appId?: string
142
- apiKey: string
143
- indexName: string
144
- placeholder?: string
145
- searchParameters?: any
146
- disableUserPersonalization?: boolean
147
- initialQuery?: string
148
- }
149
-
150
- // locales -------------------------------------------------------------------
151
-
152
- export interface LocaleConfig {
153
- /**
154
- * Text for the language dropdown.
155
- */
156
- selectText?: string
157
-
158
- /**
159
- * Label for this locale in the language dropdown.
160
- */
161
- label?: string
162
- }
163
- }
164
-
165
- /**
166
- * Type config helper
167
- */
168
- export declare function defineConfig(config: UserConfig<DefaultTheme.Config>): UserConfig<DefaultTheme.Config>;
169
-
170
- /**
171
- * Type config helper for custom theme config
172
- */
173
- export declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig<ThemeConfig>): UserConfig<ThemeConfig>;
174
-
175
- export declare type HeadConfig =
176
- | [string, Record<string, string>]
177
- | [string, Record<string, string>, string]
178
-
179
- export declare interface Header {
180
- level: number
181
- title: string
182
- slug: string
183
- }
184
-
185
- export declare interface LocaleConfig {
186
- lang: string
187
- title?: string
188
- description?: string
189
- head?: HeadConfig[]
190
- label?: string
191
- selectText?: string
192
- }
193
-
194
- export declare interface MarkdownOptions extends MarkdownIt.Options {
195
- lineNumbers?: boolean;
196
- config?: (md: MarkdownIt) => void;
197
- anchor?: {
198
- permalink?: anchor.AnchorOptions['permalink'];
199
- };
200
- attrs?: {
201
- leftDelimiter?: string;
202
- rightDelimiter?: string;
203
- allowedAttributes?: string[];
204
- };
205
- toc?: any;
206
- externalLinks?: Record<string, string>;
207
- }
208
-
209
- export declare interface MarkdownParsedData {
210
- hoistedTags?: string[];
211
- links?: string[];
212
- headers?: Header[];
213
- }
214
-
215
- export declare interface MarkdownRenderer extends MarkdownIt {
216
- __path: string;
217
- __relativePath: string;
218
- __data: MarkdownParsedData;
219
- }
220
-
221
- export declare type RawConfigExports<ThemeConfig = any> = UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>> | (() => UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>>);
222
-
223
- export declare function resolveConfig(root?: string, command?: 'serve' | 'build', mode?: string): Promise<SiteConfig>;
224
-
225
- export declare function resolveSiteData(root: string, userConfig?: UserConfig, command?: 'serve' | 'build', mode?: string): Promise<SiteData>;
226
-
227
- export declare function resolveSiteDataByRoute(siteData: SiteData, route: string): SiteData;
228
-
229
- export declare function serve(options?: ServeOptions): Promise<void>;
230
-
231
- export declare interface ServeOptions {
232
- root?: string;
233
- port?: number;
234
- }
235
-
236
- export declare interface SiteConfig<ThemeConfig = any> extends Pick<UserConfig, 'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa'> {
237
- root: string;
238
- srcDir: string;
239
- site: SiteData<ThemeConfig>;
240
- configPath: string | undefined;
241
- themeDir: string;
242
- outDir: string;
243
- tempDir: string;
244
- alias: AliasOptions;
245
- pages: string[];
246
- }
247
-
248
- export declare interface SiteData<ThemeConfig = any> {
249
- base: string
250
- /**
251
- * Language of the site as it should be set on the `html` element.
252
- * @example `en-US`, `zh-CN`
253
- */
254
- lang: string
255
- title: string
256
- description: string
257
- head: HeadConfig[]
258
- themeConfig: ThemeConfig
259
- scrollOffset: number | string
260
- locales: Record<string, LocaleConfig>
261
- /**
262
- * Available locales for the site when it has defined `locales` in its
263
- * `themeConfig`. This object is otherwise empty. Keys are paths like `/` or
264
- * `/zh/`.
265
- */
266
- langs: Record<
267
- string,
268
- {
269
- /**
270
- * Lang attribute as set on the `<html>` element.
271
- * @example `en-US`, `zh-CN`
272
- */
273
- lang: string
274
- /**
275
- * Label to display in the language menu.
276
- * @example `English`, `简体中文`
277
- */
278
- label: string
279
- }
280
- >
281
- }
282
-
283
- export declare interface UserConfig<ThemeConfig = any> {
284
- extends?: RawConfigExports<ThemeConfig>;
285
- lang?: string;
286
- base?: string;
287
- title?: string;
288
- description?: string;
289
- head?: HeadConfig[];
290
- themeConfig?: ThemeConfig;
291
- locales?: Record<string, LocaleConfig>;
292
- markdown?: MarkdownOptions;
293
- /**
294
- * Options to pass on to `@vitejs/plugin-vue`
295
- */
296
- vue?: Options;
297
- /**
298
- * Vite config
299
- */
300
- vite?: UserConfig_2;
301
- srcDir?: string;
302
- srcExclude?: string[];
303
- outDir?: string;
304
- shouldPreload?: (link: string, page: string) => boolean;
305
- /**
306
- * Configure the scroll offset when the theme has a sticky header.
307
- * Can be a number or a selector element to get the offset from.
308
- */
309
- scrollOffset?: number | string;
310
- /**
311
- * Enable MPA / zero-JS mode
312
- * @experimental
313
- */
314
- mpa?: boolean;
315
- }
316
-
317
- export { }