Skip to content

Commit

Permalink
chore(release): 2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Jun 10, 2020
1 parent 9f17654 commit 14eb4af
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 91 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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.4.0](https://github.com/nuxt/vue-meta/compare/v2.3.4...v2.4.0) (2020-06-10)


### Features

* add support for global inject options ([#568](https://github.com/nuxt/vue-meta/issues/568)) ([8b02eb2](https://github.com/nuxt/vue-meta/commit/8b02eb2ac6693b07caeb76efab106af1d4b92988))

### [2.3.4](https://github.com/nuxt/vue-meta/compare/v2.3.3...v2.3.4) (2020-05-26)


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

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

var version = "2.3.4";
var version = "2.4.0";

function _typeof(obj) {
"@babel/helpers - typeof";
Expand Down Expand Up @@ -114,9 +114,12 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _createForOfIteratorHelper(o) {
function _createForOfIteratorHelper(o, allowArrayLike) {
var it;

if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;

var F = function () {};
Expand All @@ -142,8 +145,7 @@ function _createForOfIteratorHelper(o) {
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

var it,
normalCompletion = true,
var normalCompletion = true,
didErr = false,
err;
return {
Expand Down Expand Up @@ -1629,10 +1631,12 @@ function refresh(rootVm, options) {
* @return {Object} - the attribute generator
*/

function attributeGenerator(options, type, data, addSrrAttribute) {
var _ref = options || {},
attribute = _ref.attribute,
ssrAttribute = _ref.ssrAttribute;
function attributeGenerator(options, type, data, _ref) {
var addSsrAttribute = _ref.addSsrAttribute;

var _ref2 = options || {},
attribute = _ref2.attribute,
ssrAttribute = _ref2.ssrAttribute;

var attributeStr = '';

Expand All @@ -1654,7 +1658,7 @@ function attributeGenerator(options, type, data, addSrrAttribute) {
attributeStr += "".concat(attribute, "=\"").concat(encodeURI(JSON.stringify(data)), "\"");
}

if (type === 'htmlAttrs' && addSrrAttribute) {
if (type === 'htmlAttrs' && addSsrAttribute) {
return "".concat(ssrAttribute).concat(attributeStr ? ' ' : '').concat(attributeStr);
}

Expand Down Expand Up @@ -1695,6 +1699,8 @@ function tagGenerator(options, type, tags, generatorOptions) {

var _ref2 = generatorOptions || {},
appId = _ref2.appId,
_ref2$isSSR = _ref2.isSSR,
isSSR = _ref2$isSSR === void 0 ? true : _ref2$isSSR,
_ref2$body = _ref2.body,
body = _ref2$body === void 0 ? false : _ref2$body,
_ref2$pbody = _ref2.pbody,
Expand Down Expand Up @@ -1724,7 +1730,7 @@ function tagGenerator(options, type, tags, generatorOptions) {
return tagsStr;
}

var attrs = tag.once ? '' : " ".concat(attribute, "=\"").concat(appId || ssrAppId, "\""); // build a string containing all attributes of this tag
var attrs = tag.once ? '' : " ".concat(attribute, "=\"").concat(appId || (isSSR === false ? '1' : ssrAppId), "\""); // build a string containing all attributes of this tag

for (var attr in tag) {
// these attributes are treated as children on the tag
Expand Down Expand Up @@ -1779,7 +1785,7 @@ function tagGenerator(options, type, tags, generatorOptions) {
* @return {Object} - the new injector
*/

function generateServerInjector(options, metaInfo) {
function generateServerInjector(options, metaInfo, globalInjectOptions) {
var serverInjector = {
data: metaInfo,
extraData: undefined,
Expand All @@ -1790,25 +1796,25 @@ function generateServerInjector(options, metaInfo) {
callInjectors: function callInjectors(opts) {
var m = this.injectors; // only call title for the head

return (opts.body || opts.pbody ? '' : m.title.text(opts)) + m.meta.text(opts) + m.link.text(opts) + m.style.text(opts) + m.script.text(opts) + m.noscript.text(opts);
return (opts.body || opts.pbody ? '' : m.title.text(opts)) + m.meta.text(opts) + m.base.text(opts) + m.link.text(opts) + m.style.text(opts) + m.script.text(opts) + m.noscript.text(opts);
},
injectors: {
head: function head(ln) {
return serverInjector.callInjectors({
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
ln: ln
});
}));
},
bodyPrepend: function bodyPrepend(ln) {
return serverInjector.callInjectors({
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
ln: ln,
pbody: true
});
}));
},
bodyAppend: function bodyAppend(ln) {
return serverInjector.callInjectors({
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
ln: ln,
body: true
});
}));
}
}
};
Expand All @@ -1819,44 +1825,51 @@ function generateServerInjector(options, metaInfo) {
}

serverInjector.injectors[type] = {
text: function text(arg) {
text: function text(injectOptions) {
var addSsrAttribute = injectOptions === true;
injectOptions = _objectSpread2(_objectSpread2({
addSsrAttribute: addSsrAttribute
}, globalInjectOptions), injectOptions);

if (type === 'title') {
return titleGenerator(options, type, serverInjector.data[type], arg);
return titleGenerator(options, type, serverInjector.data[type], injectOptions);
}

if (metaInfoAttributeKeys.includes(type)) {
var attributeData = {};
var data = serverInjector.data[type];

if (data) {
var appId = injectOptions.isSSR === false ? '1' : options.ssrAppId;

for (var attr in data) {
attributeData[attr] = _defineProperty({}, options.ssrAppId, data[attr]);
attributeData[attr] = _defineProperty({}, appId, data[attr]);
}
}

if (serverInjector.extraData) {
for (var appId in serverInjector.extraData) {
var _data = serverInjector.extraData[appId][type];
for (var _appId in serverInjector.extraData) {
var _data = serverInjector.extraData[_appId][type];

if (_data) {
for (var _attr in _data) {
attributeData[_attr] = _objectSpread2(_objectSpread2({}, attributeData[_attr]), {}, _defineProperty({}, appId, _data[_attr]));
attributeData[_attr] = _objectSpread2(_objectSpread2({}, attributeData[_attr]), {}, _defineProperty({}, _appId, _data[_attr]));
}
}
}
}

return attributeGenerator(options, type, attributeData, arg);
return attributeGenerator(options, type, attributeData, injectOptions);
}

var str = tagGenerator(options, type, serverInjector.data[type], arg);
var str = tagGenerator(options, type, serverInjector.data[type], injectOptions);

if (serverInjector.extraData) {
for (var _appId in serverInjector.extraData) {
var _data2 = serverInjector.extraData[_appId][type];
for (var _appId2 in serverInjector.extraData) {
var _data2 = serverInjector.extraData[_appId2][type];
var extraStr = tagGenerator(options, type, _data2, _objectSpread2({
appId: _appId
}, arg));
appId: _appId2
}, injectOptions));
str = "".concat(str).concat(extraStr);
}
}
Expand All @@ -1883,7 +1896,7 @@ function generateServerInjector(options, metaInfo) {
* @return {Object} - server meta info with `toString` methods
*/

function inject(rootVm, options) {
function inject(rootVm, options, injectOptions) {
// make sure vue-meta was initiated
if (!rootVm[rootConfigKey]) {
showWarningNotSupported();
Expand All @@ -1894,7 +1907,7 @@ function inject(rootVm, options) {
var rawInfo = getComponentMetaInfo(options, rootVm);
var metaInfo = getMetaInfo(options, rawInfo, serverSequences, rootVm); // generate server injector

var serverInjector = generateServerInjector(options, metaInfo); // add meta info from additional apps
var serverInjector = generateServerInjector(options, metaInfo, injectOptions); // add meta info from additional apps

var appsMetaInfo = getAppsMetaInfo();

Expand Down Expand Up @@ -1950,8 +1963,8 @@ function $meta(options) {
refresh: function refresh$1() {
return refresh($root, options);
},
inject: function inject$1() {
return inject($root, options) ;
inject: function inject$1(injectOptions) {
return inject($root, options, injectOptions) ;
},
pause: function pause$1() {
return pause($root);
Expand Down
16 changes: 9 additions & 7 deletions dist/vue-meta.esm.browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vue-meta v2.3.4
* vue-meta v2.4.0
* (c) 2020
* - Declan de Wet
* - Sébastien Chopin (@Atinux)
Expand All @@ -10,7 +10,7 @@

import deepmerge from 'deepmerge';

var version = "2.3.4";
var version = "2.4.0";

function _typeof(obj) {
"@babel/helpers - typeof";
Expand Down Expand Up @@ -45,9 +45,12 @@ function _arrayLikeToArray(arr, len) {
return arr2;
}

function _createForOfIteratorHelper(o) {
function _createForOfIteratorHelper(o, allowArrayLike) {
var it;

if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;

var F = function () {};
Expand All @@ -73,8 +76,7 @@ function _createForOfIteratorHelper(o) {
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

var it,
normalCompletion = true,
var normalCompletion = true,
didErr = false,
err;
return {
Expand Down Expand Up @@ -1587,7 +1589,7 @@ function $meta(options) {
refresh: function refresh$1() {
return refresh($root, options);
},
inject: function inject() {
inject: function inject(injectOptions) {
return showWarningNotSupportedInBrowserBundle('inject');
},
pause: function pause$1() {
Expand Down
Loading

0 comments on commit 14eb4af

Please sign in to comment.