@cuecue/socketio 0.0.27 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +31 -18
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,10 +1,20 @@
1
- import createDebug from 'debug';
2
- import isArray from 'lodash/isArray';
3
- import { BasePlugin } from '@cuecue/core';
4
- import { io } from 'socket.io-client';
5
- import io$1 from 'socket.io';
1
+ 'use strict';
6
2
 
7
- class Base extends BasePlugin {
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var createDebug = require('debug');
6
+ var isArray = require('lodash/isArray');
7
+ var core = require('@cuecue/core');
8
+ var socket_ioClient = require('socket.io-client');
9
+ var io = require('socket.io');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var createDebug__default = /*#__PURE__*/_interopDefaultLegacy(createDebug);
14
+ var isArray__default = /*#__PURE__*/_interopDefaultLegacy(isArray);
15
+ var io__default = /*#__PURE__*/_interopDefaultLegacy(io);
16
+
17
+ class Base extends core.BasePlugin {
8
18
  constructor({
9
19
  commands = null,
10
20
  ...opts
@@ -16,7 +26,7 @@ class Base extends BasePlugin {
16
26
  });
17
27
  this.onConnect = this.onConnect.bind(this);
18
28
  this.commands = commands;
19
- this.debug = createDebug('cuecue:socketio');
29
+ this.debug = createDebug__default["default"]('cuecue:socketio');
20
30
  }
21
31
 
22
32
  async onInit() {
@@ -34,7 +44,7 @@ class Base extends BasePlugin {
34
44
  host,
35
45
  namespace
36
46
  } = this.options;
37
- this.socket = io(namespace !== null ? host.replace(/\/?$/, `/${namespace.replace(/^\//, '')}`) : host);
47
+ this.socket = socket_ioClient.io(namespace !== null ? host.replace(/\/?$/, `/${namespace.replace(/^\//, '')}`) : host);
38
48
  this.socket.on('connect', this.onConnect);
39
49
  return Promise.resolve();
40
50
  }
@@ -66,7 +76,7 @@ class ClientInput extends Base {
66
76
  });
67
77
  this.onMessage = this.onMessage.bind(this);
68
78
  this.commands = commands;
69
- this.debug = createDebug('cuecue:input:socketio');
79
+ this.debug = createDebug__default["default"]('cuecue:input:socketio');
70
80
  }
71
81
 
72
82
  setInputCommands(commands) {
@@ -100,7 +110,7 @@ class ClientInput extends Base {
100
110
 
101
111
  if (this.commands === null || this.commands.indexOf(finalCommand) !== -1) {
102
112
  this.debug('command: %s args: %o', finalCommand, finalArgs);
103
- this.emit('command', command, ...(isArray(finalArgs) ? finalArgs : [finalArgs]));
113
+ this.emit('command', command, ...(isArray__default["default"](finalArgs) ? finalArgs : [finalArgs]));
104
114
  } else {
105
115
  this.debug('message: %o', message);
106
116
  }
@@ -115,7 +125,7 @@ class ClientOutput extends Base {
115
125
  ...opts
116
126
  });
117
127
  this.socket = null;
118
- this.debug = createDebug('cuecue:output:socketio');
128
+ this.debug = createDebug__default["default"]('cuecue:output:socketio');
119
129
  }
120
130
 
121
131
  cue(cue, extraData = null) {
@@ -185,7 +195,7 @@ class ClientOutput extends Base {
185
195
 
186
196
  }
187
197
 
188
- class BaseServer extends BasePlugin {
198
+ class BaseServer extends core.BasePlugin {
189
199
  constructor({
190
200
  commands = null,
191
201
  ...opts
@@ -199,7 +209,7 @@ class BaseServer extends BasePlugin {
199
209
  this.io = null;
200
210
  this.onConnection = this.onConnection.bind(this);
201
211
  this.commands = commands;
202
- this.debug = createDebug('cuecue:socketio');
212
+ this.debug = createDebug__default["default"]('cuecue:socketio');
203
213
  }
204
214
 
205
215
  async onInit() {
@@ -218,7 +228,7 @@ class BaseServer extends BasePlugin {
218
228
  port
219
229
  } = this.options;
220
230
  const ioOptions = {};
221
- this.io = io$1(ioOptions);
231
+ this.io = io__default["default"](ioOptions);
222
232
  this.io.on('connection', this.onConnection);
223
233
  this.io.listen(server || port);
224
234
  return Promise.resolve();
@@ -251,7 +261,7 @@ class ServerInput extends BaseServer {
251
261
  this.onSocketConnection = this.onSocketConnection.bind(this);
252
262
  this.onMessage = this.onMessage.bind(this);
253
263
  this.commands = commands;
254
- this.debug = createDebug('cuecue:input:socketio-server');
264
+ this.debug = createDebug__default["default"]('cuecue:input:socketio-server');
255
265
  }
256
266
 
257
267
  setInputCommands(commands) {
@@ -306,7 +316,7 @@ class ServerInput extends BaseServer {
306
316
 
307
317
  if (this.commands === null || this.commands.indexOf(finalCommand) !== -1) {
308
318
  this.debug('command: %s args: %o', finalCommand, finalArgs);
309
- this.emit('command', command, ...(isArray(finalArgs) ? finalArgs : [finalArgs]));
319
+ this.emit('command', command, ...(isArray__default["default"](finalArgs) ? finalArgs : [finalArgs]));
310
320
  } else {
311
321
  this.debug('message: %o', message);
312
322
  }
@@ -321,7 +331,7 @@ class ServerOutput extends Base {
321
331
  ...opts
322
332
  });
323
333
  this.socket = null;
324
- this.debug = createDebug('cuecue:output:socketio');
334
+ this.debug = createDebug__default["default"]('cuecue:output:socketio');
325
335
  }
326
336
 
327
337
  cue(cue, extraData = null) {
@@ -406,4 +416,7 @@ class ServerOutput extends Base {
406
416
 
407
417
  }
408
418
 
409
- export { ClientInput as Input, ClientOutput as Output, ServerInput, ServerOutput };
419
+ exports.Input = ClientInput;
420
+ exports.Output = ClientOutput;
421
+ exports.ServerInput = ServerInput;
422
+ exports.ServerOutput = ServerOutput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuecue/socketio",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@babel/runtime": "^7.12.5",
43
- "@cuecue/core": "^0.0.27",
43
+ "@cuecue/core": "^0.0.28",
44
44
  "debug": "^4.3.1",
45
45
  "lodash": "^4.17.20",
46
46
  "socket.io": "^4.1.2",
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "2c305c0d1c0b13469fe74e2b928c0b45744c8ac0"
53
+ "gitHead": "f6865a82708bf09de192b9a6367729e9faeb1250"
54
54
  }