mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-07 21:02:26 +03:00
chore(release): 2.3.1
This commit is contained in:
@@ -2,6 +2,15 @@
|
||||
|
||||
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.3.1](https://github.com/nuxt/vue-meta/compare/v2.3.0...v2.3.1) (2019-10-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* accept and pass options as second arg for generate ([2ce5177](https://github.com/nuxt/vue-meta/commit/2ce5177))
|
||||
* still traverse children when metainfo doesnt return object ([#469](https://github.com/nuxt/vue-meta/issues/469)) ([35b7099](https://github.com/nuxt/vue-meta/commit/35b7099))
|
||||
* try to detect global mixins adding meta info ([#467](https://github.com/nuxt/vue-meta/issues/467)) ([2231ec1](https://github.com/nuxt/vue-meta/commit/2231ec1))
|
||||
|
||||
## [2.3.0](https://github.com/nuxt/vue-meta/compare/v2.3.0-beta.0...v2.3.0) (2019-10-03)
|
||||
|
||||
## [2.3.0-beta.0](https://github.com/nuxt/vue-meta/compare/v2.2.2...v2.3.0-beta.0) (2019-09-17)
|
||||
|
||||
Vendored
+96
-62
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.0
|
||||
* vue-meta v2.3.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -14,7 +14,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
||||
|
||||
var deepmerge = _interopDefault(require('deepmerge'));
|
||||
|
||||
var version = "2.3.0";
|
||||
var version = "2.3.1";
|
||||
|
||||
function _typeof(obj) {
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
@@ -233,6 +233,63 @@ function batchUpdate(callback, timeout) {
|
||||
return batchId;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function find(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.find) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return array[idx];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return array.find(predicate, thisArg);
|
||||
}
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
@@ -306,11 +363,12 @@ function createMixin(Vue, options) {
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
var devtoolsEnabled = Vue.config.devtools;
|
||||
Object.defineProperty(this, '_hasMetaInfo', {
|
||||
configurable: true,
|
||||
get: function get() {
|
||||
// Show deprecation warning once when devtools enabled
|
||||
if (Vue.config.devtools && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
if (devtoolsEnabled && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
warn('VueMeta DeprecationWarning: _hasMetaInfo has been deprecated and will be removed in a future version. Please use hasMetaInfo(vm) instead');
|
||||
$root[rootConfigKey].deprecationWarningShown = true;
|
||||
}
|
||||
@@ -330,6 +388,20 @@ function createMixin(Vue, options) {
|
||||
appId: appId
|
||||
};
|
||||
appId++;
|
||||
|
||||
if (devtoolsEnabled && $root.$options[options.keyName]) {
|
||||
// use nextTick so the children should be added to $root
|
||||
this.$nextTick(function () {
|
||||
// find the first child that lists fnOptions
|
||||
var child = find($root.$children, function (c) {
|
||||
return c.$vnode && c.$vnode.fnOptions;
|
||||
});
|
||||
|
||||
if (child && child.$vnode.fnOptions[options.keyName]) {
|
||||
warn("VueMeta has detected a possible global mixin which adds a ".concat(options.keyName, " property to all Vue components on the page. This could cause severe performance issues. If possible, use $meta().addApp to add meta information instead"));
|
||||
}
|
||||
});
|
||||
}
|
||||
} // to speed up updates we keep track of branches which have a component with vue-meta info defined
|
||||
// if _vueMeta = true it has info, if _vueMeta = false a child has info
|
||||
|
||||
@@ -373,14 +445,18 @@ function createMixin(Vue, options) {
|
||||
$root[rootConfigKey].initialized = this.$isServer;
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this[rootKey]; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
});
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
}); // we use the mounted hook here as on page load
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
@@ -426,6 +502,7 @@ function createMixin(Vue, options) {
|
||||
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
return;
|
||||
} // no need to add this hooks on server side
|
||||
|
||||
@@ -448,6 +525,7 @@ function createMixin(Vue, options) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
@@ -502,49 +580,6 @@ function getOptions(options) {
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
var serverSequences = [[/&/g, '&'], [/</g, '<'], [/>/g, '>'], [/"/g, '"'], [/'/g, ''']];
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
@@ -820,14 +855,13 @@ function getComponentOption(options, component, result) {
|
||||
// and set to the computed prop $metaInfo in the mixin
|
||||
// using the computed prop should be a small performance increase
|
||||
// because Vue caches those internally
|
||||
var data = $metaInfo || $options[keyName]; // ignore data if its not an object, then we keep our previous result
|
||||
var data = $metaInfo || $options[keyName]; // only merge data with result when its an object
|
||||
// eg it could be a function when metaInfo() returns undefined
|
||||
// dueo to the or statement above
|
||||
|
||||
if (!isObject(data)) {
|
||||
return result;
|
||||
} // merge with existing options
|
||||
|
||||
|
||||
result = merge(result, data, options);
|
||||
if (isObject(data)) {
|
||||
result = merge(result, data, options);
|
||||
}
|
||||
} // collect & aggregate child options if deep = true
|
||||
|
||||
|
||||
@@ -1819,8 +1853,8 @@ function install(Vue, options) {
|
||||
var index = {
|
||||
version: version,
|
||||
install: install,
|
||||
generate: function generate$1(metaInfo) {
|
||||
return generate(metaInfo) ;
|
||||
generate: function generate$1(metaInfo, options) {
|
||||
return generate(metaInfo, options) ;
|
||||
},
|
||||
hasMetaInfo: hasMetaInfo
|
||||
};
|
||||
|
||||
Vendored
+95
-61
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.0
|
||||
* vue-meta v2.3.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import deepmerge from 'deepmerge';
|
||||
|
||||
var version = "2.3.0";
|
||||
var version = "2.3.1";
|
||||
|
||||
function _typeof(obj) {
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
@@ -190,6 +190,63 @@ function batchUpdate(callback, timeout) {
|
||||
return batchId;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function find(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.find) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return array[idx];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return array.find(predicate, thisArg);
|
||||
}
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
@@ -263,11 +320,12 @@ function createMixin(Vue, options) {
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
var devtoolsEnabled = Vue.config.devtools;
|
||||
Object.defineProperty(this, '_hasMetaInfo', {
|
||||
configurable: true,
|
||||
get: function get() {
|
||||
// Show deprecation warning once when devtools enabled
|
||||
if (Vue.config.devtools && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
if (devtoolsEnabled && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
warn('VueMeta DeprecationWarning: _hasMetaInfo has been deprecated and will be removed in a future version. Please use hasMetaInfo(vm) instead');
|
||||
$root[rootConfigKey].deprecationWarningShown = true;
|
||||
}
|
||||
@@ -287,6 +345,20 @@ function createMixin(Vue, options) {
|
||||
appId: appId
|
||||
};
|
||||
appId++;
|
||||
|
||||
if (devtoolsEnabled && $root.$options[options.keyName]) {
|
||||
// use nextTick so the children should be added to $root
|
||||
this.$nextTick(function () {
|
||||
// find the first child that lists fnOptions
|
||||
var child = find($root.$children, function (c) {
|
||||
return c.$vnode && c.$vnode.fnOptions;
|
||||
});
|
||||
|
||||
if (child && child.$vnode.fnOptions[options.keyName]) {
|
||||
warn("VueMeta has detected a possible global mixin which adds a ".concat(options.keyName, " property to all Vue components on the page. This could cause severe performance issues. If possible, use $meta().addApp to add meta information instead"));
|
||||
}
|
||||
});
|
||||
}
|
||||
} // to speed up updates we keep track of branches which have a component with vue-meta info defined
|
||||
// if _vueMeta = true it has info, if _vueMeta = false a child has info
|
||||
|
||||
@@ -330,14 +402,18 @@ function createMixin(Vue, options) {
|
||||
$root[rootConfigKey].initialized = this.$isServer;
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this[rootKey]; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
});
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
}); // we use the mounted hook here as on page load
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
@@ -383,6 +459,7 @@ function createMixin(Vue, options) {
|
||||
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
return;
|
||||
} // no need to add this hooks on server side
|
||||
|
||||
@@ -405,6 +482,7 @@ function createMixin(Vue, options) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
@@ -459,49 +537,6 @@ function getOptions(options) {
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
function escape(info, options, escapeOptions, escapeKeys) {
|
||||
@@ -776,14 +811,13 @@ function getComponentOption(options, component, result) {
|
||||
// and set to the computed prop $metaInfo in the mixin
|
||||
// using the computed prop should be a small performance increase
|
||||
// because Vue caches those internally
|
||||
var data = $metaInfo || $options[keyName]; // ignore data if its not an object, then we keep our previous result
|
||||
var data = $metaInfo || $options[keyName]; // only merge data with result when its an object
|
||||
// eg it could be a function when metaInfo() returns undefined
|
||||
// dueo to the or statement above
|
||||
|
||||
if (!isObject(data)) {
|
||||
return result;
|
||||
} // merge with existing options
|
||||
|
||||
|
||||
result = merge(result, data, options);
|
||||
if (isObject(data)) {
|
||||
result = merge(result, data, options);
|
||||
}
|
||||
} // collect & aggregate child options if deep = true
|
||||
|
||||
|
||||
@@ -1501,7 +1535,7 @@ function install(Vue, options) {
|
||||
var index = {
|
||||
version: version,
|
||||
install: install,
|
||||
generate: function generate(metaInfo) {
|
||||
generate: function generate(metaInfo, options) {
|
||||
return showWarningNotSupportedInBrowserBundle('generate');
|
||||
},
|
||||
hasMetaInfo: hasMetaInfo
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+96
-62
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.0
|
||||
* vue-meta v2.3.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import deepmerge from 'deepmerge';
|
||||
|
||||
var version = "2.3.0";
|
||||
var version = "2.3.1";
|
||||
|
||||
function _typeof(obj) {
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
@@ -229,6 +229,63 @@ function batchUpdate(callback, timeout) {
|
||||
return batchId;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function find(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.find) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return array[idx];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return array.find(predicate, thisArg);
|
||||
}
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
@@ -302,11 +359,12 @@ function createMixin(Vue, options) {
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
var devtoolsEnabled = Vue.config.devtools;
|
||||
Object.defineProperty(this, '_hasMetaInfo', {
|
||||
configurable: true,
|
||||
get: function get() {
|
||||
// Show deprecation warning once when devtools enabled
|
||||
if (Vue.config.devtools && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
if (devtoolsEnabled && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
warn('VueMeta DeprecationWarning: _hasMetaInfo has been deprecated and will be removed in a future version. Please use hasMetaInfo(vm) instead');
|
||||
$root[rootConfigKey].deprecationWarningShown = true;
|
||||
}
|
||||
@@ -326,6 +384,20 @@ function createMixin(Vue, options) {
|
||||
appId: appId
|
||||
};
|
||||
appId++;
|
||||
|
||||
if (devtoolsEnabled && $root.$options[options.keyName]) {
|
||||
// use nextTick so the children should be added to $root
|
||||
this.$nextTick(function () {
|
||||
// find the first child that lists fnOptions
|
||||
var child = find($root.$children, function (c) {
|
||||
return c.$vnode && c.$vnode.fnOptions;
|
||||
});
|
||||
|
||||
if (child && child.$vnode.fnOptions[options.keyName]) {
|
||||
warn("VueMeta has detected a possible global mixin which adds a ".concat(options.keyName, " property to all Vue components on the page. This could cause severe performance issues. If possible, use $meta().addApp to add meta information instead"));
|
||||
}
|
||||
});
|
||||
}
|
||||
} // to speed up updates we keep track of branches which have a component with vue-meta info defined
|
||||
// if _vueMeta = true it has info, if _vueMeta = false a child has info
|
||||
|
||||
@@ -369,14 +441,18 @@ function createMixin(Vue, options) {
|
||||
$root[rootConfigKey].initialized = this.$isServer;
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this[rootKey]; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
});
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
}); // we use the mounted hook here as on page load
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
@@ -422,6 +498,7 @@ function createMixin(Vue, options) {
|
||||
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
return;
|
||||
} // no need to add this hooks on server side
|
||||
|
||||
@@ -444,6 +521,7 @@ function createMixin(Vue, options) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
@@ -498,49 +576,6 @@ function getOptions(options) {
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
var serverSequences = [[/&/g, '&'], [/</g, '<'], [/>/g, '>'], [/"/g, '"'], [/'/g, ''']];
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
@@ -816,14 +851,13 @@ function getComponentOption(options, component, result) {
|
||||
// and set to the computed prop $metaInfo in the mixin
|
||||
// using the computed prop should be a small performance increase
|
||||
// because Vue caches those internally
|
||||
var data = $metaInfo || $options[keyName]; // ignore data if its not an object, then we keep our previous result
|
||||
var data = $metaInfo || $options[keyName]; // only merge data with result when its an object
|
||||
// eg it could be a function when metaInfo() returns undefined
|
||||
// dueo to the or statement above
|
||||
|
||||
if (!isObject(data)) {
|
||||
return result;
|
||||
} // merge with existing options
|
||||
|
||||
|
||||
result = merge(result, data, options);
|
||||
if (isObject(data)) {
|
||||
result = merge(result, data, options);
|
||||
}
|
||||
} // collect & aggregate child options if deep = true
|
||||
|
||||
|
||||
@@ -1815,8 +1849,8 @@ function install(Vue, options) {
|
||||
var index = {
|
||||
version: version,
|
||||
install: install,
|
||||
generate: function generate$1(metaInfo) {
|
||||
return generate(metaInfo) ;
|
||||
generate: function generate$1(metaInfo, options) {
|
||||
return generate(metaInfo, options) ;
|
||||
},
|
||||
hasMetaInfo: hasMetaInfo
|
||||
};
|
||||
|
||||
Vendored
+95
-61
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue-meta v2.3.0
|
||||
* vue-meta v2.3.1
|
||||
* (c) 2019
|
||||
* - Declan de Wet
|
||||
* - Sébastien Chopin (@Atinux)
|
||||
@@ -14,7 +14,7 @@
|
||||
(global = global || self, global.VueMeta = factory());
|
||||
}(this, function () { 'use strict';
|
||||
|
||||
var version = "2.3.0";
|
||||
var version = "2.3.1";
|
||||
|
||||
function _typeof(obj) {
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
@@ -194,6 +194,63 @@
|
||||
return batchId;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function find(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.find) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return array[idx];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return array.find(predicate, thisArg);
|
||||
}
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
function ensureIsArray(arg, key) {
|
||||
if (!key || !isObject(arg)) {
|
||||
return isArray(arg) ? arg : [];
|
||||
@@ -267,11 +324,12 @@
|
||||
var rootKey = '$root';
|
||||
var $root = this[rootKey];
|
||||
var $options = this.$options;
|
||||
var devtoolsEnabled = Vue.config.devtools;
|
||||
Object.defineProperty(this, '_hasMetaInfo', {
|
||||
configurable: true,
|
||||
get: function get() {
|
||||
// Show deprecation warning once when devtools enabled
|
||||
if (Vue.config.devtools && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
if (devtoolsEnabled && !$root[rootConfigKey].deprecationWarningShown) {
|
||||
warn('VueMeta DeprecationWarning: _hasMetaInfo has been deprecated and will be removed in a future version. Please use hasMetaInfo(vm) instead');
|
||||
$root[rootConfigKey].deprecationWarningShown = true;
|
||||
}
|
||||
@@ -291,6 +349,20 @@
|
||||
appId: appId
|
||||
};
|
||||
appId++;
|
||||
|
||||
if (devtoolsEnabled && $root.$options[options.keyName]) {
|
||||
// use nextTick so the children should be added to $root
|
||||
this.$nextTick(function () {
|
||||
// find the first child that lists fnOptions
|
||||
var child = find($root.$children, function (c) {
|
||||
return c.$vnode && c.$vnode.fnOptions;
|
||||
});
|
||||
|
||||
if (child && child.$vnode.fnOptions[options.keyName]) {
|
||||
warn("VueMeta has detected a possible global mixin which adds a ".concat(options.keyName, " property to all Vue components on the page. This could cause severe performance issues. If possible, use $meta().addApp to add meta information instead"));
|
||||
}
|
||||
});
|
||||
}
|
||||
} // to speed up updates we keep track of branches which have a component with vue-meta info defined
|
||||
// if _vueMeta = true it has info, if _vueMeta = false a child has info
|
||||
|
||||
@@ -334,14 +406,18 @@
|
||||
$root[rootConfigKey].initialized = this.$isServer;
|
||||
|
||||
if (!$root[rootConfigKey].initialized) {
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this[rootKey]; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
if (!$root[rootConfigKey].initializedSsr) {
|
||||
$root[rootConfigKey].initializedSsr = true;
|
||||
ensuredPush($options, 'beforeMount', function () {
|
||||
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
|
||||
// only one SSR app per page is supported
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
});
|
||||
} // we use the mounted hook here as on page load
|
||||
|
||||
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
|
||||
$root[rootConfigKey].appId = options.ssrAppId;
|
||||
}
|
||||
}); // we use the mounted hook here as on page load
|
||||
|
||||
ensuredPush($options, 'mounted', function () {
|
||||
var $root = this[rootKey];
|
||||
@@ -387,6 +463,7 @@
|
||||
|
||||
|
||||
if (this.$isServer) {
|
||||
/* istanbul ignore next */
|
||||
return;
|
||||
} // no need to add this hooks on server side
|
||||
|
||||
@@ -409,6 +486,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._hasMetaInfo;
|
||||
this.$nextTick(function () {
|
||||
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
|
||||
triggerUpdate(options, _this.$root, 'destroyed');
|
||||
@@ -463,49 +541,6 @@
|
||||
return optionsCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce build size, this file provides simple polyfills without
|
||||
* overly excessive type checking and without modifying
|
||||
* the global Array.prototype
|
||||
* The polyfills are automatically removed in the commonjs build
|
||||
* Also, only files in client/ & shared/ should use these functions
|
||||
* files in server/ still use normal js function
|
||||
*/
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
if ( !Array.prototype.findIndex) {
|
||||
// idx needs to be a Number, for..in returns string
|
||||
for (var idx = 0; idx < array.length; idx++) {
|
||||
if (predicate.call(thisArg, array[idx], idx, array)) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array.findIndex(predicate, thisArg);
|
||||
}
|
||||
function toArray(arg) {
|
||||
if ( !Array.from) {
|
||||
return Array.prototype.slice.call(arg);
|
||||
}
|
||||
|
||||
return Array.from(arg);
|
||||
}
|
||||
function includes(array, value) {
|
||||
if ( !Array.prototype.includes) {
|
||||
for (var idx in array) {
|
||||
if (array[idx] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return array.includes(value);
|
||||
}
|
||||
|
||||
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
|
||||
|
||||
function escape(info, options, escapeOptions, escapeKeys) {
|
||||
@@ -848,14 +883,13 @@
|
||||
// and set to the computed prop $metaInfo in the mixin
|
||||
// using the computed prop should be a small performance increase
|
||||
// because Vue caches those internally
|
||||
var data = $metaInfo || $options[keyName]; // ignore data if its not an object, then we keep our previous result
|
||||
var data = $metaInfo || $options[keyName]; // only merge data with result when its an object
|
||||
// eg it could be a function when metaInfo() returns undefined
|
||||
// dueo to the or statement above
|
||||
|
||||
if (!isObject(data)) {
|
||||
return result;
|
||||
} // merge with existing options
|
||||
|
||||
|
||||
result = merge(result, data, options);
|
||||
if (isObject(data)) {
|
||||
result = merge(result, data, options);
|
||||
}
|
||||
} // collect & aggregate child options if deep = true
|
||||
|
||||
|
||||
@@ -1573,7 +1607,7 @@
|
||||
var index = {
|
||||
version: version,
|
||||
install: install,
|
||||
generate: function generate(metaInfo) {
|
||||
generate: function generate(metaInfo, options) {
|
||||
return showWarningNotSupportedInBrowserBundle('generate');
|
||||
},
|
||||
hasMetaInfo: hasMetaInfo
|
||||
|
||||
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.3.0",
|
||||
"version": "2.3.1",
|
||||
"description": "Manage HTML metadata in Vue.js components with ssr support",
|
||||
"keywords": [
|
||||
"attribute",
|
||||
|
||||
Reference in New Issue
Block a user