Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vueuse/head

Package Overview
Dependencies
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vueuse/head - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

1

dist/index.d.ts

@@ -29,2 +29,3 @@ import { UnwrapRef, App, Ref } from 'vue';

removeHeadTags: (tags: HeadTag[]) => void;
updateHeadTags: (oldTags: HeadTag[], newTags: HeadTag[]) => void;
updateDOM: (document?: Document) => void;

@@ -31,0 +32,0 @@ };

76

dist/index.js

@@ -177,3 +177,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts

var createHead = () => {
const headTags = [];
let allHeadTags = [];
const head = {

@@ -184,36 +184,47 @@ install(app) {

},
headTags,
addHeadTags(tags) {
tags.forEach((tag) => {
if (tag.tag === "meta" || tag.tag === "base") {
const key = getTagKey(tag.props);
if (key) {
let index = -1;
for (let i = 0; i < headTags.length; i++) {
const prev = headTags[i];
const prevValue = prev.props[key.name];
const nextValue = tag.props[key.name];
if (prev.tag === tag.tag && prevValue === nextValue) {
index = i;
break;
get headTags() {
const deduped = [];
allHeadTags.forEach((tags) => {
tags.forEach((tag) => {
if (tag.tag === "meta" || tag.tag === "base") {
const key = getTagKey(tag.props);
if (key) {
let index = -1;
for (let i = 0; i < deduped.length; i++) {
const prev = deduped[i];
const prevValue = prev.props[key.name];
const nextValue = tag.props[key.name];
if (prev.tag === tag.tag && prevValue === nextValue) {
index = i;
break;
}
}
if (index !== -1) {
deduped.splice(index, 1);
}
}
if (index !== -1) {
headTags.splice(index, 1);
}
}
deduped.push(tag);
});
});
return deduped;
},
addHeadTags(tags) {
allHeadTags.push(tags);
},
updateHeadTags(oldTags, newTags) {
allHeadTags = allHeadTags.map((v) => {
if (v === oldTags) {
return newTags;
}
headTags.push(tag);
return v;
});
},
removeHeadTags(tags) {
tags.forEach((tag) => {
const index = headTags.indexOf(tag);
if (index !== -1) {
headTags.splice(index, 1);
}
allHeadTags = allHeadTags.filter((v) => {
return tags !== v;
});
},
updateDOM(document) {
insertTags(headTags, document);
insertTags(head.headTags, document);
}

@@ -229,13 +240,16 @@ };

let tags;
let oldTags;
_vue.watchEffect.call(void 0, () => {
if (tags) {
head.removeHeadTags(tags);
tags = headObjToTags(headObj.value);
if (oldTags) {
head.updateHeadTags(oldTags, tags);
} else {
head.addHeadTags(tags);
}
tags = headObjToTags(headObj.value);
head.addHeadTags(tags);
oldTags = tags;
head.updateDOM();
});
_vue.onBeforeUnmount.call(void 0, () => {
if (tags) {
head.removeHeadTags(tags);
if (oldTags) {
head.removeHeadTags(oldTags);
head.updateDOM();

@@ -242,0 +256,0 @@ }

{
"name": "@vueuse/head",
"version": "0.3.1",
"version": "0.3.2",
"license": "MIT",

@@ -23,6 +23,6 @@ "description": "Document head manager for Vue 3. SSR ready.",

"scripts": {
"test": "start-server-and-test example http://localhost:3000 test:e2e",
"test": "node -r esbuild-register scripts/run-test.ts",
"example": "vite example",
"release": "shipjs prepare",
"build": "tsup src/index.ts --format esm,cjs --external vue --dts",
"build": "tsup src/index.ts --format esm,cjs && tsc && dtsup types/index.d.ts",
"prepublishOnly": "npm run build",

@@ -54,3 +54,3 @@ "test:e2e": "ava"

"lint-staged": {
"*.ts": [
"*.{ts,tsx}": [
"prettier --write"

@@ -62,14 +62,18 @@ ]

"@egoist/prettier-config": "^0.1.0",
"@types/node-fetch": "^2.5.8",
"@vitejs/plugin-vue-jsx": "^1.0.2",
"@vue/server-renderer": "^3.0.5",
"ava": "^3.15.0",
"esbuild-register": "^1.2.1",
"chrome-location": "^1.2.1",
"dtsup": "^1.0.1",
"esbuild-register": "^2.1.0",
"execa": "^5.0.0",
"husky": "^4.3.8",
"lint-staged": "^10.5.3",
"playwright-chromium": "^1.8.0",
"node-fetch": "^2.6.1",
"playwright-core": "^1.9.1",
"prettier": "^2.2.1",
"start-server-and-test": "^1.11.7",
"tsup": "^3.11.0",
"typescript": "^4.1.3",
"vite": "^2.0.0-beta.30",
"tsup": "^4.6.1",
"typescript": "^4.2.2",
"vite": "^2.0.5",
"vue": "^3.0.5",

@@ -76,0 +80,0 @@ "vue-router": "^4.0.3"

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