vitepress 0.17.2 → 0.19.0

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 (107) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +2 -6
  3. package/dist/client/app/router.js +2 -0
  4. package/dist/client/index.d.ts +127 -9
  5. package/dist/node/cli.js +289 -34
  6. package/dist/node/index.d.ts +138 -4
  7. package/dist/node/index.js +33 -17
  8. package/dist/node/serve-dbc4b971.js +47774 -0
  9. package/package.json +39 -28
  10. package/types/shared.d.ts +1 -1
  11. package/dist/client/app/components/ClientOnly.d.ts +0 -3
  12. package/dist/client/app/components/Content.d.ts +0 -3
  13. package/dist/client/app/composables/head.d.ts +0 -4
  14. package/dist/client/app/composables/preFetch.d.ts +0 -1
  15. package/dist/client/app/data.d.ts +0 -18
  16. package/dist/client/app/index.d.ts +0 -6
  17. package/dist/client/app/router.d.ts +0 -20
  18. package/dist/client/app/theme.d.ts +0 -13
  19. package/dist/client/app/utils.d.ts +0 -11
  20. package/dist/client/shared.d.ts +0 -12
  21. package/dist/client/theme-default/components/SideBarLink.d.ts +0 -6
  22. package/dist/client/theme-default/composables/activeSidebarLink.d.ts +0 -1
  23. package/dist/client/theme-default/composables/editLink.d.ts +0 -4
  24. package/dist/client/theme-default/composables/nav.d.ts +0 -2
  25. package/dist/client/theme-default/composables/navLink.d.ts +0 -15
  26. package/dist/client/theme-default/composables/nextAndPrevLinks.d.ts +0 -5
  27. package/dist/client/theme-default/composables/repo.d.ts +0 -5
  28. package/dist/client/theme-default/composables/sideBar.d.ts +0 -2
  29. package/dist/client/theme-default/config.d.ts +0 -112
  30. package/dist/client/theme-default/index.d.ts +0 -8
  31. package/dist/client/theme-default/support/sideBar.d.ts +0 -18
  32. package/dist/client/theme-default/utils.d.ts +0 -25
  33. package/dist/node/alias.d.ts +0 -8
  34. package/dist/node/alias.js +0 -50
  35. package/dist/node/alias.js.map +0 -1
  36. package/dist/node/build/build.d.ts +0 -2
  37. package/dist/node/build/build.js +0 -48
  38. package/dist/node/build/build.js.map +0 -1
  39. package/dist/node/build/bundle.d.ts +0 -6
  40. package/dist/node/build/bundle.js +0 -97
  41. package/dist/node/build/bundle.js.map +0 -1
  42. package/dist/node/build/render.d.ts +0 -4
  43. package/dist/node/build/render.js +0 -128
  44. package/dist/node/build/render.js.map +0 -1
  45. package/dist/node/cli.d.ts +0 -1
  46. package/dist/node/cli.js.map +0 -1
  47. package/dist/node/config.d.ts +0 -52
  48. package/dist/node/config.js +0 -119
  49. package/dist/node/config.js.map +0 -1
  50. package/dist/node/index.js.map +0 -1
  51. package/dist/node/markdown/markdown.d.ts +0 -25
  52. package/dist/node/markdown/markdown.js +0 -78
  53. package/dist/node/markdown/markdown.js.map +0 -1
  54. package/dist/node/markdown/plugins/component.d.ts +0 -2
  55. package/dist/node/markdown/plugins/component.js +0 -83
  56. package/dist/node/markdown/plugins/component.js.map +0 -1
  57. package/dist/node/markdown/plugins/containers.d.ts +0 -2
  58. package/dist/node/markdown/plugins/containers.js +0 -34
  59. package/dist/node/markdown/plugins/containers.js.map +0 -1
  60. package/dist/node/markdown/plugins/header.d.ts +0 -2
  61. package/dist/node/markdown/plugins/header.js +0 -25
  62. package/dist/node/markdown/plugins/header.js.map +0 -1
  63. package/dist/node/markdown/plugins/highlight.d.ts +0 -1
  64. package/dist/node/markdown/plugins/highlight.js +0 -49
  65. package/dist/node/markdown/plugins/highlight.js.map +0 -1
  66. package/dist/node/markdown/plugins/highlightLines.d.ts +0 -2
  67. package/dist/node/markdown/plugins/highlightLines.js +0 -46
  68. package/dist/node/markdown/plugins/highlightLines.js.map +0 -1
  69. package/dist/node/markdown/plugins/hoist.d.ts +0 -2
  70. package/dist/node/markdown/plugins/hoist.js +0 -22
  71. package/dist/node/markdown/plugins/hoist.js.map +0 -1
  72. package/dist/node/markdown/plugins/lineNumbers.d.ts +0 -2
  73. package/dist/node/markdown/plugins/lineNumbers.js +0 -23
  74. package/dist/node/markdown/plugins/lineNumbers.js.map +0 -1
  75. package/dist/node/markdown/plugins/link.d.ts +0 -2
  76. package/dist/node/markdown/plugins/link.js +0 -66
  77. package/dist/node/markdown/plugins/link.js.map +0 -1
  78. package/dist/node/markdown/plugins/preWrapper.d.ts +0 -2
  79. package/dist/node/markdown/plugins/preWrapper.js +0 -22
  80. package/dist/node/markdown/plugins/preWrapper.js.map +0 -1
  81. package/dist/node/markdown/plugins/slugify.d.ts +0 -1
  82. package/dist/node/markdown/plugins/slugify.js +0 -26
  83. package/dist/node/markdown/plugins/slugify.js.map +0 -1
  84. package/dist/node/markdown/plugins/snippet.d.ts +0 -2
  85. package/dist/node/markdown/plugins/snippet.js +0 -146
  86. package/dist/node/markdown/plugins/snippet.js.map +0 -1
  87. package/dist/node/markdownToVue.d.ts +0 -9
  88. package/dist/node/markdownToVue.js +0 -145
  89. package/dist/node/markdownToVue.js.map +0 -1
  90. package/dist/node/plugin.d.ts +0 -3
  91. package/dist/node/plugin.js +0 -199
  92. package/dist/node/plugin.js.map +0 -1
  93. package/dist/node/serve/serve.d.ts +0 -5
  94. package/dist/node/serve/serve.js +0 -36
  95. package/dist/node/serve/serve.js.map +0 -1
  96. package/dist/node/server.d.ts +0 -2
  97. package/dist/node/server.js +0 -18
  98. package/dist/node/server.js.map +0 -1
  99. package/dist/node/shared.d.ts +0 -12
  100. package/dist/node/shared.js +0 -70
  101. package/dist/node/shared.js.map +0 -1
  102. package/dist/node/utils/parseHeader.d.ts +0 -3
  103. package/dist/node/utils/parseHeader.js +0 -53
  104. package/dist/node/utils/parseHeader.js.map +0 -1
  105. package/dist/node/utils/slash.d.ts +0 -1
  106. package/dist/node/utils/slash.js +0 -8
  107. package/dist/node/utils/slash.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress",
