mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 16:50:34 +03:00
chore(release): 2.4.0
This commit is contained in:
@@ -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.
|
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)
|
### [2.3.4](https://github.com/nuxt/vue-meta/compare/v2.3.3...v2.3.4) (2020-05-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+49
-36
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* vue-meta v2.3.4
|
* vue-meta v2.4.0
|
||||||
* (c) 2020
|
* (c) 2020
|
||||||
* - Declan de Wet
|
* - Declan de Wet
|
||||||
* - Sébastien Chopin (@Atinux)
|
* - Sébastien Chopin (@Atinux)
|
||||||
@@ -14,7 +14,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|||||||
|
|
||||||
var deepmerge = _interopDefault(require('deepmerge'));
|
var deepmerge = _interopDefault(require('deepmerge'));
|
||||||
|
|
||||||
var version = "2.3.4";
|
var version = "2.4.0";
|
||||||
|
|
||||||
function _typeof(obj) {
|
function _typeof(obj) {
|
||||||
"@babel/helpers - typeof";
|
"@babel/helpers - typeof";
|
||||||
@@ -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.");
|
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 (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 i = 0;
|
||||||
|
|
||||||
var F = function () {};
|
var F = function () {};
|
||||||
@@ -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.");
|
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,
|
var normalCompletion = true,
|
||||||
normalCompletion = true,
|
|
||||||
didErr = false,
|
didErr = false,
|
||||||
err;
|
err;
|
||||||
return {
|
return {
|
||||||
@@ -1629,10 +1631,12 @@ function refresh(rootVm, options) {
|
|||||||
* @return {Object} - the attribute generator
|
* @return {Object} - the attribute generator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function attributeGenerator(options, type, data, addSrrAttribute) {
|
function attributeGenerator(options, type, data, _ref) {
|
||||||
var _ref = options || {},
|
var addSsrAttribute = _ref.addSsrAttribute;
|
||||||
attribute = _ref.attribute,
|
|
||||||
ssrAttribute = _ref.ssrAttribute;
|
var _ref2 = options || {},
|
||||||
|
attribute = _ref2.attribute,
|
||||||
|
ssrAttribute = _ref2.ssrAttribute;
|
||||||
|
|
||||||
var attributeStr = '';
|
var attributeStr = '';
|
||||||
|
|
||||||
@@ -1654,7 +1658,7 @@ function attributeGenerator(options, type, data, addSrrAttribute) {
|
|||||||
attributeStr += "".concat(attribute, "=\"").concat(encodeURI(JSON.stringify(data)), "\"");
|
attributeStr += "".concat(attribute, "=\"").concat(encodeURI(JSON.stringify(data)), "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'htmlAttrs' && addSrrAttribute) {
|
if (type === 'htmlAttrs' && addSsrAttribute) {
|
||||||
return "".concat(ssrAttribute).concat(attributeStr ? ' ' : '').concat(attributeStr);
|
return "".concat(ssrAttribute).concat(attributeStr ? ' ' : '').concat(attributeStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1695,6 +1699,8 @@ function tagGenerator(options, type, tags, generatorOptions) {
|
|||||||
|
|
||||||
var _ref2 = generatorOptions || {},
|
var _ref2 = generatorOptions || {},
|
||||||
appId = _ref2.appId,
|
appId = _ref2.appId,
|
||||||
|
_ref2$isSSR = _ref2.isSSR,
|
||||||
|
isSSR = _ref2$isSSR === void 0 ? true : _ref2$isSSR,
|
||||||
_ref2$body = _ref2.body,
|
_ref2$body = _ref2.body,
|
||||||
body = _ref2$body === void 0 ? false : _ref2$body,
|
body = _ref2$body === void 0 ? false : _ref2$body,
|
||||||
_ref2$pbody = _ref2.pbody,
|
_ref2$pbody = _ref2.pbody,
|
||||||
@@ -1724,7 +1730,7 @@ function tagGenerator(options, type, tags, generatorOptions) {
|
|||||||
return tagsStr;
|
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) {
|
for (var attr in tag) {
|
||||||
// these attributes are treated as children on the tag
|
// these attributes are treated as children on the tag
|
||||||
@@ -1779,7 +1785,7 @@ function tagGenerator(options, type, tags, generatorOptions) {
|
|||||||
* @return {Object} - the new injector
|
* @return {Object} - the new injector
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function generateServerInjector(options, metaInfo) {
|
function generateServerInjector(options, metaInfo, globalInjectOptions) {
|
||||||
var serverInjector = {
|
var serverInjector = {
|
||||||
data: metaInfo,
|
data: metaInfo,
|
||||||
extraData: undefined,
|
extraData: undefined,
|
||||||
@@ -1790,25 +1796,25 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
callInjectors: function callInjectors(opts) {
|
callInjectors: function callInjectors(opts) {
|
||||||
var m = this.injectors; // only call title for the head
|
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: {
|
injectors: {
|
||||||
head: function head(ln) {
|
head: function head(ln) {
|
||||||
return serverInjector.callInjectors({
|
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
|
||||||
ln: ln
|
ln: ln
|
||||||
});
|
}));
|
||||||
},
|
},
|
||||||
bodyPrepend: function bodyPrepend(ln) {
|
bodyPrepend: function bodyPrepend(ln) {
|
||||||
return serverInjector.callInjectors({
|
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
|
||||||
ln: ln,
|
ln: ln,
|
||||||
pbody: true
|
pbody: true
|
||||||
});
|
}));
|
||||||
},
|
},
|
||||||
bodyAppend: function bodyAppend(ln) {
|
bodyAppend: function bodyAppend(ln) {
|
||||||
return serverInjector.callInjectors({
|
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
|
||||||
ln: ln,
|
ln: ln,
|
||||||
body: true
|
body: true
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1819,9 +1825,14 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
serverInjector.injectors[type] = {
|
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') {
|
if (type === 'title') {
|
||||||
return titleGenerator(options, type, serverInjector.data[type], arg);
|
return titleGenerator(options, type, serverInjector.data[type], injectOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metaInfoAttributeKeys.includes(type)) {
|
if (metaInfoAttributeKeys.includes(type)) {
|
||||||
@@ -1829,34 +1840,36 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
var data = serverInjector.data[type];
|
var data = serverInjector.data[type];
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
|
var appId = injectOptions.isSSR === false ? '1' : options.ssrAppId;
|
||||||
|
|
||||||
for (var attr in data) {
|
for (var attr in data) {
|
||||||
attributeData[attr] = _defineProperty({}, options.ssrAppId, data[attr]);
|
attributeData[attr] = _defineProperty({}, appId, data[attr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverInjector.extraData) {
|
if (serverInjector.extraData) {
|
||||||
for (var appId in serverInjector.extraData) {
|
for (var _appId in serverInjector.extraData) {
|
||||||
var _data = serverInjector.extraData[appId][type];
|
var _data = serverInjector.extraData[_appId][type];
|
||||||
|
|
||||||
if (_data) {
|
if (_data) {
|
||||||
for (var _attr in _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) {
|
if (serverInjector.extraData) {
|
||||||
for (var _appId in serverInjector.extraData) {
|
for (var _appId2 in serverInjector.extraData) {
|
||||||
var _data2 = serverInjector.extraData[_appId][type];
|
var _data2 = serverInjector.extraData[_appId2][type];
|
||||||
var extraStr = tagGenerator(options, type, _data2, _objectSpread2({
|
var extraStr = tagGenerator(options, type, _data2, _objectSpread2({
|
||||||
appId: _appId
|
appId: _appId2
|
||||||
}, arg));
|
}, injectOptions));
|
||||||
str = "".concat(str).concat(extraStr);
|
str = "".concat(str).concat(extraStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1883,7 +1896,7 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
* @return {Object} - server meta info with `toString` methods
|
* @return {Object} - server meta info with `toString` methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function inject(rootVm, options) {
|
function inject(rootVm, options, injectOptions) {
|
||||||
// make sure vue-meta was initiated
|
// make sure vue-meta was initiated
|
||||||
if (!rootVm[rootConfigKey]) {
|
if (!rootVm[rootConfigKey]) {
|
||||||
showWarningNotSupported();
|
showWarningNotSupported();
|
||||||
@@ -1894,7 +1907,7 @@ function inject(rootVm, options) {
|
|||||||
var rawInfo = getComponentMetaInfo(options, rootVm);
|
var rawInfo = getComponentMetaInfo(options, rootVm);
|
||||||
var metaInfo = getMetaInfo(options, rawInfo, serverSequences, rootVm); // generate server injector
|
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();
|
var appsMetaInfo = getAppsMetaInfo();
|
||||||
|
|
||||||
@@ -1950,8 +1963,8 @@ function $meta(options) {
|
|||||||
refresh: function refresh$1() {
|
refresh: function refresh$1() {
|
||||||
return refresh($root, options);
|
return refresh($root, options);
|
||||||
},
|
},
|
||||||
inject: function inject$1() {
|
inject: function inject$1(injectOptions) {
|
||||||
return inject($root, options) ;
|
return inject($root, options, injectOptions) ;
|
||||||
},
|
},
|
||||||
pause: function pause$1() {
|
pause: function pause$1() {
|
||||||
return pause($root);
|
return pause($root);
|
||||||
|
|||||||
Vendored
+9
-7
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* vue-meta v2.3.4
|
* vue-meta v2.4.0
|
||||||
* (c) 2020
|
* (c) 2020
|
||||||
* - Declan de Wet
|
* - Declan de Wet
|
||||||
* - Sébastien Chopin (@Atinux)
|
* - Sébastien Chopin (@Atinux)
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
import deepmerge from 'deepmerge';
|
import deepmerge from 'deepmerge';
|
||||||
|
|
||||||
var version = "2.3.4";
|
var version = "2.4.0";
|
||||||
|
|
||||||
function _typeof(obj) {
|
function _typeof(obj) {
|
||||||
"@babel/helpers - typeof";
|
"@babel/helpers - typeof";
|
||||||
@@ -45,9 +45,12 @@ function _arrayLikeToArray(arr, len) {
|
|||||||
return arr2;
|
return arr2;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _createForOfIteratorHelper(o) {
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
||||||
|
var it;
|
||||||
|
|
||||||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
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 i = 0;
|
||||||
|
|
||||||
var F = function () {};
|
var F = function () {};
|
||||||
@@ -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.");
|
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,
|
var normalCompletion = true,
|
||||||
normalCompletion = true,
|
|
||||||
didErr = false,
|
didErr = false,
|
||||||
err;
|
err;
|
||||||
return {
|
return {
|
||||||
@@ -1587,7 +1589,7 @@ function $meta(options) {
|
|||||||
refresh: function refresh$1() {
|
refresh: function refresh$1() {
|
||||||
return refresh($root, options);
|
return refresh($root, options);
|
||||||
},
|
},
|
||||||
inject: function inject() {
|
inject: function inject(injectOptions) {
|
||||||
return showWarningNotSupportedInBrowserBundle('inject');
|
return showWarningNotSupportedInBrowserBundle('inject');
|
||||||
},
|
},
|
||||||
pause: function pause$1() {
|
pause: function pause$1() {
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+49
-36
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* vue-meta v2.3.4
|
* vue-meta v2.4.0
|
||||||
* (c) 2020
|
* (c) 2020
|
||||||
* - Declan de Wet
|
* - Declan de Wet
|
||||||
* - Sébastien Chopin (@Atinux)
|
* - Sébastien Chopin (@Atinux)
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
import deepmerge from 'deepmerge';
|
import deepmerge from 'deepmerge';
|
||||||
|
|
||||||
var version = "2.3.4";
|
var version = "2.4.0";
|
||||||
|
|
||||||
function _typeof(obj) {
|
function _typeof(obj) {
|
||||||
"@babel/helpers - typeof";
|
"@babel/helpers - typeof";
|
||||||
@@ -110,9 +110,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.");
|
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 (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 i = 0;
|
||||||
|
|
||||||
var F = function () {};
|
var F = function () {};
|
||||||
@@ -138,8 +141,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.");
|
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,
|
var normalCompletion = true,
|
||||||
normalCompletion = true,
|
|
||||||
didErr = false,
|
didErr = false,
|
||||||
err;
|
err;
|
||||||
return {
|
return {
|
||||||
@@ -1625,10 +1627,12 @@ function refresh(rootVm, options) {
|
|||||||
* @return {Object} - the attribute generator
|
* @return {Object} - the attribute generator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function attributeGenerator(options, type, data, addSrrAttribute) {
|
function attributeGenerator(options, type, data, _ref) {
|
||||||
var _ref = options || {},
|
var addSsrAttribute = _ref.addSsrAttribute;
|
||||||
attribute = _ref.attribute,
|
|
||||||
ssrAttribute = _ref.ssrAttribute;
|
var _ref2 = options || {},
|
||||||
|
attribute = _ref2.attribute,
|
||||||
|
ssrAttribute = _ref2.ssrAttribute;
|
||||||
|
|
||||||
var attributeStr = '';
|
var attributeStr = '';
|
||||||
|
|
||||||
@@ -1650,7 +1654,7 @@ function attributeGenerator(options, type, data, addSrrAttribute) {
|
|||||||
attributeStr += "".concat(attribute, "=\"").concat(encodeURI(JSON.stringify(data)), "\"");
|
attributeStr += "".concat(attribute, "=\"").concat(encodeURI(JSON.stringify(data)), "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'htmlAttrs' && addSrrAttribute) {
|
if (type === 'htmlAttrs' && addSsrAttribute) {
|
||||||
return "".concat(ssrAttribute).concat(attributeStr ? ' ' : '').concat(attributeStr);
|
return "".concat(ssrAttribute).concat(attributeStr ? ' ' : '').concat(attributeStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1691,6 +1695,8 @@ function tagGenerator(options, type, tags, generatorOptions) {
|
|||||||
|
|
||||||
var _ref2 = generatorOptions || {},
|
var _ref2 = generatorOptions || {},
|
||||||
appId = _ref2.appId,
|
appId = _ref2.appId,
|
||||||
|
_ref2$isSSR = _ref2.isSSR,
|
||||||
|
isSSR = _ref2$isSSR === void 0 ? true : _ref2$isSSR,
|
||||||
_ref2$body = _ref2.body,
|
_ref2$body = _ref2.body,
|
||||||
body = _ref2$body === void 0 ? false : _ref2$body,
|
body = _ref2$body === void 0 ? false : _ref2$body,
|
||||||
_ref2$pbody = _ref2.pbody,
|
_ref2$pbody = _ref2.pbody,
|
||||||
@@ -1720,7 +1726,7 @@ function tagGenerator(options, type, tags, generatorOptions) {
|
|||||||
return tagsStr;
|
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) {
|
for (var attr in tag) {
|
||||||
// these attributes are treated as children on the tag
|
// these attributes are treated as children on the tag
|
||||||
@@ -1775,7 +1781,7 @@ function tagGenerator(options, type, tags, generatorOptions) {
|
|||||||
* @return {Object} - the new injector
|
* @return {Object} - the new injector
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function generateServerInjector(options, metaInfo) {
|
function generateServerInjector(options, metaInfo, globalInjectOptions) {
|
||||||
var serverInjector = {
|
var serverInjector = {
|
||||||
data: metaInfo,
|
data: metaInfo,
|
||||||
extraData: undefined,
|
extraData: undefined,
|
||||||
@@ -1786,25 +1792,25 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
callInjectors: function callInjectors(opts) {
|
callInjectors: function callInjectors(opts) {
|
||||||
var m = this.injectors; // only call title for the head
|
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: {
|
injectors: {
|
||||||
head: function head(ln) {
|
head: function head(ln) {
|
||||||
return serverInjector.callInjectors({
|
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
|
||||||
ln: ln
|
ln: ln
|
||||||
});
|
}));
|
||||||
},
|
},
|
||||||
bodyPrepend: function bodyPrepend(ln) {
|
bodyPrepend: function bodyPrepend(ln) {
|
||||||
return serverInjector.callInjectors({
|
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
|
||||||
ln: ln,
|
ln: ln,
|
||||||
pbody: true
|
pbody: true
|
||||||
});
|
}));
|
||||||
},
|
},
|
||||||
bodyAppend: function bodyAppend(ln) {
|
bodyAppend: function bodyAppend(ln) {
|
||||||
return serverInjector.callInjectors({
|
return serverInjector.callInjectors(_objectSpread2(_objectSpread2({}, globalInjectOptions), {}, {
|
||||||
ln: ln,
|
ln: ln,
|
||||||
body: true
|
body: true
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1815,9 +1821,14 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
serverInjector.injectors[type] = {
|
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') {
|
if (type === 'title') {
|
||||||
return titleGenerator(options, type, serverInjector.data[type], arg);
|
return titleGenerator(options, type, serverInjector.data[type], injectOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metaInfoAttributeKeys.includes(type)) {
|
if (metaInfoAttributeKeys.includes(type)) {
|
||||||
@@ -1825,34 +1836,36 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
var data = serverInjector.data[type];
|
var data = serverInjector.data[type];
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
|
var appId = injectOptions.isSSR === false ? '1' : options.ssrAppId;
|
||||||
|
|
||||||
for (var attr in data) {
|
for (var attr in data) {
|
||||||
attributeData[attr] = _defineProperty({}, options.ssrAppId, data[attr]);
|
attributeData[attr] = _defineProperty({}, appId, data[attr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverInjector.extraData) {
|
if (serverInjector.extraData) {
|
||||||
for (var appId in serverInjector.extraData) {
|
for (var _appId in serverInjector.extraData) {
|
||||||
var _data = serverInjector.extraData[appId][type];
|
var _data = serverInjector.extraData[_appId][type];
|
||||||
|
|
||||||
if (_data) {
|
if (_data) {
|
||||||
for (var _attr in _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) {
|
if (serverInjector.extraData) {
|
||||||
for (var _appId in serverInjector.extraData) {
|
for (var _appId2 in serverInjector.extraData) {
|
||||||
var _data2 = serverInjector.extraData[_appId][type];
|
var _data2 = serverInjector.extraData[_appId2][type];
|
||||||
var extraStr = tagGenerator(options, type, _data2, _objectSpread2({
|
var extraStr = tagGenerator(options, type, _data2, _objectSpread2({
|
||||||
appId: _appId
|
appId: _appId2
|
||||||
}, arg));
|
}, injectOptions));
|
||||||
str = "".concat(str).concat(extraStr);
|
str = "".concat(str).concat(extraStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1879,7 +1892,7 @@ function generateServerInjector(options, metaInfo) {
|
|||||||
* @return {Object} - server meta info with `toString` methods
|
* @return {Object} - server meta info with `toString` methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function inject(rootVm, options) {
|
function inject(rootVm, options, injectOptions) {
|
||||||
// make sure vue-meta was initiated
|
// make sure vue-meta was initiated
|
||||||
if (!rootVm[rootConfigKey]) {
|
if (!rootVm[rootConfigKey]) {
|
||||||
showWarningNotSupported();
|
showWarningNotSupported();
|
||||||
@@ -1890,7 +1903,7 @@ function inject(rootVm, options) {
|
|||||||
var rawInfo = getComponentMetaInfo(options, rootVm);
|
var rawInfo = getComponentMetaInfo(options, rootVm);
|
||||||
var metaInfo = getMetaInfo(options, rawInfo, serverSequences, rootVm); // generate server injector
|
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();
|
var appsMetaInfo = getAppsMetaInfo();
|
||||||
|
|
||||||
@@ -1946,8 +1959,8 @@ function $meta(options) {
|
|||||||
refresh: function refresh$1() {
|
refresh: function refresh$1() {
|
||||||
return refresh($root, options);
|
return refresh($root, options);
|
||||||
},
|
},
|
||||||
inject: function inject$1() {
|
inject: function inject$1(injectOptions) {
|
||||||
return inject($root, options) ;
|
return inject($root, options, injectOptions) ;
|
||||||
},
|
},
|
||||||
pause: function pause$1() {
|
pause: function pause$1() {
|
||||||
return pause($root);
|
return pause($root);
|
||||||
|
|||||||
Vendored
+9
-7
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* vue-meta v2.3.4
|
* vue-meta v2.4.0
|
||||||
* (c) 2020
|
* (c) 2020
|
||||||
* - Declan de Wet
|
* - Declan de Wet
|
||||||
* - Sébastien Chopin (@Atinux)
|
* - Sébastien Chopin (@Atinux)
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
(global = global || self, global.VueMeta = factory());
|
(global = global || self, global.VueMeta = factory());
|
||||||
}(this, (function () { 'use strict';
|
}(this, (function () { 'use strict';
|
||||||
|
|
||||||
var version = "2.3.4";
|
var version = "2.4.0";
|
||||||
|
|
||||||
function _typeof(obj) {
|
function _typeof(obj) {
|
||||||
"@babel/helpers - typeof";
|
"@babel/helpers - typeof";
|
||||||
@@ -49,9 +49,12 @@
|
|||||||
return arr2;
|
return arr2;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _createForOfIteratorHelper(o) {
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
||||||
|
var it;
|
||||||
|
|
||||||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
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 i = 0;
|
||||||
|
|
||||||
var F = function () {};
|
var F = function () {};
|
||||||
@@ -77,8 +80,7 @@
|
|||||||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
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,
|
var normalCompletion = true,
|
||||||
normalCompletion = true,
|
|
||||||
didErr = false,
|
didErr = false,
|
||||||
err;
|
err;
|
||||||
return {
|
return {
|
||||||
@@ -1678,7 +1680,7 @@
|
|||||||
refresh: function refresh$1() {
|
refresh: function refresh$1() {
|
||||||
return refresh($root, options);
|
return refresh($root, options);
|
||||||
},
|
},
|
||||||
inject: function inject() {
|
inject: function inject(injectOptions) {
|
||||||
return showWarningNotSupportedInBrowserBundle('inject');
|
return showWarningNotSupportedInBrowserBundle('inject');
|
||||||
},
|
},
|
||||||
pause: function pause$1() {
|
pause: function pause$1() {
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-meta",
|
"name": "vue-meta",
|
||||||
"version": "2.3.4",
|
"version": "2.4.0",
|
||||||
"description": "Manage HTML metadata in Vue.js components with ssr support",
|
"description": "Manage HTML metadata in Vue.js components with ssr support",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"attribute",
|
"attribute",
|
||||||
|
|||||||
Reference in New Issue
Block a user