vitepress 0.22.2 → 1.0.0-draft.1
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 +4 -4
- package/client.d.ts +2 -3
- package/dist/client/app/components/ClientOnly.js +1 -1
- package/dist/client/app/index.js +5 -7
- package/dist/client/app/router.js +11 -5
- package/dist/client/theme-default/Layout.vue +25 -183
- package/dist/client/theme-default/NotFound.vue +9 -8
- package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +127 -0
- package/dist/client/theme-default/components/VPBackdrop.vue +39 -0
- package/dist/client/theme-default/components/VPContent.vue +44 -0
- package/dist/client/theme-default/components/VPContentDoc.vue +173 -0
- package/dist/client/theme-default/components/VPContentDocFooter.vue +140 -0
- package/dist/client/theme-default/components/VPContentDocOutline.vue +108 -0
- package/dist/client/theme-default/components/VPFlyout.vue +149 -0
- package/dist/client/theme-default/components/VPLink.vue +37 -0
- package/dist/client/theme-default/components/VPLocalNav.vue +106 -0
- package/dist/client/theme-default/components/VPMenu.vue +79 -0
- package/dist/client/theme-default/components/VPMenuGroup.vue +35 -0
- package/dist/client/theme-default/components/VPMenuLink.vue +30 -0
- package/dist/client/theme-default/components/VPNav.vue +33 -0
- package/dist/client/theme-default/components/VPNavBar.vue +109 -0
- package/dist/client/theme-default/components/VPNavBarAppearance.vue +22 -0
- package/dist/client/theme-default/components/VPNavBarExtra.vue +107 -0
- package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
- package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +18 -0
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +56 -0
- package/dist/client/theme-default/components/VPNavBarSearch.vue +269 -0
- package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPNavBarTitle.vue +44 -0
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +74 -0
- package/dist/client/theme-default/components/VPNavScreen.vue +100 -0
- package/dist/client/theme-default/components/VPNavScreenAppearance.vue +30 -0
- package/dist/client/theme-default/components/VPNavScreenMenu.vue +24 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +118 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +33 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +35 -0
- package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +34 -0
- package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
- package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
- package/dist/client/theme-default/components/VPSidebar.vue +118 -0
- package/dist/client/theme-default/components/VPSidebarGroup.vue +44 -0
- package/dist/client/theme-default/components/VPSidebarLink.vue +57 -0
- package/dist/client/theme-default/components/VPSkipLink.vue +72 -0
- package/dist/client/theme-default/components/VPSocialLink.vue +63 -0
- package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPSwitch.vue +66 -0
- package/dist/client/theme-default/components/VPSwitchAppearance.vue +74 -0
- package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
- package/dist/client/theme-default/components/icons/{ArrowLeft.vue → VPIconArrowLeft.vue} +0 -0
- package/dist/client/theme-default/components/icons/{ArrowRight.vue → VPIconArrowRight.vue} +0 -0
- package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconDiscord.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconExternalLink.vue +13 -0
- package/dist/client/theme-default/components/icons/VPIconFacebook.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconGitHub.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconInstagram.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
- package/dist/client/theme-default/components/icons/VPIconLinkedIn.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconSlack.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
- package/dist/client/theme-default/components/icons/VPIconTwitter.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconYouTube.vue +5 -0
- package/dist/client/theme-default/composables/edit-link.js +22 -0
- package/dist/client/theme-default/composables/flyout.js +40 -0
- package/dist/client/theme-default/composables/nav.js +27 -1
- package/dist/client/theme-default/composables/outline.js +130 -0
- package/dist/client/theme-default/composables/prev-next.js +18 -0
- package/dist/client/theme-default/composables/sidebar.js +57 -0
- package/dist/client/theme-default/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/index.js +4 -4
- package/dist/client/theme-default/styles/base.css +200 -0
- package/dist/client/theme-default/styles/fonts.css +67 -0
- package/dist/client/theme-default/styles/utils.css +9 -0
- package/dist/client/theme-default/styles/vars.css +206 -66
- package/dist/client/theme-default/styles/vp-doc.css +419 -0
- package/dist/client/theme-default/support/sidebar.js +29 -0
- package/dist/client/theme-default/support/utils.js +43 -0
- package/dist/node/cli.js +1 -1
- package/dist/node/index.d.ts +106 -81
- package/dist/node/index.js +1 -1
- package/dist/node/{serve-cf4b2162.js → serve-428d4610.js} +27 -10
- package/package.json +31 -27
- package/types/default-theme.d.ts +105 -80
- package/dist/client/theme-default/components/AlgoliaSearchBox.vue +0 -195
- package/dist/client/theme-default/components/BuySellAds.vue +0 -152
- package/dist/client/theme-default/components/CarbonAds.vue +0 -99
- package/dist/client/theme-default/components/EditLink.vue +0 -38
- package/dist/client/theme-default/components/Home.vue +0 -31
- package/dist/client/theme-default/components/HomeFeatures.vue +0 -143
- package/dist/client/theme-default/components/HomeFooter.vue +0 -50
- package/dist/client/theme-default/components/HomeHero.vue +0 -161
- package/dist/client/theme-default/components/LastUpdated.vue +0 -60
- package/dist/client/theme-default/components/NavBar.vue +0 -60
- package/dist/client/theme-default/components/NavBarTitle.vue +0 -41
- package/dist/client/theme-default/components/NavDropdownLink.vue +0 -135
- package/dist/client/theme-default/components/NavDropdownLinkItem.vue +0 -76
- package/dist/client/theme-default/components/NavLink.vue +0 -61
- package/dist/client/theme-default/components/NavLinks.vue +0 -52
- package/dist/client/theme-default/components/NextAndPrevLinks.vue +0 -88
- package/dist/client/theme-default/components/Page.vue +0 -53
- package/dist/client/theme-default/components/PageFooter.vue +0 -44
- package/dist/client/theme-default/components/SideBar.vue +0 -60
- package/dist/client/theme-default/components/SideBarLink.js +0 -68
- package/dist/client/theme-default/components/SideBarLinks.vue +0 -12
- package/dist/client/theme-default/components/ToggleSideBarButton.vue +0 -46
- package/dist/client/theme-default/components/icons/OutboundLink.vue +0 -31
- package/dist/client/theme-default/composables/activeSidebarLink.js +0 -99
- package/dist/client/theme-default/composables/editLink.js +0 -49
- package/dist/client/theme-default/composables/navLink.js +0 -42
- package/dist/client/theme-default/composables/nextAndPrevLinks.js +0 -37
- package/dist/client/theme-default/composables/repo.js +0 -38
- package/dist/client/theme-default/composables/sideBar.js +0 -57
- package/dist/client/theme-default/styles/code.css +0 -299
- package/dist/client/theme-default/styles/custom-blocks.css +0 -76
- package/dist/client/theme-default/styles/layout.css +0 -236
- package/dist/client/theme-default/styles/sidebar-links.css +0 -107
- package/dist/client/theme-default/support/sideBar.js +0 -46
- package/dist/client/theme-default/utils.js +0 -63
package/dist/node/index.d.ts
CHANGED
|
@@ -11,134 +11,165 @@ 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
|
|
14
|
+
export declare const createMarkdownRenderer: (srcDir: string, options: MarkdownOptions | undefined, base: string) => MarkdownRenderer;
|
|
15
15
|
|
|
16
16
|
export declare function createServer(root?: string, serverOptions?: ServerOptions): Promise<ViteDevServer>;
|
|
17
17
|
|
|
18
18
|
export declare namespace DefaultTheme {
|
|
19
19
|
export interface Config {
|
|
20
|
-
logo?: string
|
|
21
|
-
nav?: NavItem[] | false
|
|
22
|
-
sidebar?: SideBarConfig | MultiSideBarConfig
|
|
23
|
-
|
|
24
20
|
/**
|
|
25
|
-
*
|
|
21
|
+
* The logo file of the site.
|
|
26
22
|
*
|
|
27
|
-
* @example
|
|
23
|
+
* @example '/logo.svg'
|
|
28
24
|
*/
|
|
29
|
-
|
|
25
|
+
logo?: string
|
|
30
26
|
|
|
31
27
|
/**
|
|
32
|
-
*
|
|
33
|
-
* depending on the provided repo.
|
|
34
|
-
*
|
|
35
|
-
* @example `"Contribute!"`
|
|
28
|
+
* The nav items.
|
|
36
29
|
*/
|
|
37
|
-
|
|
30
|
+
nav?: NavItem[]
|
|
38
31
|
|
|
39
32
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @example `"vuejs/docs-next"`
|
|
33
|
+
* The sidebar items.
|
|
43
34
|
*/
|
|
44
|
-
|
|
35
|
+
sidebar?: Sidebar
|
|
45
36
|
|
|
46
37
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @example `"docs"`
|
|
38
|
+
* Info for the edit link. If it's undefined, the edit link feature will
|
|
39
|
+
* be disabled.
|
|
50
40
|
*/
|
|
51
|
-
|
|
41
|
+
editLink?: EditLink
|
|
52
42
|
|
|
53
43
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @example `"next"`
|
|
44
|
+
* The social links to be displayed at the end of the nav bar. Perfect for
|
|
45
|
+
* placing links to social services such as GitHub, Twitter, Facebook, etc.
|
|
57
46
|
*/
|
|
58
|
-
|
|
47
|
+
socialLinks?: SocialLink[]
|
|
59
48
|
|
|
60
49
|
/**
|
|
61
|
-
*
|
|
50
|
+
* Adds locale menu to the nav. This option should be used when you have
|
|
51
|
+
* your translated sites outside of the project.
|
|
62
52
|
*/
|
|
63
|
-
|
|
53
|
+
localeLinks?: LocaleLinks
|
|
64
54
|
|
|
65
55
|
/**
|
|
66
|
-
*
|
|
56
|
+
* The algolia options. Leave it undefined to disable the search feature.
|
|
67
57
|
*/
|
|
68
|
-
|
|
58
|
+
algolia?: AlgoliaSearchOptions
|
|
69
59
|
|
|
70
60
|
/**
|
|
71
|
-
*
|
|
72
|
-
* If given a string, it will be displayed as a prefix (default value:
|
|
73
|
-
* "Last Updated").
|
|
61
|
+
* The carbon ads options. Leave it undefined to disable the ads feature.
|
|
74
62
|
*/
|
|
75
|
-
|
|
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
|
-
}
|
|
63
|
+
carbonAds?: CarbonAdsOptions
|
|
89
64
|
}
|
|
90
65
|
|
|
91
|
-
//
|
|
66
|
+
// nav -----------------------------------------------------------------------
|
|
92
67
|
|
|
93
68
|
export type NavItem = NavItemWithLink | NavItemWithChildren
|
|
94
69
|
|
|
95
|
-
export
|
|
70
|
+
export type NavItemWithLink = {
|
|
96
71
|
text: string
|
|
97
|
-
target?: string
|
|
98
|
-
rel?: string
|
|
99
|
-
ariaLabel?: string
|
|
100
|
-
activeMatch?: string
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface NavItemWithLink extends NavItemBase {
|
|
104
72
|
link: string
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `activeMatch` is expected to be a regex string. We can't use actual
|
|
76
|
+
* RegExp object here because it isn't serializable
|
|
77
|
+
*/
|
|
78
|
+
activeMatch?: string
|
|
105
79
|
}
|
|
106
80
|
|
|
107
|
-
export interface NavItemWithChildren
|
|
81
|
+
export interface NavItemWithChildren {
|
|
82
|
+
text?: string
|
|
108
83
|
items: NavItemWithLink[]
|
|
109
84
|
}
|
|
110
85
|
|
|
111
86
|
// sidebar -------------------------------------------------------------------
|
|
112
87
|
|
|
113
|
-
export type
|
|
88
|
+
export type Sidebar = SidebarGroup[] | SidebarMulti
|
|
114
89
|
|
|
115
|
-
export interface
|
|
116
|
-
[path: string]:
|
|
90
|
+
export interface SidebarMulti {
|
|
91
|
+
[path: string]: SidebarGroup[]
|
|
117
92
|
}
|
|
118
93
|
|
|
119
|
-
export
|
|
94
|
+
export interface SidebarGroup {
|
|
95
|
+
text: string
|
|
96
|
+
items: SidebarItem[]
|
|
97
|
+
}
|
|
120
98
|
|
|
121
|
-
export interface
|
|
99
|
+
export interface SidebarItem {
|
|
122
100
|
text: string
|
|
123
101
|
link: string
|
|
124
102
|
}
|
|
125
103
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
104
|
+
// edit link -----------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
export interface EditLink {
|
|
107
|
+
/**
|
|
108
|
+
* Repo of the site.
|
|
109
|
+
*
|
|
110
|
+
* @example 'vuejs/docs'
|
|
111
|
+
*/
|
|
112
|
+
repo: string
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Branch of the repo.
|
|
116
|
+
*
|
|
117
|
+
* @default 'main'
|
|
118
|
+
*/
|
|
119
|
+
branch?: string
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* If your docs are not at the root of the repo.
|
|
123
|
+
*
|
|
124
|
+
* @example 'docs'
|
|
125
|
+
*/
|
|
126
|
+
dir?: string
|
|
129
127
|
|
|
130
128
|
/**
|
|
131
|
-
*
|
|
129
|
+
* Custom text for edit link.
|
|
130
|
+
*
|
|
131
|
+
* @default 'Edit this page'
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
text?: string
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// social link ---------------------------------------------------------------
|
|
137
|
+
|
|
138
|
+
export interface SocialLink {
|
|
139
|
+
icon: SocialLinkIcon
|
|
140
|
+
link: string
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type SocialLinkIcon =
|
|
144
|
+
| 'discord'
|
|
145
|
+
| 'facebook'
|
|
146
|
+
| 'github'
|
|
147
|
+
| 'instagram'
|
|
148
|
+
| 'linkedin'
|
|
149
|
+
| 'slack'
|
|
150
|
+
| 'twitter'
|
|
151
|
+
| 'youtube'
|
|
152
|
+
|
|
153
|
+
// locales -------------------------------------------------------------------
|
|
154
|
+
|
|
155
|
+
export interface LocaleLinks {
|
|
156
|
+
text: string
|
|
157
|
+
items: LocaleLink[]
|
|
158
|
+
}
|
|
134
159
|
|
|
135
|
-
|
|
160
|
+
export interface LocaleLink {
|
|
161
|
+
text: string
|
|
162
|
+
link: string
|
|
136
163
|
}
|
|
137
164
|
|
|
138
|
-
// algolia
|
|
139
|
-
|
|
165
|
+
// algolia ------------------------------------------------------------------
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The Algolia search options. Partially copied from
|
|
169
|
+
* `@docsearch/react/dist/esm/DocSearch.d.ts`
|
|
170
|
+
*/
|
|
140
171
|
export interface AlgoliaSearchOptions {
|
|
141
|
-
appId
|
|
172
|
+
appId: string
|
|
142
173
|
apiKey: string
|
|
143
174
|
indexName: string
|
|
144
175
|
placeholder?: string
|
|
@@ -147,18 +178,12 @@ export declare namespace DefaultTheme {
|
|
|
147
178
|
initialQuery?: string
|
|
148
179
|
}
|
|
149
180
|
|
|
150
|
-
//
|
|
181
|
+
// carbon ads ----------------------------------------------------------------
|
|
151
182
|
|
|
152
|
-
export interface
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
selectText?: string
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Label for this locale in the language dropdown.
|
|
160
|
-
*/
|
|
161
|
-
label?: string
|
|
183
|
+
export interface CarbonAdsOptions {
|
|
184
|
+
carbon: string
|
|
185
|
+
custom?: string
|
|
186
|
+
placement: string
|
|
162
187
|
}
|
|
163
188
|
}
|
|
164
189
|
|
package/dist/node/index.js
CHANGED
|
@@ -35100,7 +35100,7 @@ const preWrapperPlugin = (md) => {
|
|
|
35100
35100
|
};
|
|
35101
35101
|
|
|
35102
35102
|
const indexRE = /(^|.*\/)index.md(#?.*)$/i;
|
|
35103
|
-
const linkPlugin = (md, externalAttrs) => {
|
|
35103
|
+
const linkPlugin = (md, externalAttrs, base) => {
|
|
35104
35104
|
md.renderer.rules.link_open = (tokens, idx, options, env, self) => {
|
|
35105
35105
|
const token = tokens[idx];
|
|
35106
35106
|
const hrefIndex = token.attrIndex("href");
|
|
@@ -35115,7 +35115,7 @@ const linkPlugin = (md, externalAttrs) => {
|
|
|
35115
35115
|
if (url.replace(EXTERNAL_URL_RE, "").startsWith("//localhost:")) {
|
|
35116
35116
|
pushLink(url);
|
|
35117
35117
|
}
|
|
35118
|
-
} else if (!url.startsWith("#") && !url.startsWith("mailto:")) {
|
|
35118
|
+
} else if (!url.startsWith("#") && !url.startsWith("mailto:") && !/\.(?!html|md)\w+($|\?)/i.test(url)) {
|
|
35119
35119
|
normalizeHref(hrefAttr);
|
|
35120
35120
|
}
|
|
35121
35121
|
hrefAttr[1] = hrefAttr[1].replace(/\bimport\.meta/g, "import%2Emeta").replace(/\bprocess\.env/g, "process%2Eenv");
|
|
@@ -35129,7 +35129,7 @@ const linkPlugin = (md, externalAttrs) => {
|
|
|
35129
35129
|
const [, path, hash] = indexMatch;
|
|
35130
35130
|
url = path + hash;
|
|
35131
35131
|
} else {
|
|
35132
|
-
let cleanUrl = url.replace(
|
|
35132
|
+
let cleanUrl = url.replace(/[?#].*$/, "");
|
|
35133
35133
|
if (cleanUrl.endsWith(".md")) {
|
|
35134
35134
|
cleanUrl = cleanUrl.replace(/\.md$/, ".html");
|
|
35135
35135
|
}
|
|
@@ -35143,6 +35143,9 @@ const linkPlugin = (md, externalAttrs) => {
|
|
|
35143
35143
|
url = "./" + url;
|
|
35144
35144
|
}
|
|
35145
35145
|
pushLink(url.replace(/\.html$/, ""));
|
|
35146
|
+
if (url.startsWith("/")) {
|
|
35147
|
+
url = `${base}${url}`.replace(/\/+/g, "/");
|
|
35148
|
+
}
|
|
35146
35149
|
hrefAttr[1] = decodeURI(url);
|
|
35147
35150
|
}
|
|
35148
35151
|
function pushLink(link) {
|
|
@@ -35171,6 +35174,17 @@ const headingPlugin = (md, include = ["h2", "h3"]) => {
|
|
|
35171
35174
|
};
|
|
35172
35175
|
};
|
|
35173
35176
|
|
|
35177
|
+
const imagePlugin = (md) => {
|
|
35178
|
+
md.renderer.rules.image = (tokens, idx, options, env, self) => {
|
|
35179
|
+
const token = tokens[idx];
|
|
35180
|
+
const url = token.attrGet("src");
|
|
35181
|
+
if (url && !EXTERNAL_URL_RE.test(url) && !/^\.?\//.test(url)) {
|
|
35182
|
+
token.attrSet("src", "./" + url);
|
|
35183
|
+
}
|
|
35184
|
+
return self.renderToken(tokens, idx, options);
|
|
35185
|
+
};
|
|
35186
|
+
};
|
|
35187
|
+
|
|
35174
35188
|
var e=!1,n={false:"push",true:"unshift",after:"push",before:"unshift"},t={isPermalinkSymbol:!0};function r(r,a,i,l){var o;if(!e){var c="Using deprecated markdown-it-anchor permalink option, see https://github.com/valeriangalliat/markdown-it-anchor#todo-anchor-or-file";"object"==typeof process&&process&&process.emitWarning?process.emitWarning(c):console.warn(c),e=!0;}var s=[Object.assign(new i.Token("link_open","a",1),{attrs:[].concat(a.permalinkClass?[["class",a.permalinkClass]]:[],[["href",a.permalinkHref(r,i)]],Object.entries(a.permalinkAttrs(r,i)))}),Object.assign(new i.Token("html_block","",0),{content:a.permalinkSymbol,meta:t}),new i.Token("link_close","a",-1)];a.permalinkSpace&&i.tokens[l+1].children[n[a.permalinkBefore]](Object.assign(new i.Token("text","",0),{content:" "})),(o=i.tokens[l+1].children)[n[a.permalinkBefore]].apply(o,s);}function a(e){return "#"+e}function i(e){return {}}var l={class:"header-anchor",symbol:"#",renderHref:a,renderAttrs:i};function o(e){function n(t){return t=Object.assign({},n.defaults,t),function(n,r,a,i){return e(n,t,r,a,i)}}return n.defaults=Object.assign({},l),n.renderPermalinkImpl=e,n}var c=o(function(e,r,a,i,l){var o,c=[Object.assign(new i.Token("link_open","a",1),{attrs:[].concat(r.class?[["class",r.class]]:[],[["href",r.renderHref(e,i)]],r.ariaHidden?[["aria-hidden","true"]]:[],Object.entries(r.renderAttrs(e,i)))}),Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t}),new i.Token("link_close","a",-1)];r.space&&i.tokens[l+1].children[n[r.placement]](Object.assign(new i.Token("text","",0),{content:" "})),(o=i.tokens[l+1].children)[n[r.placement]].apply(o,c);});Object.assign(c.defaults,{space:!0,placement:"after",ariaHidden:!1});var s$1=o(c.renderPermalinkImpl);s$1.defaults=Object.assign({},c.defaults,{ariaHidden:!0});var d$1=o(function(e,n,t,r,a){var i=[Object.assign(new r.Token("link_open","a",1),{attrs:[].concat(n.class?[["class",n.class]]:[],[["href",n.renderHref(e,r)]],Object.entries(n.renderAttrs(e,r)))})].concat(n.safariReaderFix?[new r.Token("span_open","span",1)]:[],r.tokens[a+1].children,n.safariReaderFix?[new r.Token("span_close","span",-1)]:[],[new r.Token("link_close","a",-1)]);r.tokens[a+1]=Object.assign(new r.Token("inline","",0),{children:i});});Object.assign(d$1.defaults,{safariReaderFix:!1});var u=o(function(e,r,a,i,l){var o;if(!["visually-hidden","aria-label","aria-describedby","aria-labelledby"].includes(r.style))throw new Error("`permalink.linkAfterHeader` called with unknown style option `"+r.style+"`");if(!["aria-describedby","aria-labelledby"].includes(r.style)&&!r.assistiveText)throw new Error("`permalink.linkAfterHeader` called without the `assistiveText` option in `"+r.style+"` style");if("visually-hidden"===r.style&&!r.visuallyHiddenClass)throw new Error("`permalink.linkAfterHeader` called without the `visuallyHiddenClass` option in `visually-hidden` style");var c=i.tokens[l+1].children.filter(function(e){return "text"===e.type||"code_inline"===e.type}).reduce(function(e,n){return e+n.content},""),s=[],d=[];r.class&&d.push(["class",r.class]),d.push(["href",r.renderHref(e,i)]),d.push.apply(d,Object.entries(r.renderAttrs(e,i))),"visually-hidden"===r.style?(s.push(Object.assign(new i.Token("span_open","span",1),{attrs:[["class",r.visuallyHiddenClass]]}),Object.assign(new i.Token("text","",0),{content:r.assistiveText(c)}),new i.Token("span_close","span",-1)),r.space&&s[n[r.placement]](Object.assign(new i.Token("text","",0),{content:" "})),s[n[r.placement]](Object.assign(new i.Token("span_open","span",1),{attrs:[["aria-hidden","true"]]}),Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t}),new i.Token("span_close","span",-1))):s.push(Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t})),"aria-label"===r.style?d.push(["aria-label",r.assistiveText(c)]):["aria-describedby","aria-labelledby"].includes(r.style)&&d.push([r.style,e]);var u=[Object.assign(new i.Token("link_open","a",1),{attrs:d})].concat(s,[new i.Token("link_close","a",-1)]);(o=i.tokens).splice.apply(o,[l+3,0].concat(u));});function f(e,n,t,r){var a=e,i=r;if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new Error("User defined `id` attribute `"+e+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(n,a);)a=e+"-"+i,i+=1;return n[a]=!0,a}function b(e,n){n=Object.assign({},b.defaults,n),e.core.ruler.push("anchor",function(e){for(var t,a={},i=e.tokens,l=Array.isArray(n.level)?(t=n.level,function(e){return t.includes(e)}):function(e){return function(n){return n>=e}}(n.level),o=0;o<i.length;o++){var c=i[o];if("heading_open"===c.type&&l(Number(c.tag.substr(1)))){var s=i[o+1].children.filter(function(e){return "text"===e.type||"code_inline"===e.type}).reduce(function(e,n){return e+n.content},""),d=c.attrGet("id");d=null==d?f(n.slugify(s),a,!1,n.uniqueSlugStartIndex):f(d,a,!0,n.uniqueSlugStartIndex),c.attrSet("id",d),!1!==n.tabIndex&&c.attrSet("tabindex",""+n.tabIndex),"function"==typeof n.permalink?n.permalink(d,n,e,o):(n.permalink||n.renderPermalink&&n.renderPermalink!==r)&&n.renderPermalink(d,n,e,o),o=i.indexOf(c),n.callback&&n.callback(c,{slug:d,title:s});}}});}Object.assign(u.defaults,{style:"visually-hidden",space:!0,placement:"after"}),b.permalink={__proto__:null,legacy:r,renderHref:a,renderAttrs:i,makePermalink:o,linkInsideHeader:c,ariaHidden:s$1,headerLink:d$1,linkAfterHeader:u},b.defaults={level:1,slugify:function(e){return encodeURIComponent(String(e).trim().toLowerCase().replace(/\s+/g,"-"))},uniqueSlugStartIndex:1,tabIndex:"-1",permalink:!1,renderPermalink:r,permalinkClass:s$1.defaults.class,permalinkSpace:s$1.defaults.space,permalinkSymbol:"¶",permalinkBefore:"before"===s$1.defaults.placement,permalinkHref:s$1.defaults.renderHref,permalinkAttrs:s$1.defaults.renderAttrs},b.default=b;
|
|
35175
35189
|
|
|
35176
35190
|
var utils$1 = {};
|
|
@@ -36446,16 +36460,16 @@ var __spreadValues$2 = (a, b) => {
|
|
|
36446
36460
|
}
|
|
36447
36461
|
return a;
|
|
36448
36462
|
};
|
|
36449
|
-
const createMarkdownRenderer = (srcDir, options = {}) => {
|
|
36463
|
+
const createMarkdownRenderer = (srcDir, options = {}, base) => {
|
|
36450
36464
|
const md = markdownIt(__spreadValues$2({
|
|
36451
36465
|
html: true,
|
|
36452
36466
|
linkify: true,
|
|
36453
36467
|
highlight
|
|
36454
36468
|
}, options));
|
|
36455
|
-
md.use(componentPlugin).use(highlightLinePlugin).use(preWrapperPlugin).use(snippetPlugin, srcDir).use(hoistPlugin).use(containerPlugin).use(headingPlugin).use(linkPlugin, __spreadValues$2({
|
|
36469
|
+
md.use(componentPlugin).use(highlightLinePlugin).use(preWrapperPlugin).use(snippetPlugin, srcDir).use(hoistPlugin).use(containerPlugin).use(headingPlugin).use(imagePlugin).use(linkPlugin, __spreadValues$2({
|
|
36456
36470
|
target: "_blank",
|
|
36457
36471
|
rel: "noopener noreferrer"
|
|
36458
|
-
}, options.externalLinks)).use(markdownItAttrs, options.attrs).use(b, __spreadValues$2({
|
|
36472
|
+
}, options.externalLinks), base).use(markdownItAttrs, options.attrs).use(b, __spreadValues$2({
|
|
36459
36473
|
slugify: slugify$1,
|
|
36460
36474
|
permalink: b.permalink.ariaHidden({})
|
|
36461
36475
|
}, options.anchor)).use(markdownItTableOfContents, __spreadValues$2({
|
|
@@ -37109,8 +37123,8 @@ function getGitTimestamp(file) {
|
|
|
37109
37123
|
const debug$2 = _debug("vitepress:md");
|
|
37110
37124
|
const cache$1 = new lruCache({ max: 1024 });
|
|
37111
37125
|
const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
|
|
37112
|
-
function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, isBuild = false, includeLastUpdatedData = false) {
|
|
37113
|
-
const md = createMarkdownRenderer(srcDir, options);
|
|
37126
|
+
function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, isBuild = false, base, includeLastUpdatedData = false) {
|
|
37127
|
+
const md = createMarkdownRenderer(srcDir, options, base);
|
|
37114
37128
|
pages = pages.map((p) => slash(p.replace(/\.md$/, "")));
|
|
37115
37129
|
const userDefineRegex = userDefines ? new RegExp(`\\b(${Object.keys(userDefines).map((key) => key.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&")).join("|")})`, "g") : null;
|
|
37116
37130
|
return async (src, file, publicDir) => {
|
|
@@ -37149,6 +37163,8 @@ function createMarkdownToVueRenderFn(srcDir, options = {}, pages, userDefines, i
|
|
|
37149
37163
|
if (data.links) {
|
|
37150
37164
|
const dir2 = path__default["default"].dirname(file);
|
|
37151
37165
|
for (let url of data.links) {
|
|
37166
|
+
if (/\.(?!html|md)\w+($|\?)/i.test(url))
|
|
37167
|
+
continue;
|
|
37152
37168
|
if (url.replace(EXTERNAL_URL_RE, "").startsWith("//localhost:")) {
|
|
37153
37169
|
recordDeadLink(url);
|
|
37154
37170
|
continue;
|
|
@@ -37368,7 +37384,7 @@ function createVitePressPlugin(root, siteConfig, ssr = false, pageToHashMap, cli
|
|
|
37368
37384
|
name: "vitepress",
|
|
37369
37385
|
configResolved(resolvedConfig) {
|
|
37370
37386
|
config = resolvedConfig;
|
|
37371
|
-
markdownToVue = createMarkdownToVueRenderFn(srcDir, markdown, pages, config.define, config.command === "build", siteConfig.lastUpdated);
|
|
37387
|
+
markdownToVue = createMarkdownToVueRenderFn(srcDir, markdown, pages, config.define, config.command === "build", config.base, siteConfig.lastUpdated);
|
|
37372
37388
|
},
|
|
37373
37389
|
config() {
|
|
37374
37390
|
var _a, _b;
|
|
@@ -37436,6 +37452,7 @@ function createVitePressPlugin(root, siteConfig, ssr = false, pageToHashMap, cli
|
|
|
37436
37452
|
server.middlewares.use((req, res, next) => {
|
|
37437
37453
|
if (req.url.endsWith(".html")) {
|
|
37438
37454
|
res.statusCode = 200;
|
|
37455
|
+
res.setHeader("Content-Type", "text/html");
|
|
37439
37456
|
res.end(`
|
|
37440
37457
|
<!DOCTYPE html>
|
|
37441
37458
|
<html>
|
|
@@ -40963,7 +40980,7 @@ function renderHead(head) {
|
|
|
40963
40980
|
return Promise.all(head.map(async ([tag, attrs = {}, innerHTML = ""]) => {
|
|
40964
40981
|
const openTag = `<${tag}${renderAttrs(attrs)}>`;
|
|
40965
40982
|
if (tag !== "link" && tag !== "meta") {
|
|
40966
|
-
if (tag === "script") {
|
|
40983
|
+
if (tag === "script" && (attrs.type === void 0 || attrs.type.includes("javascript"))) {
|
|
40967
40984
|
innerHTML = (await vite.transformWithEsbuild(innerHTML, "inline-script.js", {
|
|
40968
40985
|
minify: true
|
|
40969
40986
|
})).code.trim();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitepress",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-draft.1",
|
|
4
4
|
"description": "Vite & Vue powered static site generator",
|
|
5
5
|
"main": "dist/node/index.js",
|
|
6
6
|
"typings": "types/index.d.ts",
|
|
@@ -14,20 +14,6 @@
|
|
|
14
14
|
"client.d.ts",
|
|
15
15
|
"theme.d.ts"
|
|
16
16
|
],
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=12.0.0"
|
|
19
|
-
},
|
|
20
|
-
"gitHooks": {
|
|
21
|
-
"pre-commit": "lint-staged"
|
|
22
|
-
},
|
|
23
|
-
"lint-staged": {
|
|
24
|
-
"*.js": [
|
|
25
|
-
"prettier --write"
|
|
26
|
-
],
|
|
27
|
-
"*.ts": [
|
|
28
|
-
"prettier --parser=typescript --write"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
17
|
"repository": {
|
|
32
18
|
"type": "git",
|
|
33
19
|
"url": "git+https://github.com/vuejs/vitepress.git"
|
|
@@ -39,24 +25,41 @@
|
|
|
39
25
|
],
|
|
40
26
|
"author": "Evan You",
|
|
41
27
|
"license": "MIT",
|
|
42
|
-
"homepage": "https://github.com/vuejs/vitepress/tree/
|
|
28
|
+
"homepage": "https://github.com/vuejs/vitepress/tree/main/#readme",
|
|
43
29
|
"bugs": {
|
|
44
30
|
"url": "https://github.com/vuejs/vitepress/issues"
|
|
45
31
|
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=14.0.0"
|
|
34
|
+
},
|
|
35
|
+
"gitHooks": {
|
|
36
|
+
"pre-commit": "lint-staged"
|
|
37
|
+
},
|
|
38
|
+
"lint-staged": {
|
|
39
|
+
"*.js": [
|
|
40
|
+
"prettier --write"
|
|
41
|
+
],
|
|
42
|
+
"*.ts": [
|
|
43
|
+
"prettier --parser=typescript --write"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@docsearch/css": "^3.0.0
|
|
48
|
-
"@docsearch/js": "^3.0.0
|
|
49
|
-
"@vitejs/plugin-vue": "^2.2
|
|
47
|
+
"@docsearch/css": "^3.0.0",
|
|
48
|
+
"@docsearch/js": "^3.0.0",
|
|
49
|
+
"@vitejs/plugin-vue": "^2.3.2",
|
|
50
|
+
"@vueuse/core": "^8.5.0",
|
|
51
|
+
"body-scroll-lock": "^4.0.0-beta.0",
|
|
50
52
|
"prismjs": "^1.25.0",
|
|
51
|
-
"vite": "^2.
|
|
52
|
-
"vue": "
|
|
53
|
+
"vite": "^2.9.7",
|
|
54
|
+
"vue": "3.2.33"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"@microsoft/api-extractor": "^7.
|
|
57
|
+
"@microsoft/api-extractor": "^7.23.1",
|
|
56
58
|
"@rollup/plugin-alias": "^3.1.5",
|
|
57
59
|
"@rollup/plugin-commonjs": "^20.0.0",
|
|
58
60
|
"@rollup/plugin-json": "^4.1.0",
|
|
59
61
|
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
62
|
+
"@types/body-scroll-lock": "^3.1.0",
|
|
60
63
|
"@types/compression": "^1.7.0",
|
|
61
64
|
"@types/cross-spawn": "^6.0.2",
|
|
62
65
|
"@types/debug": "^4.1.7",
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
"@types/lru-cache": "^5.1.0",
|
|
67
70
|
"@types/markdown-it": "^12.0.1",
|
|
68
71
|
"@types/micromatch": "^4.0.2",
|
|
72
|
+
"@types/minimist": "^1.2.2",
|
|
69
73
|
"@types/node": "^15.6.1",
|
|
70
74
|
"@types/polka": "^0.5.3",
|
|
71
75
|
"chalk": "^4.1.1",
|
|
@@ -102,8 +106,8 @@
|
|
|
102
106
|
"rollup-plugin-esbuild": "^4.8.2",
|
|
103
107
|
"semver": "^7.3.5",
|
|
104
108
|
"sirv": "^1.0.12",
|
|
105
|
-
"typescript": "^4.
|
|
106
|
-
"vitest": "^0.
|
|
109
|
+
"typescript": "^4.6.4",
|
|
110
|
+
"vitest": "^0.10.4",
|
|
107
111
|
"yorkie": "^2.0.0"
|
|
108
112
|
},
|
|
109
113
|
"scripts": {
|
|
@@ -124,15 +128,15 @@
|
|
|
124
128
|
"lint:js": "prettier --check --write \"{bin,docs,scripts,src}/**/*.js\"",
|
|
125
129
|
"lint:ts": "prettier --check --write --parser typescript \"{__tests__,src,docs,types}/**/*.ts\"",
|
|
126
130
|
"test": "vitest run __tests__ -c __tests__/vitest.config.js --global",
|
|
131
|
+
"test:all": "run-s lint test",
|
|
127
132
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
|
128
133
|
"release": "node scripts/release.js",
|
|
129
134
|
"docs": "run-p dev docs-dev",
|
|
130
135
|
"docs-dev": "node ./bin/vitepress dev docs",
|
|
131
136
|
"docs-debug": "node --inspect-brk ./bin/vitepress dev docs",
|
|
132
|
-
"docs-build": "
|
|
137
|
+
"docs-build": "run-s build docs-build-only",
|
|
133
138
|
"docs-build-only": "node ./bin/vitepress build docs",
|
|
134
139
|
"docs-serve": "node ./bin/vitepress serve docs",
|
|
135
140
|
"ci-docs": "run-s build docs-build"
|
|
136
|
-
}
|
|
137
|
-
"readme": "# (WIP) VitePress 📝💨\n\n[](https://github.com/vuejs/vitepress/actions)\n[](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"
|
|
141
|
+
}
|
|
138
142
|
}
|