3
- "version": "0.17.2",
3
+ "version": "0.19.0",
4
4
  "description": "Vite & Vue powered static site generator",
5
5
  "main": "dist/node/index.js",
6
6
  "typings": "types/index.d.ts",
@@ -9,7 +9,6 @@
9
9
  },
10
10
  "files": [
11
11
  "bin",
12
- "lib",
13
12
  "dist",
14
13
  "types"
15
14
  ],
@@ -20,7 +19,13 @@
20
19
  "dev-node": "tsc -w -p src/node",
21
20
  "dev-shared": "node scripts/copyShared",
22
21
  "dev-watch": "node scripts/watchAndCopy",
23
- "build": "rimraf -rf dist && node scripts/copyShared && tsc -p src/client && tsc -p src/node && node scripts/copyClient",
22
+ "prebuild": "rimraf -rf dist && node scripts/copyShared",
23
+ "build": "run-s build-client build-node build-types",
24
+ "build-client": "tsc -p src/client && node scripts/copyClient",
25
+ "build-node": "rollup -c scripts/rollup.config.js",
26
+ "build-types": "run-s build-types-client build-types-node",
27
+ "build-types-client": "tsc -p src/client --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.client.json && rimraf dist/temp",
28
+ "build-types-node": "tsc -p src/node --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.node.json && rimraf dist/temp",
24
29
  "lint": "yarn lint:js && yarn lint:ts",
25
30
  "lint:js": "prettier --check --write \"{bin,docs,scripts,src}/**/*.js\"",
26
31
  "lint:ts": "prettier --check --write --parser typescript \"{__tests__,src,docs,types}/**/*.ts\"",
