@vuepress/shared
Advanced tools
Comparing version 2.0.0-rc.0 to 2.0.0-rc.1
import { MarkdownItHeader } from '@mdit-vue/types'; | ||
export { isArray, isFunction, isString } from '@vue/shared'; | ||
@@ -257,3 +256,3 @@ /** | ||
*/ | ||
declare const resolveHeadIdentifier: ([tag, attrs, content,]: HeadConfig) => string; | ||
declare const resolveHeadIdentifier: ([tag, attrs, content]: HeadConfig) => string | null; | ||
@@ -267,2 +266,11 @@ /** | ||
export { HeadAttrsConfig, HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, LocaleConfig, LocaleData, PageBase, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleConfig, SiteLocaleData, VuepressSSRContext, dedupeHead, ensureEndingSlash, ensureLeadingSlash, formatDateString, isLinkExternal, isLinkHttp, isLinkWithProtocol, isPlainObject, omit, removeEndingSlash, removeLeadingSlash, resolveHeadIdentifier, resolveLocalePath, resolveRoutePathFromUrl }; | ||
/** | ||
* Check if a value is a function | ||
*/ | ||
declare const isFunction: (val: unknown) => val is Function; | ||
/** | ||
* Check if a value is a string | ||
*/ | ||
declare const isString: (val: unknown) => val is string; | ||
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 }; |
@@ -1,20 +0,27 @@ | ||
// src/utils/index.ts | ||
import { isArray, isFunction, isString } from "@vue/shared"; | ||
// src/utils/resolveHeadIdentifier.ts | ||
var resolveHeadIdentifier = ([ | ||
tag, | ||
attrs, | ||
content | ||
]) => { | ||
var TAGS_ALLOWED = ["link", "meta", "script", "style", "noscript", "template"]; | ||
var TAGS_UNIQUE = ["title", "base"]; | ||
var resolveHeadIdentifier = ([tag, attrs, content]) => { | ||
if (TAGS_UNIQUE.includes(tag)) { | ||
return tag; | ||
} | ||
if (!TAGS_ALLOWED.includes(tag)) { | ||
return null; | ||
} | ||
if (tag === "meta" && attrs.name) { | ||
return `${tag}.${attrs.name}`; | ||
} | ||
if (["title", "base"].includes(tag)) { | ||
return tag; | ||
} | ||
if (tag === "template" && attrs.id) { | ||
return `${tag}.${attrs.id}`; | ||
} | ||
return JSON.stringify([tag, attrs, content]); | ||
return JSON.stringify([ | ||
tag, | ||
Object.entries(attrs).map(([key, value]) => { | ||
if (typeof value === "boolean") { | ||
return value ? [key, ""] : null; | ||
} | ||
return [key, value]; | ||
}).filter((item) => item != null).sort(([keyA], [keyB]) => keyA.localeCompare(keyB)), | ||
content | ||
]); | ||
}; | ||
@@ -28,3 +35,3 @@ | ||
const identifier = resolveHeadIdentifier(item); | ||
if (!identifierSet.has(identifier)) { | ||
if (identifier && !identifierSet.has(identifier)) { | ||
identifierSet.add(identifier); | ||
@@ -111,2 +118,6 @@ result.push(item); | ||
}; | ||
// src/utils/typeGuards.ts | ||
var isFunction = (val) => typeof val === "function"; | ||
var isString = (val) => typeof val === "string"; | ||
export { | ||
@@ -117,3 +128,2 @@ dedupeHead, | ||
formatDateString, | ||
isArray, | ||
isFunction, | ||
@@ -120,0 +130,0 @@ isLinkExternal, |
{ | ||
"name": "@vuepress/shared", | ||
"version": "2.0.0-rc.0", | ||
"version": "2.0.0-rc.1", | ||
"description": "Utils that shared between VuePress node and client", | ||
@@ -12,7 +12,7 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/vuepress/vuepress-next/issues" | ||
"url": "https://github.com/vuepress/core/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vuepress/vuepress-next.git" | ||
"url": "git+https://github.com/vuepress/core.git" | ||
}, | ||
@@ -33,4 +33,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@mdit-vue/types": "^1.0.0", | ||
"@vue/shared": "^3.3.8" | ||
"@mdit-vue/types": "^2.0.0" | ||
}, | ||
@@ -52,3 +51,3 @@ "publishConfig": { | ||
"target": "es2022", | ||
"tsconfig": "../tsconfig.dts.json" | ||
"tsconfig": "../../tsconfig.dts.json" | ||
}, | ||
@@ -55,0 +54,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
13439
1
5
378
0
13
+ Added@mdit-vue/types@2.1.0(transitive)
- Removed@vue/shared@^3.3.8
- Removed@mdit-vue/types@1.0.0(transitive)
- Removed@vue/shared@3.5.12(transitive)
Updated@mdit-vue/types@^2.0.0