Skip to content

Commit 14eb4af

Browse files
committed
chore(release): 2.4.0
1 parent 9f17654 commit 14eb4af

8 files changed

+128
-91
lines changed

Diff for: CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
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.4.0](https://github.com/nuxt/vue-meta/compare/v2.3.4...v2.4.0) (2020-06-10)
6+
7+
8+
### Features
9+
10+
* add support for global inject options ([#568](https://github.com/nuxt/vue-meta/issues/568)) ([8b02eb2](https://github.com/nuxt/vue-meta/commit/8b02eb2ac6693b07caeb76efab106af1d4b92988))
11+
512
### [2.3.4](https://github.com/nuxt/vue-meta/compare/v2.3.3...v2.3.4) (2020-05-26)
613

714

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

+49-36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-meta v2.3.4
2+
* vue-meta v2.4.0
33
* (c) 2020
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.4";
17+
var version = "2.4.0";
1818

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

117-
function _createForOfIteratorHelper(o) {
117+
function _createForOfIteratorHelper(o, allowArrayLike) {
118+
var it;
119+
118120
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
119-
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
121+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
122+
if (it) o = it;
120123
var i = 0;
121124

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

145-
var it,
146-
normalCompletion = true,
148+
var normalCompletion = true,
147149
didErr = false,
148150
err;
149151
return {
@@ -1629,10 +1631,12 @@ function refresh(rootVm, options) {
16291631
* @return {Object} - the attribute generator
16301632
*/
16311633

1632-
function attributeGenerator(options, type, data, addSrrAttribute) {
1633-
var _ref = options || {},
1634-
attribute = _ref.attribute,
1635-
ssrAttribute = _ref.ssrAttribute;
1634+
function attributeGenerator(options, type, data, _ref) {
1635+
var addSsrAttribute = _ref.addSsrAttribute;
1636+
1637+
var _ref2 = options || {},
1638+
attribute = _ref2.attribute,
1639+
ssrAttribute = _ref2.ssrAttribute;
16361640

16371641
var attributeStr = '';
16381642

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

1657-
if (type === 'htmlAttrs' && addSrrAttribute) {
1661+
if (type === 'htmlAttrs' && addSsrAttribute) {
16581662
return "".concat(ssrAttribute).concat(attributeStr ? ' ' : '').concat(attributeStr);
16591663
}
16601664

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

16961700
var _ref2 = generatorOptions || {},
16971701
appId = _ref2.appId,
1702+
_ref2$isSSR = _ref2.isSSR,
1703+
isSSR = _ref2$isSSR === void 0 ? true : _ref2$isSSR,
16981704
_ref2$body = _ref2.body,
16991705
body = _ref2$body === void 0 ? false : _ref2$body,
17001706
_ref2$pbody = _ref2.pbody,
@@ -1724,7 +1730,7 @@ function tagGenerator(options, type, tags, generatorOptions) {
17241730
return tagsStr;
17251731
}
17261732

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

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

1782-
function generateServerInjector(options, metaInfo) {
1788+
function generateServerInjector(options, metaInfo, globalInjectOptions) {
17831789
var serverInjector = {
17841790
data: metaInfo,
17851791
extraData: undefined,
@@ -1790,25 +1796,25 @@ function generateServerInjector(options, metaInfo) {
17901796
callInjectors: function callInjectors(opts) {
17911797
var m = this.injectors; // only call title for the head
17921798

1793-
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);
1799+
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);
17941800
},
17951801
injectors: {
17961802
head: function head(ln) {
1797-
return serverInjector.callInjectors({
1803+
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
17981804
ln: ln
1799-
});
1805+
}));
18001806
},
18011807
bodyPrepend: function bodyPrepend(ln) {
1802-
return serverInjector.callInjectors({
1808+
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
18031809
ln: ln,
18041810
pbody: true
1805-
});
1811+
}));
18061812
},
18071813
bodyAppend: function bodyAppend(ln) {
1808-
return serverInjector.callInjectors({
1814+
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
18091815
ln: ln,
18101816
body: true
1811-
});
1817+
}));
18121818
}
18131819
}
18141820
};
@@ -1819,44 +1825,51 @@ function generateServerInjector(options, metaInfo) {
18191825
}
18201826

18211827
serverInjector.injectors[type] = {
1822-
text: function text(arg) {
1828+
text: function text(injectOptions) {
1829+
var addSsrAttribute = injectOptions === true;
1830+
injectOptions = _objectSpread2(_objectSpread2({
1831+
addSsrAttribute: addSsrAttribute
1832+
}, globalInjectOptions), injectOptions);
1833+
18231834
if (type === 'title') {
1824-
return titleGenerator(options, type, serverInjector.data[type], arg);
1835+
return titleGenerator(options, type, serverInjector.data[type], injectOptions);
18251836
}
18261837

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

18311842
if (data) {
1843+
var appId = injectOptions.isSSR === false ? '1' : options.ssrAppId;
1844+
18321845
for (var attr in data) {
1833-
attributeData[attr] = _defineProperty({}, options.ssrAppId, data[attr]);
1846+
attributeData[attr] = _defineProperty({}, appId, data[attr]);
18341847
}
18351848
}
18361849

18371850
if (serverInjector.extraData) {
1838-
for (var appId in serverInjector.extraData) {
1839-
var _data = serverInjector.extraData[appId][type];
1851+
for (var _appId in serverInjector.extraData) {
1852+
var _data = serverInjector.extraData[_appId][type];
18401853

18411854
if (_data) {
18421855
for (var _attr in _data) {
1843-
attributeData[_attr] = _objectSpread2(_objectSpread2({}, attributeData[_attr]), {}, _defineProperty({}, appId, _data[_attr]));
1856+
attributeData[_attr] = _objectSpread2(_objectSpread2({}, attributeData[_attr]), {}, _defineProperty({}, _appId, _data[_attr]));
18441857
}
18451858
}
18461859
}
18471860
}
18481861

1849-
return attributeGenerator(options, type, attributeData, arg);
1862+
return attributeGenerator(options, type, attributeData, injectOptions);
18501863
}
18511864

1852-
var str = tagGenerator(options, type, serverInjector.data[type], arg);
1865+
var str = tagGenerator(options, type, serverInjector.data[type], injectOptions);
18531866

18541867
if (serverInjector.extraData) {
1855-
for (var _appId in serverInjector.extraData) {
1856-
var _data2 = serverInjector.extraData[_appId][type];
1868+
for (var _appId2 in serverInjector.extraData) {
1869+
var _data2 = serverInjector.extraData[_appId2][type];
18571870
var extraStr = tagGenerator(options, type, _data2, _objectSpread2({
1858-
appId: _appId
1859-
}, arg));
1871+
appId: _appId2
1872+
}, injectOptions));
18601873
str = "".concat(str).concat(extraStr);
18611874
}
18621875
}
@@ -1883,7 +1896,7 @@ function generateServerInjector(options, metaInfo) {
18831896
* @return {Object} - server meta info with `toString` methods
18841897
*/
18851898

1886-
function inject(rootVm, options) {
1899+
function inject(rootVm, options, injectOptions) {
18871900
// make sure vue-meta was initiated
18881901
if (!rootVm[rootConfigKey]) {
18891902
showWarningNotSupported();
@@ -1894,7 +1907,7 @@ function inject(rootVm, options) {
18941907
var rawInfo = getComponentMetaInfo(options, rootVm);
18951908
var metaInfo = getMetaInfo(options, rawInfo, serverSequences, rootVm); // generate server injector
18961909

1897-
var serverInjector = generateServerInjector(options, metaInfo); // add meta info from additional apps
1910+
var serverInjector = generateServerInjector(options, metaInfo, injectOptions); // add meta info from additional apps
18981911

18991912
var appsMetaInfo = getAppsMetaInfo();
19001913

@@ -1950,8 +1963,8 @@ function $meta(options) {
19501963
refresh: function refresh$1() {
19511964
return refresh($root, options);
19521965
},
1953-
inject: function inject$1() {
1954-
return inject($root, options) ;
1966+
inject: function inject$1(injectOptions) {
1967+
return inject($root, options, injectOptions) ;
19551968
},
19561969
pause: function pause$1() {
19571970
return pause($root);

Diff for: dist/vue-meta.esm.browser.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-meta v2.3.4
2+
* vue-meta v2.4.0
33
* (c) 2020
44
* - Declan de Wet
55
* - Sébastien Chopin (@Atinux)
@@ -10,7 +10,7 @@
1010

1111
import deepmerge from 'deepmerge';
1212

13-
var version = "2.3.4";
13+
var version = "2.4.0";
1414

1515
function _typeof(obj) {
1616
"@babel/helpers - typeof";
@@ -45,9 +45,12 @@ function _arrayLikeToArray(arr, len) {
4545
return arr2;
4646
}
4747

48-
function _createForOfIteratorHelper(o) {
48+
function _createForOfIteratorHelper(o, allowArrayLike) {
49+
var it;
50+
4951
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
50-
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
52+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
53+
if (it) o = it;
5154
var i = 0;
5255

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

76-
var it,
77-
normalCompletion = true,
79+
var normalCompletion = true,
7880
didErr = false,
7981
err;
8082
return {
@@ -1587,7 +1589,7 @@ function $meta(options) {
15871589
refresh: function refresh$1() {
15881590
return refresh($root, options);
15891591
},
1590-
inject: function inject() {
1592+
inject: function inject(injectOptions) {
15911593
return showWarningNotSupportedInBrowserBundle('inject');
15921594
},
15931595
pause: function pause$1() {

0 commit comments

Comments
 (0)