Skip to content

Commit 95c3b7d

Browse files
committed
feat: use named exports to export helper functions
1 parent 9c80dab commit 95c3b7d

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

src/browser.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ export { hasMetaInfo } from './shared/hasMetaInfo'
99
* Plugin install function.
1010
* @param {Function} Vue - the Vue constructor.
1111
*/
12-
function VueMeta(Vue, options = {}) {
12+
function install(Vue, options = {}) {
1313
options = setOptions(options)
1414

1515
Vue.prototype.$meta = $meta(options)
1616

1717
Vue.mixin(createMixin(Vue, options))
1818
}
1919

20-
VueMeta.version = version
21-
2220
// automatic install
2321
if (!isUndefined(window) && !isUndefined(window.Vue)) {
2422
/* istanbul ignore next */
25-
Vue.use(VueMeta)
23+
install(window.Vue)
2624
}
2725

28-
export default VueMeta
26+
export {
27+
version,
28+
install
29+
}

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ export { hasMetaInfo } from './shared/hasMetaInfo'
88
* Plugin install function.
99
* @param {Function} Vue - the Vue constructor.
1010
*/
11-
function VueMeta(Vue, options = {}) {
11+
function install(Vue, options = {}) {
1212
options = setOptions(options)
1313

1414
Vue.prototype.$meta = $meta(options)
1515

1616
Vue.mixin(createMixin(Vue, options))
1717
}
1818

19-
VueMeta.version = version
20-
21-
export default VueMeta
19+
export {
20+
version,
21+
install
22+
}

test/plugin-server.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { mount, defaultOptions, hasMetaInfo, VueMetaServerPlugin, loadVueMetaPlugin } from './utils'
1+
import { mount, defaultOptions, VueMetaServerPlugin, loadVueMetaPlugin } from './utils'
2+
3+
const { hasMetaInfo } = VueMetaServerPlugin
24

35
jest.mock('../package.json', () => ({
46
version: 'test-version'

test/utils/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount, createLocalVue } from '@vue/test-utils'
22
import { renderToString } from '@vue/server-test-utils'
3-
import VueMetaBrowserPlugin from '../../src/browser'
4-
import VueMetaServerPlugin, { hasMetaInfo } from '../../src'
3+
import * as VueMetaBrowserPlugin from '../../src/browser'
4+
import * as VueMetaServerPlugin from '../../src'
55

66
import {
77
keyName,
@@ -15,7 +15,6 @@ import {
1515
export {
1616
mount,
1717
renderToString,
18-
hasMetaInfo,
1918
VueMetaBrowserPlugin,
2019
VueMetaServerPlugin
2120
}

0 commit comments

Comments
 (0)