@vuepress/shared
Advanced tools
Comparing version 2.0.0-rc.15 to 2.0.0-rc.16
@@ -12,7 +12,7 @@ import { MarkdownItHeader } from '@mdit-vue/types'; | ||
*/ | ||
type HeadTag = HeadTagNonEmpty | HeadTagEmpty; | ||
type HeadTag = HeadTagEmpty | HeadTagNonEmpty; | ||
/** | ||
* Non-empty tags in `<head>` | ||
*/ | ||
type HeadTagNonEmpty = 'title' | 'style' | 'script' | 'noscript' | 'template'; | ||
type HeadTagNonEmpty = 'noscript' | 'script' | 'style' | 'template' | 'title'; | ||
/** | ||
@@ -25,3 +25,3 @@ * Empty tags in `<head>` | ||
*/ | ||
type HeadAttrsConfig = Record<string, string | boolean>; | ||
type HeadAttrsConfig = Record<string, boolean | string>; | ||
@@ -45,3 +45,3 @@ /** | ||
*/ | ||
interface PageBase<ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>> { | ||
interface PageBase<ExtraPageFrontmatter extends Record<string, unknown> = Record<string, unknown>> { | ||
/** | ||
@@ -78,3 +78,3 @@ * Route path of the page | ||
*/ | ||
type PageData<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>> = PageBase<ExtraPageFrontmatter> & ExtraPageData; | ||
type PageData<ExtraPageData extends Record<string, unknown> = Record<string, unknown>, ExtraPageFrontmatter extends Record<string, unknown> = Record<string, unknown>> = ExtraPageData & PageBase<ExtraPageFrontmatter>; | ||
/** | ||
@@ -86,4 +86,4 @@ * Vuepress page frontmatter | ||
*/ | ||
type PageFrontmatter<T extends Record<any, any> = Record<string, unknown>> = Partial<T> & { | ||
date?: string | Date; | ||
type PageFrontmatter<T extends Record<string, unknown> = Record<string, unknown>> = Partial<T> & { | ||
date?: Date | string; | ||
description?: string; | ||
@@ -209,5 +209,5 @@ head?: HeadConfig[]; | ||
/** | ||
* Infer route path according to the given (markdown file) path | ||
* Infer route path of the given raw path | ||
*/ | ||
declare const inferRoutePath: (path: string) => string; | ||
declare const inferRoutePath: (rawPath: string) => string; | ||
@@ -286,3 +286,3 @@ /** | ||
*/ | ||
declare const isPlainObject: <T extends Record<any, any> = Record<any, any>>(val: unknown) => val is T; | ||
declare const isPlainObject: <T extends Record<string, unknown> = Record<string, unknown>>(val: unknown) => val is T; | ||
/** | ||
@@ -289,0 +289,0 @@ * Check if a value is a string |
@@ -13,9 +13,9 @@ // src/utils/links/isLinkWithProtocol.ts | ||
// src/utils/routes/inferRoutePath.ts | ||
var inferRoutePath = (path) => { | ||
if (!path || path.endsWith("/")) return path; | ||
let routePath = path.replace(/(^|\/)README.md$/i, "$1index.html"); | ||
var inferRoutePath = (rawPath) => { | ||
if (!rawPath || rawPath.endsWith("/")) return rawPath; | ||
let routePath = rawPath.replace(/(^|\/)README.md$/i, "$1index.html"); | ||
if (routePath.endsWith(".md")) { | ||
routePath = routePath.substring(0, routePath.length - 3) + ".html"; | ||
routePath = `${routePath.substring(0, routePath.length - 3)}.html`; | ||
} else if (!routePath.endsWith(".html")) { | ||
routePath = routePath + ".html"; | ||
routePath = `${routePath}.html`; | ||
} | ||
@@ -114,6 +114,6 @@ if (routePath.endsWith("/index.html")) { | ||
// src/utils/ensureLeadingSlash.ts | ||
var ensureLeadingSlash = (str) => str[0] === "/" ? str : `/${str}`; | ||
var ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`; | ||
// src/utils/ensureEndingSlash.ts | ||
var ensureEndingSlash = (str) => str[str.length - 1] === "/" || str.endsWith(".html") ? str : `${str}/`; | ||
var ensureEndingSlash = (str) => str.endsWith("/") || str.endsWith(".html") ? str : `${str}/`; | ||
@@ -140,6 +140,6 @@ // src/utils/formatDateString.ts | ||
// src/utils/removeEndingSlash.ts | ||
var removeEndingSlash = (str) => str[str.length - 1] === "/" ? str.slice(0, -1) : str; | ||
var removeEndingSlash = (str) => str.endsWith("/") ? str.slice(0, -1) : str; | ||
// src/utils/removeLeadingSlash.ts | ||
var removeLeadingSlash = (str) => str[0] === "/" ? str.slice(1) : str; | ||
var removeLeadingSlash = (str) => str.startsWith("/") ? str.slice(1) : str; | ||
@@ -146,0 +146,0 @@ // src/utils/typeGuards.ts |
{ | ||
"name": "@vuepress/shared", | ||
"version": "2.0.0-rc.15", | ||
"version": "2.0.0-rc.16", | ||
"description": "Utils that shared between VuePress node and client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,3 +8,3 @@ # @vuepress/shared | ||
https://v2.vuepress.vuejs.org | ||
https://vuepress.vuejs.org | ||
@@ -11,0 +11,0 @@ ## License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15088