@vuepress/shared 2.0.0-rc.2 → 2.0.0-rc.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.
package/dist/index.d.ts CHANGED
@@ -41,14 +41,6 @@ type LocaleData = Record<never, never>;
41
41
  * Base type of vuepress page
42
42
  */
43
43
  interface PageBase<ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>> {
44
- /**
45
- * Identifier of the page
46
- *
47
- * Will also be used as the component name
48
- *
49
- * @example 'v-foobar'
50
- */
51
- key: string;
52
44
  /**
53
45
  * Route path of the page
54
46
  *
@@ -235,6 +227,11 @@ declare const isLinkWithProtocol: (link: string) => boolean;
235
227
  */
236
228
  declare const isPlainObject: <T extends Record<any, any> = Record<any, any>>(val: unknown) => val is T;
237
229
 
230
+ /**
231
+ * Normalize the given path to the final route path
232
+ */
233
+ declare const normalizeRoutePath: (path: string) => string;
234
+
238
235
  /**
239
236
  * Omit properties from an object
240
237
  */
@@ -271,4 +268,4 @@ declare const isFunction: (val: unknown) => val is Function;
271
268
  */
272
269
  declare const isString: (val: unknown) => val is string;
273
270
 
274
- export { type HeadAttrsConfig, type HeadConfig, type HeadTag, type HeadTagEmpty, type HeadTagNonEmpty, type LocaleConfig, type LocaleData, type PageBase, type PageData, type PageFrontmatter, type PageHeader, type SiteData, type SiteLocaleConfig, type SiteLocaleData, type VuepressSSRContext, dedupeHead, ensureEndingSlash, ensureLeadingSlash, formatDateString, isFunction, isLinkExternal, isLinkHttp, isLinkWithProtocol, isPlainObject, isString, omit, removeEndingSlash, removeLeadingSlash, resolveHeadIdentifier, resolveLocalePath, resolveRoutePathFromUrl };
271
+ export { type HeadAttrsConfig, type HeadConfig, type HeadTag, type HeadTagEmpty, type HeadTagNonEmpty, type LocaleConfig, type LocaleData, type PageBase, type PageData, type PageFrontmatter, type PageHeader, type SiteData, type SiteLocaleConfig, type SiteLocaleData, type VuepressSSRContext, dedupeHead, ensureEndingSlash, ensureLeadingSlash, formatDateString, isFunction, isLinkExternal, isLinkHttp, isLinkWithProtocol, isPlainObject, isString, normalizeRoutePath, omit, removeEndingSlash, removeLeadingSlash, resolveHeadIdentifier, resolveLocalePath, resolveRoutePathFromUrl };
package/dist/index.js CHANGED
@@ -77,6 +77,12 @@ var isLinkWithProtocol = (link) => /^[a-z][a-z0-9+.-]*:/.test(link);
77
77
  // src/utils/isPlainObject.ts
78
78
  var isPlainObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
79
79
 
80
+ // src/utils/normalizeRoutePath.ts
81
+ var normalizeRoutePath = (path) => {
82
+ const convertedMdPath = path.endsWith("README.md") ? path.substring(0, path.length - 9) : path.endsWith(".md") ? path.substring(0, path.length - 3) + ".html" : path;
83
+ return convertedMdPath.endsWith("/index.html") ? convertedMdPath.substring(0, convertedMdPath.length - 10) : convertedMdPath.endsWith(".html") || convertedMdPath.endsWith("/") ? convertedMdPath : convertedMdPath + ".html";
84
+ };
85
+
80
86
  // src/utils/omit.ts
81
87
  var omit = (obj, ...keys) => {
82
88
  const result = { ...obj };
@@ -129,6 +135,7 @@ export {
129
135
  isLinkWithProtocol,
130
136
  isPlainObject,
131
137
  isString,
138
+ normalizeRoutePath,
132
139
  omit,
133
140
  removeEndingSlash,
134
141
  removeLeadingSlash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/shared",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.0.0-rc.4",
4
4
  "description": "Utils that shared between VuePress node and client",
5
5
  "keywords": [
6
6
  "vuepress",