@@ -65,52 +70,58 @@
65
70
  "dependencies": {
66
71
  "@docsearch/css": "^1.0.0-alpha.28",
67
72
  "@docsearch/js": "^1.0.0-alpha.28",
68
- "@types/markdown-it": "^12.0.1",
69
- "@vitejs/plugin-vue": "^1.4.0",
70
- "@vue/compiler-sfc": "^3.2.7",
71
- "@vue/server-renderer": "^3.2.7",
72
- "chalk": "^4.1.1",
73
- "compression": "^1.7.4",
74
- "debug": "^4.3.2",
75
- "diacritics": "^1.3.0",
76
- "escape-html": "^1.0.3",
77
- "fs-extra": "^10.0.0",
78
- "globby": "^11.0.3",
79
- "gray-matter": "^4.0.3",
80
- "lru-cache": "^6.0.0",
81
- "markdown-it": "^12.0.6",
82
- "markdown-it-anchor": "^8.1.2",
83
- "markdown-it-container": "^3.0.0",
84
- "markdown-it-emoji": "^2.0.0",
85
- "markdown-it-table-of-contents": "^0.5.2",
86
- "minimist": "^1.2.5",
87
- "ora": "^5.4.0",
88
- "polka": "^0.5.2",
89
- "prismjs": "^1.23.0",
90
- "sirv": "^1.0.12",
73
+ "@vitejs/plugin-vue": "^1.9.0",
91
74
  "vite": "^2.5.0",
92
- "vue": "^3.2.7"
75
+ "vue": "^3.2.13"
93
76
  },
