Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Commit df83685

Browse files
committed
feat: dedicated entrypoint for the decorator
BREAKING CHANGE: `Socket` decorates is no longer exported out of the root entry point of `vue-socket.io-extended`, use the separate entrypoint instead: ```diff - import { Socket } from 'vue-socket.io-extended' + import Socket from 'vue-socket.io-extended/decorator' ```
1 parent d978515 commit df83685

File tree

7 files changed

+41
-56
lines changed

7 files changed

+41
-56
lines changed

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
"description": "Socket.io bindings for Vue.js and Vuex (inspired by Vue-Socket.io)",
55
"main": "dist/vue-socket.io-ext.min.js",
66
"module": "dist/vue-socket.io-ext.esm.js",
7+
"exports": {
8+
".": {
9+
"import": "./dist/vue-socket.io-ext.esm.js",
10+
"default": "./dist/vue-socket.io-ext.min.js"
11+
},
12+
"./decorator/": "./dist/vue-socket.io-ext.decorator.esm.js"
13+
},
714
"scripts": {
815
"test": "jest",
916
"lint": "eslint scripts src",
@@ -17,8 +24,7 @@
1724
},
1825
"files": [
1926
"dist/",
20-
"types/index.d.ts",
21-
"types/vue.d.ts"
27+
"types/"
2228
],
2329
"typings": "types/index.d.ts",
2430
"keywords": [

scripts/rollup-build.js

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/* eslint-disable import/no-extraneous-dependencies */
22
import nodeResolve from 'rollup-plugin-node-resolve';
33
import babel from 'rollup-plugin-babel';
4-
import { terser } from 'rollup-plugin-terser';
4+
import { terser } from 'rollup-plugin-terser'; // uglifyjs alternative
55
import commonjs from 'rollup-plugin-commonjs';
66
import filesize from 'rollup-plugin-filesize';
77

88
export default [
99
{
10-
input: 'src/index.esm.js',
11-
external: ['vue', 'vue-class-component'],
10+
input: 'src/index.js',
11+
external: ['vue'],
1212
plugins: [
1313
nodeResolve(),
1414
commonjs(),
1515
babel(),
16-
terser(), // uglifyjs alternative
16+
terser(),
1717
filesize(),
1818
],
1919
output: {
@@ -22,22 +22,36 @@ export default [
2222
},
2323
},
2424
{
25-
input: 'src/index.umd.js',
26-
external: ['vue', 'vue-class-component'],
25+
input: 'src/index.js',
26+
external: ['vue'],
2727
plugins: [
2828
nodeResolve(),
2929
commonjs(),
3030
babel(),
31-
terser(), // uglifyjs alternative
31+
terser(),
3232
filesize(),
3333
],
34-
output:
35-
{
36-
format: 'umd',
37-
name: 'VueSocketIOExt',
38-
exports: 'named',
39-
globals: { vue: 'Vue' },
40-
file: 'dist/vue-socket.io-ext.min.js',
41-
},
34+
output: {
35+
format: 'umd',
36+
name: 'VueSocketIOExt',
37+
exports: 'named',
38+
globals: { vue: 'Vue' },
39+
file: 'dist/vue-socket.io-ext.min.js',
40+
},
41+
},
42+
{
43+
input: 'src/decorator.js',
44+
external: ['vue-class-component'],
45+
plugins: [
46+
nodeResolve(),
47+
commonjs(),
48+
babel(),
49+
terser(),
50+
filesize(),
51+
],
52+
output: {
53+
format: 'esm',
54+
file: 'dist/vue-socket.io-ext.decorator.esm.js',
55+
},
4256
},
4357
];
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import VueSocketIoExt, { Socket } from '../index.esm';
1+
import VueSocketIoExt from '../index';
22

33
it('default export should be a vue plugin', () => {
44
expect(VueSocketIoExt).toMatchObject({
@@ -11,7 +11,3 @@ it('default export should have `defaults` options exported', () => {
1111
defaults: expect.any(Object),
1212
});
1313
});
14-
15-
it('named export `Socket` exists', () => {
16-
expect(Socket).toEqual(expect.any(Function));
17-
});

src/__tests__/index.umd.spec.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/index.esm.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as plugin from './plugin';
2+
3+
export default plugin;

src/index.umd.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)