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.6.0 to 0.7.0

2

dist/index.d.ts

@@ -45,4 +45,4 @@ import * as vue from 'vue';

declare const renderHeadToString: (head: HeadClient) => HTMLResult;
declare const Head: vue.DefineComponent<{}, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<{} & {}>, {}>;
declare const Head: vue.DefineComponent<{}, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<{} & {} & {}>, {}>;
export { HTMLResult, Head, HeadAttrs, HeadClient, HeadObject, HeadObjectPlain, HeadTag, createHead, injectHead, renderHeadToString, useHead };

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

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {

@@ -20,12 +24,30 @@ for (var prop in b || (b = {}))

var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
// src/index.ts
__export(exports, {
Head: () => Head,
createHead: () => createHead,
injectHead: () => injectHead,
renderHeadToString: () => renderHeadToString,
useHead: () => useHead
});
var import_vue = __toModule(require("vue"));
var _vue = require('vue');
// src/constants.ts

@@ -77,6 +99,6 @@ var PROVIDE_KEY = `usehead`;

if (props.key !== void 0) {
return {name: "key", value: props.key};
return { name: "key", value: props.key };
}
if (props.name !== void 0) {
return {name: "name", value: props.name};
return { name: "name", value: props.name };
}

@@ -91,3 +113,3 @@ if (props.property !== void 0) {

var injectHead = () => {
const head = _vue.inject.call(void 0, PROVIDE_KEY);
const head = (0, import_vue.inject)(PROVIDE_KEY);
if (!head) {

@@ -114,5 +136,5 @@ throw new Error(`You may forget to apply app.use(head)`);

if (key === "title") {
tags.push({tag: key, props: {children: obj[key]}});
tags.push({ tag: key, props: { children: obj[key] } });
} else if (key === "base") {
tags.push({tag: key, props: __spreadValues({key: "default"}, obj[key])});
tags.push({ tag: key, props: __spreadValues({ key: "default" }, obj[key]) });
} else if (acceptFields.includes(key)) {

@@ -122,6 +144,6 @@ const value = obj[key];

value.forEach((item) => {
tags.push({tag: key, props: item});
tags.push({ tag: key, props: item });
});
} else if (value) {
tags.push({tag: key, props: value});
tags.push({ tag: key, props: value });
}

@@ -191,7 +213,7 @@ }

}
if (tag.tag === "meta") {
if (tag.tag === "meta" || tag.tag === "script") {
const key = getTagKey(tag.props);
if (key) {
const elementList = [
...head.querySelectorAll(`meta[${key.name}="${key.value}"]`)
...head.querySelectorAll(`${tag.tag}[${key.name}="${key.value}"]`)
];

@@ -235,3 +257,3 @@ for (const el of elementList) {

tags.forEach((tag) => {
if (tag.tag === "meta" || tag.tag === "base") {
if (tag.tag === "meta" || tag.tag === "base" || tag.tag === "script") {
const key = getTagKey(tag.props);

@@ -273,10 +295,10 @@ if (key) {

var useHead = (obj) => {
const headObj = _vue.ref.call(void 0, obj);
const headObj = (0, import_vue.ref)(obj);
const head = injectHead();
head.addHeadObjs(headObj);
if (IS_BROWSER) {
_vue.watchEffect.call(void 0, () => {
(0, import_vue.watchEffect)(() => {
head.updateDOM();
});
_vue.onBeforeUnmount.call(void 0, () => {
(0, import_vue.onBeforeUnmount)(() => {
head.removeHeadObjs(headObj);

@@ -357,8 +379,8 @@ head.updateDOM();

};
var Head = /* @__PURE__ */ _vue.defineComponent.call(void 0, {
var Head = /* @__PURE__ */ (0, import_vue.defineComponent)({
name: "Head",
setup(_, {slots}) {
setup(_, { slots }) {
const head = injectHead();
let obj;
_vue.onBeforeUnmount.call(void 0, () => {
(0, import_vue.onBeforeUnmount)(() => {
if (obj) {

@@ -370,3 +392,3 @@ head.removeHeadObjs(obj);

return () => {
_vue.watchEffect.call(void 0, () => {
(0, import_vue.watchEffect)(() => {
if (!slots.default)

@@ -377,3 +399,3 @@ return;

}
obj = _vue.ref.call(void 0, vnodesToHeadObj(slots.default()));
obj = (0, import_vue.ref)(vnodesToHeadObj(slots.default()));
head.addHeadObjs(obj);

@@ -388,8 +410,9 @@ if (IS_BROWSER) {

});
exports.Head = Head; exports.createHead = createHead; exports.injectHead = injectHead; exports.renderHeadToString = renderHeadToString; exports.useHead = useHead;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Head,
createHead,
injectHead,
renderHeadToString,
useHead
});
{
"name": "@vueuse/head",
"version": "0.6.0",
"version": "0.7.0",
"license": "MIT",

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

"chrome-location": "^1.2.1",
"esbuild-register": "^2.1.0",
"esbuild-register": "^3.1.2",
"execa": "^5.0.0",

@@ -75,3 +75,3 @@ "husky": "^4.3.8",

"prettier": "^2.2.1",
"tsup": "^4.6.1",
"tsup": "^5.6.3",
"typescript": "^4.2.3",

@@ -78,0 +78,0 @@ "vite": "^2.0.5",

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