Skip to content

Commit

Permalink
chore(release): 2.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Feb 26, 2020
1 parent 4336b3e commit b2488c1
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 229 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.3](https://github.com/nuxt/vue-meta/compare/v2.3.2...v2.3.3) (2020-02-26)


### Bug Fixes

* memory leak, use hook events (thanks [#522](https://github.com/nuxt/vue-meta/issues/522)) ([21621e1](https://github.com/nuxt/vue-meta/commit/21621e13f53f45eeef5d75c76ed01c7703ad78b9))
* support once (with skip) client side (fix [#498](https://github.com/nuxt/vue-meta/issues/498)) ([c74c645](https://github.com/nuxt/vue-meta/commit/c74c645d1881e22569a2ea7ac0c903a4f6ee2243))

### [2.3.2](https://github.com/nuxt/vue-meta/compare/v2.3.1...v2.3.2) (2020-01-12)


Expand Down
115 changes: 59 additions & 56 deletions dist/vue-meta.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vue-meta v2.3.2
* vue-meta v2.3.3
* (c) 2020
* - Declan de Wet
* - Sébastien Chopin (@Atinux)
Expand All @@ -14,9 +14,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau

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

var version = "2.3.2";
var version = "2.3.3";

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
Expand Down Expand Up @@ -220,7 +222,7 @@ 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'];
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
var tagProperties = ['once', 'skip', '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

Expand Down Expand Up @@ -325,22 +327,6 @@ function includes(array, value) {
return array.includes(value);
}

function ensureIsArray(arg, key) {
if (!key || !isObject(arg)) {
return isArray(arg) ? arg : [];
}

if (!isArray(arg[key])) {
arg[key] = [];
}

return arg;
}
function ensuredPush(object, key, el) {
ensureIsArray(object, key);
object[key].push(el);
}

function hasMetaInfo(vm) {
vm = vm || this;
return vm && (vm[rootConfigKey] === true || isObject(vm[rootConfigKey]));
Expand Down Expand Up @@ -397,6 +383,8 @@ function createMixin(Vue, options) {

return {
beforeCreate: function beforeCreate() {
var _this2 = this;

var rootKey = '$root';
var $root = this[rootKey];
var $options = this.$options;
Expand Down Expand Up @@ -466,7 +454,7 @@ function createMixin(Vue, options) {
// if computed $metaInfo exists, watch it for updates & trigger a refresh
// when it changes (i.e. automatically handle async actions that affect metaInfo)
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
ensuredPush($options, 'created', function () {
this.$on('hook:created', function () {
this.$watch('$metaInfo', function () {
triggerUpdate(options, this[rootKey], 'watcher');
});
Expand All @@ -484,7 +472,7 @@ function createMixin(Vue, options) {
if (!$root[rootConfigKey].initialized) {
if (!$root[rootConfigKey].initializedSsr) {
$root[rootConfigKey].initializedSsr = true;
ensuredPush($options, 'beforeMount', function () {
this.$on('hook: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

Expand All @@ -495,7 +483,7 @@ function createMixin(Vue, options) {
} // we use the mounted hook here as on page load


ensuredPush($options, 'mounted', function () {
this.$on('hook:mounted', function () {
var $root = this[rootKey];

if (!$root[rootConfigKey].initialized) {
Expand Down Expand Up @@ -535,8 +523,38 @@ function createMixin(Vue, options) {
addNavGuards($root);
}
}
} // do not trigger refresh on the server side
}

this.$on('hook:destroyed', function () {
var _this = this;

// do not trigger refresh:
// - when user configured to not wait for transitions on destroyed
// - when the component doesnt have a parent
// - doesnt have metaInfo defined
if (!this.$parent || !hasMetaInfo(this)) {
return;
}

delete this._hasMetaInfo;
this.$nextTick(function () {
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
triggerUpdate(options, _this.$root, 'destroyed');
return;
} // Wait that element is hidden before refreshing meta tags (to support animations)


var interval = setInterval(function () {
if (_this.$el && _this.$el.offsetParent !== null) {
/* istanbul ignore next line */
return;
}

clearInterval(interval);
triggerUpdate(options, _this.$root, 'destroyed');
}, 50);
});
}); // do not trigger refresh on the server side

if (this.$isServer) {
/* istanbul ignore next */
Expand All @@ -545,41 +563,10 @@ function createMixin(Vue, options) {


updateOnLifecycleHook.forEach(function (lifecycleHook) {
ensuredPush($options, lifecycleHook, function () {
_this2.$on("hook:".concat(lifecycleHook), function () {
triggerUpdate(options, this[rootKey], lifecycleHook);
});
});
},
// TODO: move back into beforeCreate when Vue issue is resolved
destroyed: function destroyed() {
var _this = this;

// do not trigger refresh:
// - when user configured to not wait for transitions on destroyed
// - when the component doesnt have a parent
// - doesnt have metaInfo defined
if (!this.$parent || !hasMetaInfo(this)) {
return;
}

delete this._hasMetaInfo;
this.$nextTick(function () {
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
triggerUpdate(options, _this.$root, 'destroyed');
return;
} // Wait that element is hidden before refreshing meta tags (to support animations)


var interval = setInterval(function () {
if (_this.$el && _this.$el.offsetParent !== null) {
/* istanbul ignore next line */
return;
}

clearInterval(interval);
triggerUpdate(options, _this.$root, 'destroyed');
}, 50);
});
}
};
}
Expand Down Expand Up @@ -617,6 +604,18 @@ function getOptions(options) {
return optionsCopy;
}

function ensureIsArray(arg, key) {
if (!key || !isObject(arg)) {
return isArray(arg) ? arg : [];
}

if (!isArray(arg[key])) {
arg[key] = [];
}

return arg;
}

var serverSequences = [[/&/g, '&amp;'], [/</g, '&lt;'], [/>/g, '&gt;'], [/"/g, '&quot;'], [/'/g, '&#x27;']];
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters

Expand Down Expand Up @@ -1196,7 +1195,11 @@ function updateTag(appId, options, type, tags, head, body) {
}

var newElement = document.createElement(type);
newElement.setAttribute(attribute, appId);

if (!tag.once) {
newElement.setAttribute(attribute, appId);
}

Object.keys(tag).forEach(function (attr) {
/* istanbul ignore next */
if (includes(tagProperties, attr)) {
Expand Down
Loading

0 comments on commit b2488c1

Please sign in to comment.