mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-12 21:12:26 +03:00
chore(release): 2.2.1
This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [2.2.1](https://github.com/nuxt/vue-meta/compare/v2.2.0...v2.2.1) (2019-08-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* dont assign to global console ([2c0c4c3](https://github.com/nuxt/vue-meta/commit/2c0c4c3))
|
||||
* meta content templates ([#429](https://github.com/nuxt/vue-meta/issues/429)) ([6907f9a](https://github.com/nuxt/vue-meta/commit/6907f9a))
|
||||
|
||||
## [2.2.0](https://github.com/nuxt/vue-meta/compare/v2.1.1...v2.2.0) (2019-07-28)
|
||||
|
||||
|
||||
|
||||
Vendored
+55
-32
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.2.0
|
||||
* vue-meta v2.2.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -13,7 +13,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
||||
|
||||
var deepmerge = _interopDefault(require('deepmerge'));
|
||||
|
||||
var version = "2.2.0";
|
||||
var version = "2.2.1";
|
||||
|
||||
// store an id to keep track of DOM updates
|
||||
var batchId = null;
|
||||
@@ -206,7 +206,7 @@ var hasGlobalWindow = hasGlobalWindowFn();
|
||||
|
||||
var _global = hasGlobalWindow ? window : global;
|
||||
|
||||
var console = _global.console = _global.console || {};
|
||||
var console = _global.console || {};
|
||||
function warn(str) {
|
||||
/* istanbul ignore next */
|
||||
if (!console || !console.warn) {
|
||||
@@ -438,7 +438,8 @@ var tagsWithoutEndTag = ['base', 'meta', 'link']; // HTML elements which can hav
|
||||
|
||||
var tagsWithInnerContent = ['noscript', 'script', 'style']; // Attributes which are inserted as childNodes instead of HTMLAttribute
|
||||
|
||||
var tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json']; // Attributes which should be added with data- prefix
|
||||
var tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json'];
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -625,13 +626,23 @@ function applyTemplate(_ref, headObject, template, chunk) {
|
||||
metaTemplateKeyName = _ref.metaTemplateKeyName,
|
||||
contentKeyName = _ref.contentKeyName;
|
||||
|
||||
if (isUndefined(template)) {
|
||||
if (template === true || headObject[metaTemplateKeyName] === true) {
|
||||
// abort, template was already applied
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isUndefined(template) && headObject[metaTemplateKeyName]) {
|
||||
template = headObject[metaTemplateKeyName];
|
||||
delete headObject[metaTemplateKeyName];
|
||||
headObject[metaTemplateKeyName] = true;
|
||||
} // return early if no template defined
|
||||
|
||||
|
||||
if (!template) {
|
||||
// cleanup faulty template properties
|
||||
if (headObject.hasOwnProperty(metaTemplateKeyName)) {
|
||||
delete headObject[metaTemplateKeyName];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -652,6 +663,11 @@ function _arrayMerge(_ref, target, source) {
|
||||
// but we check for a `vmid` property on each object in the array
|
||||
// using an O(1) lookup associative array exploit
|
||||
var destination = [];
|
||||
|
||||
if (!target.length && !source.length) {
|
||||
return destination;
|
||||
}
|
||||
|
||||
target.forEach(function (targetItem, targetIndex) {
|
||||
// no tagID so no need to check for duplicity
|
||||
if (!targetItem[tagIDKeyName]) {
|
||||
@@ -702,9 +718,14 @@ function _arrayMerge(_ref, target, source) {
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
contentKeyName: contentKeyName
|
||||
}, sourceItem, targetTemplate);
|
||||
} else if (!sourceItem[contentKeyName]) {
|
||||
// use child template and parent content
|
||||
}, sourceItem, targetTemplate); // set template to true to indicate template was already applied
|
||||
|
||||
sourceItem.template = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sourceItem[contentKeyName]) {
|
||||
// use parent content and child template
|
||||
applyTemplate({
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
@@ -770,9 +791,7 @@ function getComponentOption() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var component = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var keyName = options.keyName,
|
||||
metaTemplateKeyName = options.metaTemplateKeyName,
|
||||
tagIDKeyName = options.tagIDKeyName;
|
||||
var keyName = options.keyName;
|
||||
var $options = component.$options,
|
||||
$children = component.$children;
|
||||
|
||||
@@ -810,22 +829,6 @@ function getComponentOption() {
|
||||
});
|
||||
}
|
||||
|
||||
if (metaTemplateKeyName && result.meta) {
|
||||
// apply templates if needed
|
||||
result.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
}); // remove meta items with duplicate vmid's
|
||||
|
||||
result.meta = result.meta.filter(function (metaItem, index, arr) {
|
||||
return (// keep meta item if it doesnt has a vmid
|
||||
!metaItem.hasOwnProperty(tagIDKeyName) || // or if it's the first item in the array with this vmid
|
||||
index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -842,9 +845,9 @@ function getMetaInfo() {
|
||||
var info = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var escapeSequences = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
||||
var component = arguments.length > 3 ? arguments[3] : undefined;
|
||||
|
||||
// Remove all "template" tags from meta
|
||||
var tagIDKeyName = options.tagIDKeyName; // Remove all "template" tags from meta
|
||||
// backup the title chunk in case user wants access to it
|
||||
|
||||
if (info.title) {
|
||||
info.titleChunk = info.title;
|
||||
} // replace title with populated template
|
||||
@@ -863,6 +866,26 @@ function getMetaInfo() {
|
||||
info.base = Object.keys(info.base).length ? [info.base] : [];
|
||||
}
|
||||
|
||||
if (info.meta) {
|
||||
// remove meta items with duplicate vmid's
|
||||
info.meta = info.meta.filter(function (metaItem, index, arr) {
|
||||
var hasVmid = metaItem.hasOwnProperty(tagIDKeyName);
|
||||
|
||||
if (!hasVmid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var isFirstItemForVmid = index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
});
|
||||
return isFirstItemForVmid;
|
||||
}); // apply templates if needed
|
||||
|
||||
info.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
});
|
||||
}
|
||||
|
||||
return escapeMetaInfo(options, info, escapeSequences);
|
||||
}
|
||||
|
||||
@@ -1119,7 +1142,7 @@ function updateTag(appId) {
|
||||
|
||||
var _loop = function _loop(attr) {
|
||||
/* istanbul ignore next */
|
||||
if (!tag.hasOwnProperty(attr)) {
|
||||
if (!tag.hasOwnProperty(attr) || includes(tagProperties, attr)) {
|
||||
return "continue";
|
||||
}
|
||||
|
||||
@@ -1436,7 +1459,7 @@ function tagGenerator() {
|
||||
|
||||
for (var attr in tag) {
|
||||
// these attributes are treated as children on the tag
|
||||
if (tagAttributeAsInnerContent.includes(attr) || attr === 'once') {
|
||||
if (tagAttributeAsInnerContent.includes(attr) || tagProperties.includes(attr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+53
-30
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.2.0
|
||||
* vue-meta v2.2.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import deepmerge from 'deepmerge';
|
||||
|
||||
var version = "2.2.0";
|
||||
var version = "2.2.1";
|
||||
|
||||
// store an id to keep track of DOM updates
|
||||
var batchId = null;
|
||||
@@ -182,7 +182,7 @@ var hasGlobalWindow = hasGlobalWindowFn();
|
||||
|
||||
var _global = hasGlobalWindow ? window : global;
|
||||
|
||||
var console = _global.console = _global.console || {};
|
||||
var console = _global.console || {};
|
||||
function warn(str) {
|
||||
/* istanbul ignore next */
|
||||
if (!console || !console.warn) {
|
||||
@@ -411,6 +411,7 @@ var disableOptionKeys = ['__dangerouslyDisableSanitizers', '__dangerouslyDisable
|
||||
var metaInfoAttributeKeys = ['htmlAttrs', 'headAttrs', 'bodyAttrs']; // HTML elements which support the onload event
|
||||
|
||||
var tagsSupportingOnload = ['link', 'style', 'script']; // HTML elements which dont have a head tag (shortened to our needs)
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -596,13 +597,23 @@ function applyTemplate(_ref, headObject, template, chunk) {
|
||||
metaTemplateKeyName = _ref.metaTemplateKeyName,
|
||||
contentKeyName = _ref.contentKeyName;
|
||||
|
||||
if (isUndefined(template)) {
|
||||
if (template === true || headObject[metaTemplateKeyName] === true) {
|
||||
// abort, template was already applied
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isUndefined(template) && headObject[metaTemplateKeyName]) {
|
||||
template = headObject[metaTemplateKeyName];
|
||||
delete headObject[metaTemplateKeyName];
|
||||
headObject[metaTemplateKeyName] = true;
|
||||
} // return early if no template defined
|
||||
|
||||
|
||||
if (!template) {
|
||||
// cleanup faulty template properties
|
||||
if (headObject.hasOwnProperty(metaTemplateKeyName)) {
|
||||
delete headObject[metaTemplateKeyName];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -623,6 +634,11 @@ function _arrayMerge(_ref, target, source) {
|
||||
// but we check for a `vmid` property on each object in the array
|
||||
// using an O(1) lookup associative array exploit
|
||||
var destination = [];
|
||||
|
||||
if (!target.length && !source.length) {
|
||||
return destination;
|
||||
}
|
||||
|
||||
target.forEach(function (targetItem, targetIndex) {
|
||||
// no tagID so no need to check for duplicity
|
||||
if (!targetItem[tagIDKeyName]) {
|
||||
@@ -673,9 +689,14 @@ function _arrayMerge(_ref, target, source) {
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
contentKeyName: contentKeyName
|
||||
}, sourceItem, targetTemplate);
|
||||
} else if (!sourceItem[contentKeyName]) {
|
||||
// use child template and parent content
|
||||
}, sourceItem, targetTemplate); // set template to true to indicate template was already applied
|
||||
|
||||
sourceItem.template = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sourceItem[contentKeyName]) {
|
||||
// use parent content and child template
|
||||
applyTemplate({
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
@@ -741,9 +762,7 @@ function getComponentOption() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var component = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var keyName = options.keyName,
|
||||
metaTemplateKeyName = options.metaTemplateKeyName,
|
||||
tagIDKeyName = options.tagIDKeyName;
|
||||
var keyName = options.keyName;
|
||||
var $options = component.$options,
|
||||
$children = component.$children;
|
||||
|
||||
@@ -781,22 +800,6 @@ function getComponentOption() {
|
||||
});
|
||||
}
|
||||
|
||||
if (metaTemplateKeyName && result.meta) {
|
||||
// apply templates if needed
|
||||
result.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
}); // remove meta items with duplicate vmid's
|
||||
|
||||
result.meta = result.meta.filter(function (metaItem, index, arr) {
|
||||
return (// keep meta item if it doesnt has a vmid
|
||||
!metaItem.hasOwnProperty(tagIDKeyName) || // or if it's the first item in the array with this vmid
|
||||
index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -813,9 +816,9 @@ function getMetaInfo() {
|
||||
var info = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var escapeSequences = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
||||
var component = arguments.length > 3 ? arguments[3] : undefined;
|
||||
|
||||
// Remove all "template" tags from meta
|
||||
var tagIDKeyName = options.tagIDKeyName; // Remove all "template" tags from meta
|
||||
// backup the title chunk in case user wants access to it
|
||||
|
||||
if (info.title) {
|
||||
info.titleChunk = info.title;
|
||||
} // replace title with populated template
|
||||
@@ -834,6 +837,26 @@ function getMetaInfo() {
|
||||
info.base = Object.keys(info.base).length ? [info.base] : [];
|
||||
}
|
||||
|
||||
if (info.meta) {
|
||||
// remove meta items with duplicate vmid's
|
||||
info.meta = info.meta.filter(function (metaItem, index, arr) {
|
||||
var hasVmid = metaItem.hasOwnProperty(tagIDKeyName);
|
||||
|
||||
if (!hasVmid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var isFirstItemForVmid = index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
});
|
||||
return isFirstItemForVmid;
|
||||
}); // apply templates if needed
|
||||
|
||||
info.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
});
|
||||
}
|
||||
|
||||
return escapeMetaInfo(options, info, escapeSequences);
|
||||
}
|
||||
|
||||
@@ -1090,7 +1113,7 @@ function updateTag(appId) {
|
||||
|
||||
var _loop = function _loop(attr) {
|
||||
/* istanbul ignore next */
|
||||
if (!tag.hasOwnProperty(attr)) {
|
||||
if (!tag.hasOwnProperty(attr) || includes(tagProperties, attr)) {
|
||||
return "continue";
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+55
-32
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.2.0
|
||||
* vue-meta v2.2.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import deepmerge from 'deepmerge';
|
||||
|
||||
var version = "2.2.0";
|
||||
var version = "2.2.1";
|
||||
|
||||
// store an id to keep track of DOM updates
|
||||
var batchId = null;
|
||||
@@ -202,7 +202,7 @@ var hasGlobalWindow = hasGlobalWindowFn();
|
||||
|
||||
var _global = hasGlobalWindow ? window : global;
|
||||
|
||||
var console = _global.console = _global.console || {};
|
||||
var console = _global.console || {};
|
||||
function warn(str) {
|
||||
/* istanbul ignore next */
|
||||
if (!console || !console.warn) {
|
||||
@@ -434,7 +434,8 @@ var tagsWithoutEndTag = ['base', 'meta', 'link']; // HTML elements which can hav
|
||||
|
||||
var tagsWithInnerContent = ['noscript', 'script', 'style']; // Attributes which are inserted as childNodes instead of HTMLAttribute
|
||||
|
||||
var tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json']; // Attributes which should be added with data- prefix
|
||||
var tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json'];
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -621,13 +622,23 @@ function applyTemplate(_ref, headObject, template, chunk) {
|
||||
metaTemplateKeyName = _ref.metaTemplateKeyName,
|
||||
contentKeyName = _ref.contentKeyName;
|
||||
|
||||
if (isUndefined(template)) {
|
||||
if (template === true || headObject[metaTemplateKeyName] === true) {
|
||||
// abort, template was already applied
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isUndefined(template) && headObject[metaTemplateKeyName]) {
|
||||
template = headObject[metaTemplateKeyName];
|
||||
delete headObject[metaTemplateKeyName];
|
||||
headObject[metaTemplateKeyName] = true;
|
||||
} // return early if no template defined
|
||||
|
||||
|
||||
if (!template) {
|
||||
// cleanup faulty template properties
|
||||
if (headObject.hasOwnProperty(metaTemplateKeyName)) {
|
||||
delete headObject[metaTemplateKeyName];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -648,6 +659,11 @@ function _arrayMerge(_ref, target, source) {
|
||||
// but we check for a `vmid` property on each object in the array
|
||||
// using an O(1) lookup associative array exploit
|
||||
var destination = [];
|
||||
|
||||
if (!target.length && !source.length) {
|
||||
return destination;
|
||||
}
|
||||
|
||||
target.forEach(function (targetItem, targetIndex) {
|
||||
// no tagID so no need to check for duplicity
|
||||
if (!targetItem[tagIDKeyName]) {
|
||||
@@ -698,9 +714,14 @@ function _arrayMerge(_ref, target, source) {
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
contentKeyName: contentKeyName
|
||||
}, sourceItem, targetTemplate);
|
||||
} else if (!sourceItem[contentKeyName]) {
|
||||
// use child template and parent content
|
||||
}, sourceItem, targetTemplate); // set template to true to indicate template was already applied
|
||||
|
||||
sourceItem.template = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sourceItem[contentKeyName]) {
|
||||
// use parent content and child template
|
||||
applyTemplate({
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
@@ -766,9 +787,7 @@ function getComponentOption() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var component = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var keyName = options.keyName,
|
||||
metaTemplateKeyName = options.metaTemplateKeyName,
|
||||
tagIDKeyName = options.tagIDKeyName;
|
||||
var keyName = options.keyName;
|
||||
var $options = component.$options,
|
||||
$children = component.$children;
|
||||
|
||||
@@ -806,22 +825,6 @@ function getComponentOption() {
|
||||
});
|
||||
}
|
||||
|
||||
if (metaTemplateKeyName && result.meta) {
|
||||
// apply templates if needed
|
||||
result.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
}); // remove meta items with duplicate vmid's
|
||||
|
||||
result.meta = result.meta.filter(function (metaItem, index, arr) {
|
||||
return (// keep meta item if it doesnt has a vmid
|
||||
!metaItem.hasOwnProperty(tagIDKeyName) || // or if it's the first item in the array with this vmid
|
||||
index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -838,9 +841,9 @@ function getMetaInfo() {
|
||||
var info = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var escapeSequences = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
||||
var component = arguments.length > 3 ? arguments[3] : undefined;
|
||||
|
||||
// Remove all "template" tags from meta
|
||||
var tagIDKeyName = options.tagIDKeyName; // Remove all "template" tags from meta
|
||||
// backup the title chunk in case user wants access to it
|
||||
|
||||
if (info.title) {
|
||||
info.titleChunk = info.title;
|
||||
} // replace title with populated template
|
||||
@@ -859,6 +862,26 @@ function getMetaInfo() {
|
||||
info.base = Object.keys(info.base).length ? [info.base] : [];
|
||||
}
|
||||
|
||||
if (info.meta) {
|
||||
// remove meta items with duplicate vmid's
|
||||
info.meta = info.meta.filter(function (metaItem, index, arr) {
|
||||
var hasVmid = metaItem.hasOwnProperty(tagIDKeyName);
|
||||
|
||||
if (!hasVmid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var isFirstItemForVmid = index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
});
|
||||
return isFirstItemForVmid;
|
||||
}); // apply templates if needed
|
||||
|
||||
info.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
});
|
||||
}
|
||||
|
||||
return escapeMetaInfo(options, info, escapeSequences);
|
||||
}
|
||||
|
||||
@@ -1115,7 +1138,7 @@ function updateTag(appId) {
|
||||
|
||||
var _loop = function _loop(attr) {
|
||||
/* istanbul ignore next */
|
||||
if (!tag.hasOwnProperty(attr)) {
|
||||
if (!tag.hasOwnProperty(attr) || includes(tagProperties, attr)) {
|
||||
return "continue";
|
||||
}
|
||||
|
||||
@@ -1432,7 +1455,7 @@ function tagGenerator() {
|
||||
|
||||
for (var attr in tag) {
|
||||
// these attributes are treated as children on the tag
|
||||
if (tagAttributeAsInnerContent.includes(attr) || attr === 'once') {
|
||||
if (tagAttributeAsInnerContent.includes(attr) || tagProperties.includes(attr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+53
-30
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.2.0
|
||||
* vue-meta v2.2.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -13,7 +13,7 @@
|
||||
(global = global || self, global.VueMeta = factory());
|
||||
}(this, function () { 'use strict';
|
||||
|
||||
var version = "2.2.0";
|
||||
var version = "2.2.1";
|
||||
|
||||
// store an id to keep track of DOM updates
|
||||
var batchId = null;
|
||||
@@ -186,7 +186,7 @@
|
||||
|
||||
var _global = hasGlobalWindow ? window : global;
|
||||
|
||||
var console = _global.console = _global.console || {};
|
||||
var console = _global.console || {};
|
||||
function warn(str) {
|
||||
/* istanbul ignore next */
|
||||
if (!console || !console.warn) {
|
||||
@@ -415,6 +415,7 @@
|
||||
var metaInfoAttributeKeys = ['htmlAttrs', 'headAttrs', 'bodyAttrs']; // HTML elements which support the onload event
|
||||
|
||||
var tagsSupportingOnload = ['link', 'style', 'script']; // HTML elements which dont have a head tag (shortened to our needs)
|
||||
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
|
||||
|
||||
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
|
||||
|
||||
@@ -703,13 +704,23 @@
|
||||
metaTemplateKeyName = _ref.metaTemplateKeyName,
|
||||
contentKeyName = _ref.contentKeyName;
|
||||
|
||||
if (isUndefined(template)) {
|
||||
if (template === true || headObject[metaTemplateKeyName] === true) {
|
||||
// abort, template was already applied
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isUndefined(template) && headObject[metaTemplateKeyName]) {
|
||||
template = headObject[metaTemplateKeyName];
|
||||
delete headObject[metaTemplateKeyName];
|
||||
headObject[metaTemplateKeyName] = true;
|
||||
} // return early if no template defined
|
||||
|
||||
|
||||
if (!template) {
|
||||
// cleanup faulty template properties
|
||||
if (headObject.hasOwnProperty(metaTemplateKeyName)) {
|
||||
delete headObject[metaTemplateKeyName];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -730,6 +741,11 @@
|
||||
// but we check for a `vmid` property on each object in the array
|
||||
// using an O(1) lookup associative array exploit
|
||||
var destination = [];
|
||||
|
||||
if (!target.length && !source.length) {
|
||||
return destination;
|
||||
}
|
||||
|
||||
target.forEach(function (targetItem, targetIndex) {
|
||||
// no tagID so no need to check for duplicity
|
||||
if (!targetItem[tagIDKeyName]) {
|
||||
@@ -780,9 +796,14 @@
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
contentKeyName: contentKeyName
|
||||
}, sourceItem, targetTemplate);
|
||||
} else if (!sourceItem[contentKeyName]) {
|
||||
// use child template and parent content
|
||||
}, sourceItem, targetTemplate); // set template to true to indicate template was already applied
|
||||
|
||||
sourceItem.template = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sourceItem[contentKeyName]) {
|
||||
// use parent content and child template
|
||||
applyTemplate({
|
||||
component: component,
|
||||
metaTemplateKeyName: metaTemplateKeyName,
|
||||
@@ -848,9 +869,7 @@
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var component = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var keyName = options.keyName,
|
||||
metaTemplateKeyName = options.metaTemplateKeyName,
|
||||
tagIDKeyName = options.tagIDKeyName;
|
||||
var keyName = options.keyName;
|
||||
var $options = component.$options,
|
||||
$children = component.$children;
|
||||
|
||||
@@ -888,22 +907,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (metaTemplateKeyName && result.meta) {
|
||||
// apply templates if needed
|
||||
result.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
}); // remove meta items with duplicate vmid's
|
||||
|
||||
result.meta = result.meta.filter(function (metaItem, index, arr) {
|
||||
return (// keep meta item if it doesnt has a vmid
|
||||
!metaItem.hasOwnProperty(tagIDKeyName) || // or if it's the first item in the array with this vmid
|
||||
index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -920,9 +923,9 @@
|
||||
var info = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var escapeSequences = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
||||
var component = arguments.length > 3 ? arguments[3] : undefined;
|
||||
|
||||
// Remove all "template" tags from meta
|
||||
var tagIDKeyName = options.tagIDKeyName; // Remove all "template" tags from meta
|
||||
// backup the title chunk in case user wants access to it
|
||||
|
||||
if (info.title) {
|
||||
info.titleChunk = info.title;
|
||||
} // replace title with populated template
|
||||
@@ -941,6 +944,26 @@
|
||||
info.base = Object.keys(info.base).length ? [info.base] : [];
|
||||
}
|
||||
|
||||
if (info.meta) {
|
||||
// remove meta items with duplicate vmid's
|
||||
info.meta = info.meta.filter(function (metaItem, index, arr) {
|
||||
var hasVmid = metaItem.hasOwnProperty(tagIDKeyName);
|
||||
|
||||
if (!hasVmid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var isFirstItemForVmid = index === findIndex(arr, function (item) {
|
||||
return item[tagIDKeyName] === metaItem[tagIDKeyName];
|
||||
});
|
||||
return isFirstItemForVmid;
|
||||
}); // apply templates if needed
|
||||
|
||||
info.meta.forEach(function (metaObject) {
|
||||
return applyTemplate(options, metaObject);
|
||||
});
|
||||
}
|
||||
|
||||
return escapeMetaInfo(options, info, escapeSequences);
|
||||
}
|
||||
|
||||
@@ -1197,7 +1220,7 @@
|
||||
|
||||
var _loop = function _loop(attr) {
|
||||
/* istanbul ignore next */
|
||||
if (!tag.hasOwnProperty(attr)) {
|
||||
if (!tag.hasOwnProperty(attr) || includes(tagProperties, attr)) {
|
||||
return "continue";
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-meta",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"description": "Manage HTML metadata in Vue.js components with ssr support",
|
||||
"keywords": [
|
||||
"attribute",
|
||||
|
||||
Reference in New Issue
Block a user