94
77
  "devDependencies": {
78
+ "@microsoft/api-extractor": "^7.18.9",
79
+ "@rollup/plugin-alias": "^3.1.5",
80
+ "@rollup/plugin-commonjs": "^20.0.0",
81
+ "@rollup/plugin-json": "^4.1.0",
82
+ "@rollup/plugin-node-resolve": "^13.0.4",
95
83
  "@types/compression": "^1.7.0",
96
84
  "@types/fs-extra": "^9.0.11",
97
85
  "@types/jest": "^26.0.23",
86
+ "@types/markdown-it": "^12.0.1",
98
87
  "@types/koa": "^2.13.1",
99
88
  "@types/koa-static": "^4.0.1",
100
89
  "@types/lru-cache": "^5.1.0",
101
90
  "@types/node": "^15.6.1",
102
91
  "@types/postcss-load-config": "^3.0.1",
92
+ "chalk": "^4.1.1",
103
93
  "chokidar": "^3.5.1",
94
+ "compression": "^1.7.4",
104
95
  "conventional-changelog-cli": "^2.1.1",
96
+ "debug": "^4.3.2",
97
+ "diacritics": "^1.3.0",
105
98
  "enquirer": "^2.3.6",
99
+ "esbuild": "^0.12.28",
100
+ "escape-html": "^1.0.3",
106
101
  "execa": "^5.0.0",
102
+ "fs-extra": "^10.0.0",
103
+ "globby": "^11.0.3",
104
+ "gray-matter": "^4.0.3",
107
105
  "jest": "^27.0.1",
108
106
  "lint-staged": "^11.0.0",
107
+ "lru-cache": "^6.0.0",
108
+ "markdown-it": "^12.0.6",
109
+ "markdown-it-anchor": "^8.1.2",
110
+ "markdown-it-attrs": "^4.0.0",
111
+ "markdown-it-container": "^3.0.0",
112
+ "markdown-it-emoji": "^2.0.0",
113
+ "markdown-it-table-of-contents": "^0.5.2",
114
+ "minimist": "^1.2.5",
109
115
  "npm-run-all": "^4.1.5",
116
+ "ora": "^5.4.0",
117
+ "polka": "^0.5.2",
110
118
  "prettier": "^2.3.0",
119
+ "prismjs": "^1.23.0",
111
120
  "rimraf": "^3.0.2",
112
- "rollup": "^2.38.5",
121
+ "rollup": "^2.56.3",
122
+ "rollup-plugin-esbuild": "^4.5.0",
113
123
  "semver": "^7.3.5",
124
+ "sirv": "^1.0.12",
114
125
  "ts-jest": "^27.0.1",
115
126
  "typescript": "^4.3.2",
116
127
  "yorkie": "^2.0.0"
package/types/shared.d.ts CHANGED
@@ -36,7 +36,7 @@ export interface SiteData<ThemeConfig = any> {
36
36
  lang: string
37
37
  /**
38
38
  * Label to display in the language menu.
39
- * @example `English', `简体中文`
39
+ * @example `English`, `简体中文`
40
40
  */
41
41
  label: string
42
42
  }
@@ -1,3 +0,0 @@
1
- export declare const ClientOnly: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
- [key: string]: any;
3
- }>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{} & {} & {}> & ({} | {}), {}>;
@@ -1,3 +0,0 @@
1
- export declare const Content: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
- [key: string]: any;
3
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{} & {} & {}> & ({} | {}), {}>;
@@ -1,4 +0,0 @@
1
- import { Ref } from 'vue';
2
- import { SiteData } from '../../shared';
3
- import { Route } from '../router';
4
- export declare function useUpdateHead(route: Route, siteDataByRouteRef: Ref<SiteData>): void;
@@ -1 +0,0 @@
1
- export declare function usePrefetch(): void;
@@ -1,18 +0,0 @@
1
- import { InjectionKey, Ref } from 'vue';
2
- import { Route } from './router';
3
- import { PageData, SiteData } from '../shared';
4
- export declare const dataSymbol: InjectionKey<VitePressData>;
5
- export interface VitePressData<T = any> {
6
- site: Ref<SiteData<T>>;
7
- page: Ref<PageData>;
8
- theme: Ref<T>;
9
- frontmatter: Ref<PageData['frontmatter']>;
10
- title: Ref<string>;
11
- description: Ref<string>;
12
- lang: Ref<string>;
13
- localePath: Ref<string>;
14
- }
15
- export declare type SiteDataRef<T = any> = Ref<SiteData<T>>;
16
- export declare const siteDataRef: Ref<SiteData>;
17
- export declare function initData(route: Route): VitePressData;
18
- export declare function useData<T = any>(): VitePressData<T>;
@@ -1,6 +0,0 @@
1
- import { App } from 'vue';
2
- import { Router } from './router';
3
- export declare function createApp(): {
4
- app: App<any>;
5
- router: Router;
6
- };
@@ -1,20 +0,0 @@
1
- import type { Component, InjectionKey } from 'vue';
2
- import { PageData } from '../shared';
3
- export interface Route {
4
- path: string;
5
- data: PageData;
6
- component: Component | null;
7
- }
8
- export interface Router {
9
- route: Route;
10
- go: (href?: string) => Promise<void>;
11
- }
12
- export declare const RouterSymbol: InjectionKey<Router>;
13
- interface PageModule {
14
- __pageData: string;
15
- default: Component;
16
- }
17
- export declare function createRouter(loadPageModule: (path: string) => PageModule | Promise<PageModule>, fallbackComponent?: Component): Router;
18
- export declare function useRouter(): Router;
19
- export declare function useRoute(): Route;
20
- export {};
@@ -1,13 +0,0 @@
1
- import { App, Ref, Component } from 'vue';
2
- import { Router } from './router';
3
- import { SiteData } from '../shared';
4
- export interface EnhanceAppContext {
5
- app: App;
6
- router: Router;
7
- siteData: Ref<SiteData>;
8
- }
9
- export interface Theme {
10
- Layout: Component;
11
- NotFound?: Component;
12
- enhanceApp?: (ctx: EnhanceAppContext) => void;
13
- }
@@ -1,11 +0,0 @@
1
- import { inBrowser } from '../shared';
2
- export { inBrowser };
3
- /**
4
- * Join two paths by resolving the slash collision.
5
- */
6
- export declare function joinPath(base: string, path: string): string;
7
- export declare function withBase(path: string): string;
8
- /**
9
- * Converts a url path to the corresponding js chunk filename.
10
- */
11
- export declare function pathToFile(path: string): string;
@@ -1,12 +0,0 @@
1
- import { LocaleConfig, SiteData } from '../../types/shared';
2
- export type { SiteData, PageData, HeadConfig, LocaleConfig, Header } from '../../types/shared';
3
- export declare const EXTERNAL_URL_RE: RegExp;
4
- export declare const inBrowser: boolean;
5
- export declare function createLangDictionary(siteData: {
6
- themeConfig?: Record<string, any>;
7
- locales?: Record<string, LocaleConfig>;
8
- }): Record<string, {
9
- lang: string;
10
- label: string;
11
- }>;
12
- export declare function resolveSiteDataByRoute(siteData: SiteData, route: string): SiteData;
@@ -1,6 +0,0 @@
1
- import { FunctionalComponent } from 'vue';
2
- import { DefaultTheme } from '../config';
3
- export declare const SideBarLink: FunctionalComponent<{
4
- item: DefaultTheme.SideBarItem;
5
- depth?: number;
6
- }>;
@@ -1 +0,0 @@
1
- export declare function useActiveSidebarLinks(): void;
@@ -1,4 +0,0 @@
1
- export declare function useEditLink(): {
2
- url: import("vue").ComputedRef<string | null>;
3
- text: import("vue").ComputedRef<any>;
4
- };
@@ -1,2 +0,0 @@
1
- import type { DefaultTheme } from '../config';
2
- export declare function useLanguageLinks(): import("vue").ComputedRef<DefaultTheme.NavItemWithChildren | null>;
@@ -1,15 +0,0 @@
1
- import { Ref } from 'vue';
2
- import type { DefaultTheme } from '../config';
3
- export declare function useNavLink(item: Ref<DefaultTheme.NavItemWithLink>): {
4
- props: import("vue").ComputedRef<{
5
- class: {
6
- active: boolean;
7
- isExternal: boolean;
8
- };
9
- href: string;
10
- target: string | null;
11
- rel: string | null;
12
- 'aria-label': string | undefined;
13
- }>;
14
- isExternal: boolean;
15
- };
@@ -1,5 +0,0 @@
1
- export declare function useNextAndPrevLinks(): {
2
- next: import("vue").ComputedRef<import("../config").DefaultTheme.SideBarLink | undefined>;
3
- prev: import("vue").ComputedRef<import("../config").DefaultTheme.SideBarLink | undefined>;
4
- hasLinks: import("vue").ComputedRef<boolean>;
5
- };
@@ -1,5 +0,0 @@
1
- export declare const platforms: (readonly [string, RegExp])[];
2
- export declare function useRepo(): import("vue").ComputedRef<{
3
- text: string;
4
- link: string;
5
- } | null>;
@@ -1,2 +0,0 @@
1
- import { DefaultTheme } from '../config';
2
- export declare function useSideBar(): import("vue").ComputedRef<DefaultTheme.SideBarItem[]>;
@@ -1,112 +0,0 @@
1
- export declare namespace DefaultTheme {
2
- interface Config {
3
- logo?: string;
4
- nav?: NavItem[] | false;
5
- sidebar?: SideBarConfig | MultiSideBarConfig;
6
- /**
7
- * GitHub repository following the format <user>/<project>.
8
- *
9
- * @example `"vuejs/vue-next"`
10
- */
11
- repo?: string;
12
- /**
13
- * Customize the header label. Defaults to GitHub/Gitlab/Bitbucket
14
- * depending on the provided repo.
15
- *
16
- * @example `"Contribute!"`
17
- */
18
- repoLabel?: string;
19
- /**
20
- * If your docs are in a different repository from your main project.
21
- *
22
- * @example `"vuejs/docs-next"`
23
- */
24
- docsRepo?: string;
25
- /**
26
- * If your docs are not at the root of the repo.
27
- *
28
- * @example `"docs"`
29
- */
30
- docsDir?: string;
31
- /**
32
- * If your docs are in a different branch. Defaults to `master`.
33
- *
34
- * @example `"next"`
35
- */
36
- docsBranch?: string;
37
- /**
38
- * Enable links to edit pages at the bottom of the page.
39
- */
40
- editLinks?: boolean;
41
- /**
42
- * Custom text for edit link. Defaults to "Edit this page".
43
- */
44
- editLinkText?: string;
45
- /**
46
- * Show last updated time at the bottom of the page. Defaults to `false`.
47
- * If given a string, it will be displayed as a prefix (default value:
48
- * "Last Updated").
49
- */
50
- lastUpdated?: string | boolean;
51
- prevLinks?: boolean;
52
- nextLinks?: boolean;
53
- locales?: Record<string, LocaleConfig & Omit<Config, 'locales'>>;
54
- algolia?: AlgoliaSearchOptions;
55
- carbonAds?: {
56
- carbon: string;
57
- custom?: string;
58
- placement: string;
59
- };
60
- }
61
- type NavItem = NavItemWithLink | NavItemWithChildren;
62
- interface NavItemBase {
63
- text: string;
64
- target?: string;
65
- rel?: string;
66
- ariaLabel?: string;
67
- activeMatch?: string;
68
- }
69
- interface NavItemWithLink extends NavItemBase {
70
- link: string;
71
- }
72
- interface NavItemWithChildren extends NavItemBase {
73
- items: NavItemWithLink[];
74
- }
75
- type SideBarConfig = SideBarItem[] | 'auto' | false;
76
- interface MultiSideBarConfig {
77
- [path: string]: SideBarConfig;
78
- }
79
- type SideBarItem = SideBarLink | SideBarGroup;
80
- interface SideBarLink {
81
- text: string;
82
- link: string;
83
- }
84
- interface SideBarGroup {
85
- text: string;
86
- link?: string;
87
- /**
88
- * @default false
89
- */
90
- collapsable?: boolean;
91
- children: SideBarItem[];
92
- }
93
- interface AlgoliaSearchOptions {
94
- appId?: string;
95
- apiKey: string;
96
- indexName: string;
97
- placeholder?: string;
98
- searchParameters?: any;
99
- disableUserPersonalization?: boolean;
100
- initialQuery?: string;
101
- }
102
- interface LocaleConfig {
103
- /**
104
- * Text for the language dropdown.
105
- */
106
- selectText?: string;
107
- /**
108
- * Label for this locale in the language dropdown.
109
- */
110
- label?: string;
111
- }
112
- }
@@ -1,8 +0,0 @@
1
- import './styles/vars.css';
2
- import './styles/layout.css';
3
- import './styles/code.css';
4
- import './styles/custom-blocks.css';
5
- import './styles/sidebar-links.css';
6
- import { Theme } from 'vitepress';
7
- declare const theme: Theme;
8
- export default theme;
@@ -1,18 +0,0 @@
1
- import { DefaultTheme } from '../config';
2
- export declare function isSideBarConfig(sidebar: DefaultTheme.SideBarConfig | DefaultTheme.MultiSideBarConfig): sidebar is DefaultTheme.SideBarConfig;
3
- export declare function isSideBarGroup(item: DefaultTheme.SideBarItem): item is DefaultTheme.SideBarGroup;
4
- export declare function isSideBarEmpty(sidebar?: DefaultTheme.SideBarConfig): boolean;
5
- /**
6
- * Get the `SideBarConfig` from sidebar option. This method will ensure to get
7
- * correct sidebar config from `MultiSideBarConfig` with various path
8
- * combinations such as matching `guide/` and `/guide/`. If no matching config
9
- * was found, it will return `auto` as a fallback.
10
- */
11
- export declare function getSideBarConfig(sidebar: DefaultTheme.SideBarConfig | DefaultTheme.MultiSideBarConfig, path: string): DefaultTheme.SideBarConfig;
12
- /**
13
- * Get flat sidebar links from the sidebar items. This method is useful for
14
- * creating the "next and prev link" feature. It will ignore any items that
15
- * don't have `link` property and removes `.md` or `.html` extension if a
16
- * link contains it.
17
- */
18
- export declare function getFlatSideBarLinks(sidebar: DefaultTheme.SideBarItem[]): DefaultTheme.SideBarLink[];
@@ -1,25 +0,0 @@
1
- import { Route } from 'vitepress';
2
- export declare const hashRE: RegExp;
3
- export declare const extRE: RegExp;
4
- export declare const endingSlashRE: RegExp;
5
- export declare const outboundRE: RegExp;
6
- export declare function isNullish(value: any): value is null | undefined;
7
- export declare function isArray(value: any): value is any[];
8
- export declare function isExternal(path: string): boolean;
9
- export declare function isActive(route: Route, path?: string): boolean;
10
- export declare function normalize(path: string): string;
11
- export declare function joinUrl(base: string, path: string): string;
12
- /**
13
- * get the path without filename (the last segment). for example, if the given
14
- * path is `/guide/getting-started.html`, this method will return `/guide/`.
15
- * Always with a trailing slash.
16
- */
17
- export declare function getPathDirName(path: string): string;
18
- export declare function ensureSlash(path: string): string;
19
- export declare function ensureStartingSlash(path: string): string;
20
- export declare function ensureEndingSlash(path: string): string;
21
- /**
22
- * Remove `.md` or `.html` extention from the given path. It also converts
23
- * `index` to slush.
24
- */
25
- export declare function removeExtention(path: string): string;
@@ -1,8 +0,0 @@
1
- import { AliasOptions } from 'vite';
2
- export declare const DIST_CLIENT_PATH: string;
3
- export declare const APP_PATH: string;
4
- export declare const SHARED_PATH: string;
5
- export declare const DEFAULT_THEME_PATH: string;
6
- export declare const SITE_DATA_ID = "@siteData";
7
- export declare const SITE_DATA_REQUEST_PATH: string;
8
- export declare function resolveAliases(themeDir: string): AliasOptions;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveAliases = exports.SITE_DATA_REQUEST_PATH = exports.SITE_DATA_ID = exports.DEFAULT_THEME_PATH = exports.SHARED_PATH = exports.APP_PATH = exports.DIST_CLIENT_PATH = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const PKG_ROOT = path_1.default.join(__dirname, '../../');
9
- exports.DIST_CLIENT_PATH = path_1.default.join(__dirname, '../client');
10
- exports.APP_PATH = path_1.default.join(exports.DIST_CLIENT_PATH, 'app');
11
- exports.SHARED_PATH = path_1.default.join(exports.DIST_CLIENT_PATH, 'shared');
12
- exports.DEFAULT_THEME_PATH = path_1.default.join(exports.DIST_CLIENT_PATH, 'theme-default');
13
- // special virtual file
14
- // we can't directly import '/@siteData' because
15
- // - it's not an actual file so we can't use tsconfig paths to redirect it
16
- // - TS doesn't allow shimming a module that starts with '/'
17
- exports.SITE_DATA_ID = '@siteData';
18
- exports.SITE_DATA_REQUEST_PATH = '/' + exports.SITE_DATA_ID;
19
- function resolveAliases(themeDir) {
20
- const paths = {
21
- '/@theme': themeDir,
22
- '/@shared': exports.SHARED_PATH,
23
- [exports.SITE_DATA_ID]: exports.SITE_DATA_REQUEST_PATH
24
- };
25
- const aliases = [
26
- ...Object.keys(paths).map((p) => ({
27
- find: p,
28
- replacement: paths[p]
29
- })),
30
- {
31
- find: /^vitepress$/,
32
- replacement: path_1.default.join(__dirname, '../client/index')
33
- },
34
- {
35
- find: /^vitepress\/theme$/,
36
- replacement: path_1.default.join(__dirname, '../client/theme-default/index')
37
- },
38
- // alias for local linked development
39
- { find: /^vitepress\//, replacement: PKG_ROOT + '/' },
40
- // make sure it always use the same vue dependency that comes with
41
- // vitepress itself
42
- {
43
- find: /^vue$/,
44
- replacement: require.resolve('@vue/runtime-dom/dist/runtime-dom.esm-bundler.js')
45
- }
46
- ];
47
- return aliases;
48
- }
49
- exports.resolveAliases = resolveAliases;
50
- //# sourceMappingURL=alias.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alias.js","sourceRoot":"","sources":["../../src/node/alias.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAGvB,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AAClC,QAAA,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AACpD,QAAA,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,wBAAgB,EAAE,KAAK,CAAC,CAAA;AAC7C,QAAA,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,wBAAgB,EAAE,QAAQ,CAAC,CAAA;AACnD,QAAA,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,wBAAgB,EAAE,eAAe,CAAC,CAAA;AAE9E,uBAAuB;AACvB,gDAAgD;AAChD,0EAA0E;AAC1E,4DAA4D;AAC/C,QAAA,YAAY,GAAG,WAAW,CAAA;AAC1B,QAAA,sBAAsB,GAAG,GAAG,GAAG,oBAAY,CAAA;AAExD,SAAgB,cAAc,CAAC,QAAgB;IAC7C,MAAM,KAAK,GAA2B;QACpC,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,mBAAW;QACvB,CAAC,oBAAY,CAAC,EAAE,8BAAsB;KACvC,CAAA;IAED,MAAM,OAAO,GAAY;QACvB,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChC,IAAI,EAAE,CAAC;YACP,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;SACtB,CAAC,CAAC;QACH;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC;SACrD;QACD;YACE,IAAI,EAAE,oBAAoB;YAC1B,WAAW,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,+BAA+B,CAAC;SACnE;QACD,qCAAqC;QACrC,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,GAAG,GAAG,EAAE;QACrD,kEAAkE;QAClE,mBAAmB;QACnB;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,OAAO,CAAC,OAAO,CAC1B,kDAAkD,CACnD;SACF;KACF,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAjCD,wCAiCC"}
@@ -1,2 +0,0 @@
1
- import { BuildOptions } from 'vite';
2
- export declare function build(root: string, buildOptions?: BuildOptions): Promise<void>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.build = void 0;
7
- const fs_extra_1 = __importDefault(require("fs-extra"));
8
- const bundle_1 = require("./bundle");
9
- const config_1 = require("../config");
10
- const render_1 = require("./render");
11
- const ora_1 = __importDefault(require("ora"));
12
- async function build(root, buildOptions = {}) {
13
- const start = Date.now();
14
- process.env.NODE_ENV = 'production';
15
- const siteConfig = await config_1.resolveConfig(root);
16
- try {
17
- const [clientResult, , pageToHashMap] = await bundle_1.bundle(siteConfig, buildOptions);
18
- const spinner = ora_1.default();
19
- spinner.start('rendering pages...');
20
- try {
21
- const appChunk = clientResult.output.find((chunk) => chunk.type === 'chunk' && chunk.isEntry);
22
- const cssChunk = clientResult.output.find((chunk) => chunk.type === 'asset' && chunk.fileName.endsWith('.css'));
23
- // We embed the hash map string into each page directly so that it doesn't
24
- // alter the main chunk's hash on every build. It's also embedded as a
25
- // string and JSON.parsed from the client because it's faster than embedding
26
- // as JS object literal.
27
- const hashMapString = JSON.stringify(JSON.stringify(pageToHashMap));
28
- for (const page of siteConfig.pages) {
29
- await render_1.renderPage(siteConfig, page, clientResult, appChunk, cssChunk, pageToHashMap, hashMapString);
30
- }
31
- }
32
- catch (e) {
33
- spinner.stopAndPersist({
34
- symbol: bundle_1.failMark
35
- });
36
- throw e;
37
- }
38
- spinner.stopAndPersist({
39
- symbol: bundle_1.okMark
40
- });
41
- }
42
- finally {
43
- await fs_extra_1.default.remove(siteConfig.tempDir);
44
- }
45
- console.log(`build complete in ${((Date.now() - start) / 1000).toFixed(2)}s.`);
46
- }
47
- exports.build = build;
48
- //# sourceMappingURL=build.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/node/build/build.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAyB;AACzB,qCAAmD;AAEnD,sCAAyC;AACzC,qCAAqC;AAErC,8CAAqB;AAEd,KAAK,UAAU,KAAK,CAAC,IAAY,EAAE,eAA6B,EAAE;IACvE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAExB,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAA;IACnC,MAAM,UAAU,GAAG,MAAM,sBAAa,CAAC,IAAI,CAAC,CAAA;IAE5C,IAAI;QACF,MAAM,CAAC,YAAY,EAAE,AAAD,EAAG,aAAa,CAAC,GAAG,MAAM,eAAM,CAClD,UAAU,EACV,YAAY,CACb,CAAA;QAED,MAAM,OAAO,GAAG,aAAG,EAAE,CAAA;QACrB,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAEnC,IAAI;YACF,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CACvC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CACpC,CAAA;YAEhB,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CACvC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CACtD,CAAA;YAEhB,0EAA0E;YAC1E,sEAAsE;YACtE,4EAA4E;YAC5E,wBAAwB;YACxB,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;YAEnE,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,EAAE;gBACnC,MAAM,mBAAU,CACd,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,aAAa,CACd,CAAA;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,cAAc,CAAC;gBACrB,MAAM,EAAE,iBAAQ;aACjB,CAAC,CAAA;YACF,MAAM,CAAC,CAAA;SACR;QACD,OAAO,CAAC,cAAc,CAAC;YACrB,MAAM,EAAE,eAAM;SACf,CAAC,CAAA;KACH;YAAS;QACR,MAAM,kBAAE,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;KACpC;IAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAChF,CAAC;AAvDD,sBAuDC"}
@@ -1,6 +0,0 @@
1
- import { SiteConfig } from '../config';
2
- import { RollupOutput } from 'rollup';
3
- import { BuildOptions } from 'vite';
4
- export declare const okMark = "\u001B[32m\u2713\u001B[0m";
5
- export declare const failMark = "\u001B[31m\u2716\u001B[0m";
6
- export declare function bundle(config: SiteConfig, options: BuildOptions): Promise<[RollupOutput, RollupOutput, Record<string, string>]>;