Skip to content

Commit 06295bf

Browse files
committed
chore(release): 2.3.1
1 parent dae968b commit 06295bf

8 files changed

+394
-249
lines changed

Diff for: CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
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.
44

5+
### [2.3.1](https://github.com/nuxt/vue-meta/compare/v2.3.0...v2.3.1) (2019-10-09)
6+
7+
8+
### Bug Fixes
9+
10+
* accept and pass options as second arg for generate ([2ce5177](https://github.com/nuxt/vue-meta/commit/2ce5177))
11+
* 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))
12+
* 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))
13+
514
## [2.3.0](https://github.com/nuxt/vue-meta/compare/v2.3.0-beta.0...v2.3.0) (2019-10-03)
615

716
## [2.3.0-beta.0](https://github.com/nuxt/vue-meta/compare/v2.2.2...v2.3.0-beta.0) (2019-09-17)

Diff for: dist/vue-meta.common.js

+96-62
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-meta v2.3.0
2+
* vue-meta v2.3.1
33
* (c) 2019
44
* - Declan de Wet
55
* - Sébastien Chopin (@Atinux)
@@ -14,7 +14,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
1414

1515
var deepmerge = _interopDefault(require('deepmerge'));
1616

17-
var version = "2.3.0";
17+
var version = "2.3.1";
1818

