mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 04:40:34 +03:00
feat: use named exports to export helper functions
This commit is contained in:
+6
-5
@@ -9,7 +9,7 @@ export { hasMetaInfo } from './shared/hasMetaInfo'
|
|||||||
* Plugin install function.
|
* Plugin install function.
|
||||||
* @param {Function} Vue - the Vue constructor.
|
* @param {Function} Vue - the Vue constructor.
|
||||||
*/
|
*/
|
||||||
function VueMeta(Vue, options = {}) {
|
function install(Vue, options = {}) {
|
||||||
options = setOptions(options)
|
options = setOptions(options)
|
||||||
|
|
||||||
Vue.prototype.$meta = $meta(options)
|
Vue.prototype.$meta = $meta(options)
|
||||||
@@ -17,12 +17,13 @@ function VueMeta(Vue, options = {}) {
|
|||||||
Vue.mixin(createMixin(Vue, options))
|
Vue.mixin(createMixin(Vue, options))
|
||||||
}
|
}
|
||||||
|
|
||||||
VueMeta.version = version
|
|
||||||
|
|
||||||
// automatic install
|
// automatic install
|
||||||
if (!isUndefined(window) && !isUndefined(window.Vue)) {
|
if (!isUndefined(window) && !isUndefined(window.Vue)) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
Vue.use(VueMeta)
|
install(window.Vue)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default VueMeta
|
export {
|
||||||
|
version,
|
||||||
|
install
|
||||||
|
}
|
||||||
|
|||||||
+5
-4
@@ -8,7 +8,7 @@ export { hasMetaInfo } from './shared/hasMetaInfo'
|
|||||||
* Plugin install function.
|
* Plugin install function.
|
||||||
* @param {Function} Vue - the Vue constructor.
|
* @param {Function} Vue - the Vue constructor.
|
||||||
*/
|
*/
|
||||||
function VueMeta(Vue, options = {}) {
|
function install(Vue, options = {}) {
|
||||||
options = setOptions(options)
|
options = setOptions(options)
|
||||||
|
|
||||||
Vue.prototype.$meta = $meta(options)
|
Vue.prototype.$meta = $meta(options)
|
||||||
@@ -16,6 +16,7 @@ function VueMeta(Vue, options = {}) {
|
|||||||
Vue.mixin(createMixin(Vue, options))
|
Vue.mixin(createMixin(Vue, options))
|
||||||
}
|
}
|
||||||
|
|
||||||
VueMeta.version = version
|
export {
|
||||||
|
version,
|
||||||
export default VueMeta
|
install
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { mount, defaultOptions, hasMetaInfo, VueMetaServerPlugin, loadVueMetaPlugin } from './utils'
|
import { mount, defaultOptions, VueMetaServerPlugin, loadVueMetaPlugin } from './utils'
|
||||||
|
|
||||||
|
const { hasMetaInfo } = VueMetaServerPlugin
|
||||||
|
|
||||||
jest.mock('../package.json', () => ({
|
jest.mock('../package.json', () => ({
|
||||||
version: 'test-version'
|
version: 'test-version'
|
||||||
|
|||||||
+2
-3
@@ -1,7 +1,7 @@
|
|||||||
import { mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
import { renderToString } from '@vue/server-test-utils'
|
import { renderToString } from '@vue/server-test-utils'
|
||||||
import VueMetaBrowserPlugin from '../../src/browser'
|
import * as VueMetaBrowserPlugin from '../../src/browser'
|
||||||
import VueMetaServerPlugin, { hasMetaInfo } from '../../src'
|
import * as VueMetaServerPlugin from '../../src'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
keyName,
|
keyName,
|
||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
export {
|
export {
|
||||||
mount,
|
mount,
|
||||||
renderToString,
|
renderToString,
|
||||||
hasMetaInfo,
|
|
||||||
VueMetaBrowserPlugin,
|
VueMetaBrowserPlugin,
|
||||||
VueMetaServerPlugin
|
VueMetaServerPlugin
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user