From f597f611048f81e780e5fda4743dbda11df81f6b Mon Sep 17 00:00:00 2001 From: pimlie Date: Tue, 5 Mar 2019 14:12:56 +0100 Subject: [PATCH] Revert "feat: use named exports to export helper functions" This reverts commit 95c3b7d4e8f9863c31e3a81265b66953dc8e264a. --- src/browser.js | 11 +++++------ src/index.js | 9 ++++----- test/plugin-server.test.js | 4 +--- test/utils/index.js | 5 +++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/browser.js b/src/browser.js index 700d8a6..8839c05 100644 --- a/src/browser.js +++ b/src/browser.js @@ -9,7 +9,7 @@ export { hasMetaInfo } from './shared/hasMetaInfo' * Plugin install function. * @param {Function} Vue - the Vue constructor. */ -function install(Vue, options = {}) { +function VueMeta(Vue, options = {}) { options = setOptions(options) Vue.prototype.$meta = $meta(options) @@ -17,13 +17,12 @@ function install(Vue, options = {}) { Vue.mixin(createMixin(Vue, options)) } +VueMeta.version = version + // automatic install if (!isUndefined(window) && !isUndefined(window.Vue)) { /* istanbul ignore next */ - install(window.Vue) + Vue.use(VueMeta) } -export { - version, - install -} +export default VueMeta diff --git a/src/index.js b/src/index.js index 819246d..cb37884 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,7 @@ export { hasMetaInfo } from './shared/hasMetaInfo' * Plugin install function. * @param {Function} Vue - the Vue constructor. */ -function install(Vue, options = {}) { +function VueMeta(Vue, options = {}) { options = setOptions(options) Vue.prototype.$meta = $meta(options) @@ -16,7 +16,6 @@ function install(Vue, options = {}) { Vue.mixin(createMixin(Vue, options)) } -export { - version, - install -} +VueMeta.version = version + +export default VueMeta diff --git a/test/plugin-server.test.js b/test/plugin-server.test.js index 2eaa8b3..85c445c 100644 --- a/test/plugin-server.test.js +++ b/test/plugin-server.test.js @@ -1,6 +1,4 @@ -import { mount, defaultOptions, VueMetaServerPlugin, loadVueMetaPlugin } from './utils' - -const { hasMetaInfo } = VueMetaServerPlugin +import { mount, defaultOptions, hasMetaInfo, VueMetaServerPlugin, loadVueMetaPlugin } from './utils' jest.mock('../package.json', () => ({ version: 'test-version' diff --git a/test/utils/index.js b/test/utils/index.js index 123d993..b4f4fcc 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -1,7 +1,7 @@ import { mount, createLocalVue } from '@vue/test-utils' import { renderToString } from '@vue/server-test-utils' -import * as VueMetaBrowserPlugin from '../../src/browser' -import * as VueMetaServerPlugin from '../../src' +import VueMetaBrowserPlugin from '../../src/browser' +import VueMetaServerPlugin, { hasMetaInfo } from '../../src' import { keyName, @@ -15,6 +15,7 @@ import { export { mount, renderToString, + hasMetaInfo, VueMetaBrowserPlugin, VueMetaServerPlugin }