1919
function _typeof(obj) {
2020
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
@@ -233,6 +233,63 @@ function batchUpdate(callback, timeout) {
233233
return batchId;
234234
}
235235

236+
/*
237+
* To reduce build size, this file provides simple polyfills without
238+
* overly excessive type checking and without modifying
239+
* the global Array.prototype
240+
* The polyfills are automatically removed in the commonjs build
241+
* Also, only files in client/ & shared/ should use these functions
242+
* files in server/ still use normal js function
243+
*/
244+
function find(array, predicate, thisArg) {
245+
if ( !Array.prototype.find) {
246+
// idx needs to be a Number, for..in returns string
247+
for (var idx = 0; idx < array.length; idx++) {
248+
if (predicate.call(thisArg, array[idx], idx, array)) {
249+
return array[idx];
250+
}
251+
}
252+
253+
return;
254+
}
255+
256+
return array.find(predicate, thisArg);
257+
}
258+
function findIndex(array, predicate, thisArg) {
259+
if ( !Array.prototype.findIndex) {
260+
// idx needs to be a Number, for..in returns string
261+
for (var idx = 0; idx < array.length; idx++) {
262+
if (predicate.call(thisArg, array[idx], idx, array)) {
263+
return idx;
264+
}
265+
}
266+
267+
return -1;
268+
}
269+
270+
return array.findIndex(predicate, thisArg);
271+
}
272+
function toArray(arg) {
273+
if ( !Array.from) {
274+
return Array.prototype.slice.call(arg);
275+
}
276+
277+
return Array.from(arg);
278+
}
279+
function includes(array, value) {
280+
if ( !Array.prototype.includes) {
281+
for (var idx in array) {
282+
if (array[idx] === value) {
283+
return true;
284+
}
285+
}
286+
287+
return false;
288+
}
289+
290+
return array.includes(value);
291+
}
292+
236293
function ensureIsArray(arg, key) {
237294
if (!key || !isObject(arg)) {
238295
return isArray(arg) ? arg : [];
@@ -306,11 +363,12 @@ function createMixin(Vue, options) {
306363
var rootKey = '$root';
307364
var $root = this[rootKey];
308365
var $options = this.$options;
366+
var devtoolsEnabled = Vue.config.devtools;
309367
Object.defineProperty(this, '_hasMetaInfo', {
310368
configurable: true,
311369
get: function get() {
312370
// Show deprecation warning once when devtools enabled
313-
if (Vue.config.devtools && !$root[rootConfigKey].deprecationWarningShown) {
371+
if (devtoolsEnabled && !$root[rootConfigKey].deprecationWarningShown) {
314372
warn('VueMeta DeprecationWarning: _hasMetaInfo has been deprecated and will be removed in a future version. Please use hasMetaInfo(vm) instead');
315373
$root[rootConfigKey].deprecationWarningShown = true;
316374
}
@@ -330,6 +388,20 @@ function createMixin(Vue, options) {
330388
appId: appId
331389
};
332390
appId++;
391+
392+
if (devtoolsEnabled && $root.$options[options.keyName]) {
393+
// use nextTick so the children should be added to $root
394+
this.$nextTick(function () {
395+
// find the first child that lists fnOptions
396+
var child = find($root.$children, function (c) {
397+
return c.$vnode && c.$vnode.fnOptions;
398+
});
399+
400+
if (child && child.$vnode.fnOptions[options.keyName]) {
401+
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"));
402+
}
403+
});
404+
}
333405
} // to speed up updates we keep track of branches which have a component with vue-meta info defined
334406
// if _vueMeta = true it has info, if _vueMeta = false a child has info
335407

@@ -373,14 +445,18 @@ function createMixin(Vue, options) {
373445
$root[rootConfigKey].initialized = this.$isServer;
374446

375447
if (!$root[rootConfigKey].initialized) {
376-
ensuredPush($options, 'beforeMount', function () {
377-
var $root = this[rootKey]; // if this Vue-app was server rendered, set the appId to 'ssr'
378-
// only one SSR app per page is supported
448+
if (!$root[rootConfigKey].initializedSsr) {
449+
$root[rootConfigKey].initializedSsr = true;
450+
ensuredPush($options, 'beforeMount', function () {
451+
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
452+
// only one SSR app per page is supported
453+
454+
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
455+
$root[rootConfigKey].appId = options.ssrAppId;
456+
}
457+
});
458+
} // we use the mounted hook here as on page load
379459

380-
if ($root.$el && $root.$el.nodeType === 1 && $root.$el.hasAttribute('data-server-rendered')) {
381-
$root[rootConfigKey].appId = options.ssrAppId;
382-
}
383-
}); // we use the mounted hook here as on page load
384460

385461
ensuredPush($options, 'mounted', function () {
386462
var $root = this[rootKey];
@@ -426,6 +502,7 @@ function createMixin(Vue, options) {
426502

427503

428504
if (this.$isServer) {
505+
/* istanbul ignore next */
429506
return;
430507
} // no need to add this hooks on server side
431508

@@ -448,6 +525,7 @@ function createMixin(Vue, options) {
448525
return;
449526
}
450527

528+
delete this._hasMetaInfo;
451529
this.$nextTick(function () {
452530
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
453531
triggerUpdate(options, _this.$root, 'destroyed');
@@ -502,49 +580,6 @@ function getOptions(options) {
502580
return optionsCopy;
503581
}
504582

505-
/*
506-
* To reduce build size, this file provides simple polyfills without
507-
* overly excessive type checking and without modifying
508-
* the global Array.prototype
509-
* The polyfills are automatically removed in the commonjs build
510-
* Also, only files in client/ & shared/ should use these functions
511-
* files in server/ still use normal js function
512-
*/
513-
function findIndex(array, predicate, thisArg) {
514-
if ( !Array.prototype.findIndex) {
515-
// idx needs to be a Number, for..in returns string
516-
for (var idx = 0; idx < array.length; idx++) {
517-
if (predicate.call(thisArg, array[idx], idx, array)) {
518-
return idx;
519-
}
520-
}
521-
522-
return -1;
523-
}
524-
525-
return array.findIndex(predicate, thisArg);
526-
}
527-
function toArray(arg) {
528-
if ( !Array.from) {
529-
return Array.prototype.slice.call(arg);
530-
}
531-
532-
return Array.from(arg);
533-
}
534-
function includes(array, value) {
535-
if ( !Array.prototype.includes) {
536-
for (var idx in array) {
537-
if (array[idx] === value) {
538-
return true;
539-
}
540-
}
541-
542-
return false;
543-
}
544-
545-
return array.includes(value);
546-
}
547-
548583
var serverSequences = [[/&/g, '&amp;'], [/</g, '&lt;'], [/>/g, '&gt;'], [/"/g, '&quot;'], [/'/g, '&#x27;']];
549584
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
550585

@@ -820,14 +855,13 @@ function getComponentOption(options, component, result) {
820855
// and set to the computed prop $metaInfo in the mixin
821856
// using the computed prop should be a small performance increase
822857
// because Vue caches those internally
823-
var data = $metaInfo || $options[keyName]; // ignore data if its not an object, then we keep our previous result
858+
var data = $metaInfo || $options[keyName]; // only merge data with result when its an object
859+
// eg it could be a function when metaInfo() returns undefined
860+
// dueo to the or statement above
824861

825-
if (!isObject(data)) {
826-
return result;
827-
} // merge with existing options
828-
829-
830-
result = merge(result, data, options);
862+
if (isObject(data)) {
863+
result = merge(result, data, options);
864+
}
831865
} // collect & aggregate child options if deep = true
832866

833867

@@ -1819,8 +1853,8 @@ function install(Vue, options) {
18191853
var index = {
18201854
version: version,
18211855
install: install,
1822-
generate: function generate$1(metaInfo) {
1823-
return generate(metaInfo) ;
1856+
generate: function generate$1(metaInfo, options) {
1857+
return generate(metaInfo, options) ;
18241858
},
18251859
hasMetaInfo: hasMetaInfo
18261860
};

0 commit comments

Comments
 (0)