bare-ws 2.0.4 → 3.0.0

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.
package/global.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import * as ws from '.'
2
+
3
+ type WebSocketConstructor = typeof ws.Socket
4
+
5
+ declare global {
6
+ type WebSocket = ws.Socket
7
+
8
+ const WebSocket: WebSocketConstructor
9
+ }
package/global.js ADDED
@@ -0,0 +1,3 @@
1
+ const ws = require('.')
2
+
3
+ global.WebSocket = ws.Socket
package/lib/server.d.ts CHANGED
@@ -16,8 +16,9 @@ interface WebSocketServerEvents extends DuplexEvents {
16
16
  listening: []
17
17
  }
18
18
 
19
- interface WebSocketServer<M extends WebSocketServerEvents = WebSocketServerEvents>
20
- extends EventEmitter<M> {
19
+ interface WebSocketServer<
20
+ M extends WebSocketServerEvents = WebSocketServerEvents
21
+ > extends EventEmitter<M> {
21
22
  readonly listening: boolean
22
23
 
23
24
  address(): TCPSocketAddress
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "bare-ws",
3
- "version": "2.0.4",
3
+ "version": "3.0.0",
4
4
  "description": "WebSocket library for JavaScript",
5
5
  "exports": {
6
+ "./package": "./package.json",
6
7
  ".": {
7
8
  "types": "./index.d.ts",
8
9
  "default": "./index.js"
9
10
  },
10
- "./package": "./package.json",
11
+ "./global": {
12
+ "types": "./global.d.ts",
13
+ "default": "./global.js"
14
+ },
11
15
  "./constants": {
12
16
  "types": "./lib/constants.d.ts",
13
17
  "default": "./lib/constants.js"
@@ -20,10 +24,14 @@
20
24
  "files": [
21
25
  "index.js",
22
26
  "index.d.ts",
27
+ "global.js",
28
+ "global.d.ts",
23
29
  "lib"
24
30
  ],
25
31
  "scripts": {
26
- "test": "prettier . --check && bare test.js"
32
+ "format": "prettier --write . && lunte --fix",
33
+ "lint": "prettier --check . && lunte",
34
+ "test": "brittle-bare --coverage test.js"
27
35
  },
28
36
  "repository": {
29
37
  "type": "git",
@@ -39,7 +47,7 @@
39
47
  "bare-crypto": "^1.2.0",
40
48
  "bare-events": "^2.3.1",
41
49
  "bare-http1": "^4.0.0",
42
- "bare-https": "^2.0.0",
50
+ "bare-https": "^3.0.0",
43
51
  "bare-stream": "^2.1.2"
44
52
  },
45
53
  "devDependencies": {
@@ -47,6 +55,7 @@
47
55
  "bare-fs": "^4.0.0",
48
56
  "bare-url": "^2.1.3",
49
57
  "brittle": "^3.3.0",
58
+ "lunte": "^1.7.0",
50
59
  "prettier": "^3.4.1",
51
60
  "prettier-config-holepunch": "^2.0.0"
52
61
  },