nuxt-jsonld
Advanced tools
Comparing version 1.5.5 to 1.5.6
declare type JsonldMixin = { | ||
beforeCreate: () => void; | ||
created?: () => void; | ||
beforeCreate?: () => void; | ||
}; | ||
declare const _default: () => JsonldMixin; | ||
export default _default; |
@@ -8,20 +8,30 @@ "use strict"; | ||
exports.default = (function () { | ||
return { | ||
beforeCreate: function () { | ||
var _this = this; | ||
var _a, _b; | ||
if (this.$options && typeof this.$options.jsonld === 'function') { | ||
var originalHead_1 = (_a = this.$options.head) !== null && _a !== void 0 ? _a : (_b = this.$options.computed) === null || _b === void 0 ? void 0 : _b.$metaInfo; | ||
this.$options.head = function () { | ||
return mergeHead_1.default.call(_this, originalHead_1); | ||
}; | ||
// for @nuxt/bridge | ||
if (this.$options.computed) { | ||
this.$options.computed.$metaInfo = function () { | ||
// @ts-ignore | ||
var isGenerating = process.server === undefined && process.client === undefined; | ||
return isGenerating | ||
? { | ||
// When generating static site, we need to use `created` to access `this` of the component. | ||
created: function () { | ||
var _a, _b; | ||
if (this.$options && typeof this.$options.jsonld === 'function') { | ||
var originalHead = (_a = this.$options.head) !== null && _a !== void 0 ? _a : (_b = this.$options.computed) === null || _b === void 0 ? void 0 : _b.$metaInfo; | ||
var vApp = this.$meta().addApp('nuxt-jsonld'); | ||
var initialHead = mergeHead_1.default.call(this, originalHead); | ||
vApp.set(initialHead); | ||
} | ||
}, | ||
} | ||
: { | ||
// On server and client side, we need to use beforeCreate to update head function before it is called | ||
beforeCreate: function () { | ||
var _this = this; | ||
var _a, _b; | ||
if (this.$options && typeof this.$options.jsonld === 'function') { | ||
var originalHead_1 = (_a = this.$options.head) !== null && _a !== void 0 ? _a : (_b = this.$options.computed) === null || _b === void 0 ? void 0 : _b.$metaInfo; | ||
this.$options.head = function () { | ||
return mergeHead_1.default.call(_this, originalHead_1); | ||
}; | ||
} | ||
} | ||
}, | ||
}; | ||
}, | ||
}; | ||
}); |
{ | ||
"name": "nuxt-jsonld", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"description": "manage jsonld in Vue component.", | ||
@@ -24,3 +24,3 @@ "main": "lib/index.js", | ||
"preversion": "npm run build", | ||
"release": "semantic-release", | ||
"release": "shipjs prepare", | ||
"lint": "eslint --ext .ts,.js .", | ||
@@ -37,8 +37,2 @@ "lint:fix": "eslint --ext .ts,.js --fix ." | ||
"devDependencies": { | ||
"@semantic-release/changelog": "^6.0.0", | ||
"@semantic-release/commit-analyzer": "^9.0.1", | ||
"@semantic-release/git": "^10.0.0", | ||
"@semantic-release/github": "^8.0.1", | ||
"@semantic-release/npm": "^8.0.2", | ||
"@semantic-release/release-notes-generator": "^10.0.2", | ||
"@types/jest": "^27.0.2", | ||
@@ -59,2 +53,3 @@ "@typescript-eslint/eslint-plugin": "^5.1.0", | ||
"semantic-release": "^18.0.0", | ||
"shipjs": "0.25.1", | ||
"ts-jest": "^27.0.7", | ||
@@ -71,15 +66,2 @@ "typescript": "^4.4.4", | ||
}, | ||
"release": { | ||
"branches": [ | ||
"v1" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/github", | ||
"@semantic-release/npm", | ||
"@semantic-release/git" | ||
] | ||
}, | ||
"resolutions": { | ||
@@ -86,0 +68,0 @@ "mkdirp/minimist": "^1.2.5", |
12168
21
165