Socket
Socket
Sign inDemoInstall

vitepress

Package Overview
Dependencies
Maintainers
4
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vitepress - npm Package Compare versions

Comparing version 0.15.4 to 0.15.5

11

CHANGELOG.md

@@ -0,1 +1,12 @@

## [0.15.5](https://github.com/vuejs/vitepress/compare/v0.15.4...v0.15.5) (2021-06-23)
### Bug Fixes
- **nav:** display nav if locales are present ([#321](https://github.com/vuejs/vitepress/issues/321)) ([e76e6ec](https://github.com/vuejs/vitepress/commit/e76e6ecd54f8a202a9d5051afd72553080f898c9))
- **search:** correctly detect multilang ([c046905](https://github.com/vuejs/vitepress/commit/c046905b032a765352ff6bb9944f72db76c5cf45)), closes [#316](https://github.com/vuejs/vitepress/issues/316)
### Performance Improvements
- only update necessary head tags in prod ([e6bb5a4](https://github.com/vuejs/vitepress/commit/e6bb5a4806bb16f1ace26f27f43b5ed83885bf1a))
## [0.15.4](https://github.com/vuejs/vitepress/compare/v0.15.3...v0.15.4) (2021-06-19)

@@ -2,0 +13,0 @@

39

dist/client/app/composables/head.js
import { watchEffect } from 'vue';
export function useUpdateHead(route, siteDataByRouteRef) {
let metaTagEls = Array.from(document.querySelectorAll('meta'));
let managedHeadTags = [];
let isFirstUpdate = true;

@@ -13,6 +13,6 @@ const updateHeadTags = (newTags) => {

const newEls = [];
const commonLength = Math.min(metaTagEls.length, newTags.length);
const commonLength = Math.min(managedHeadTags.length, newTags.length);
for (let i = 0; i < commonLength; i++) {
let el = metaTagEls[i];
const [tag, attrs] = newTags[i];
let el = managedHeadTags[i];
const [tag, attrs, innerHTML = ''] = newTags[i];
if (el.tagName.toLocaleLowerCase() === tag) {

@@ -30,2 +30,5 @@ for (const key in attrs) {

}
if (el.innerHTML !== innerHTML) {
el.innerHTML = innerHTML;
}
}

@@ -39,3 +42,3 @@ else {

}
metaTagEls
managedHeadTags
.slice(commonLength)

@@ -48,3 +51,3 @@ .forEach((el) => document.head.removeChild(el));

});
metaTagEls = newEls;
managedHeadTags = newEls;
};

@@ -57,21 +60,11 @@ watchEffect(() => {

const frontmatterHead = pageData && pageData.frontmatter.head;
// update title and description
document.title = (pageTitle ? pageTitle + ` | ` : ``) + siteData.title;
document
.querySelector(`meta[name=description]`)
.setAttribute('content', pageDescription || siteData.description);
updateHeadTags([
['meta', { charset: 'utf-8' }],
[
'meta',
{
name: 'viewport',
content: 'width=device-width,initial-scale=1'
}
],
[
'meta',
{
name: 'description',
content: pageDescription || siteData.description
}
],
...siteData.head,
...((frontmatterHead && filterOutHeadDescription(frontmatterHead)) || [])
// site head can only change during dev
...(import.meta.env.DEV ? siteData.head : []),
...(frontmatterHead ? filterOutHeadDescription(frontmatterHead) : [])
]);

@@ -78,0 +71,0 @@ });

@@ -94,3 +94,6 @@ "use strict";

<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="">
</head>

@@ -97,0 +100,0 @@ <body>

{
"name": "vitepress",
"version": "0.15.4",
"version": "0.15.5",
"description": "Vite & Vue powered static site generator",

@@ -5,0 +5,0 @@ "main": "dist/node/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc