crossws 0.3.3 → 0.3.5

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 (40) hide show
  1. package/README.md +7 -7
  2. package/dist/adapters/bun.d.mts +7 -6
  3. package/dist/adapters/bun.d.ts +7 -6
  4. package/dist/adapters/bun.mjs +43 -43
  5. package/dist/adapters/cloudflare-durable.d.mts +30 -8
  6. package/dist/adapters/cloudflare-durable.d.ts +30 -8
  7. package/dist/adapters/cloudflare-durable.mjs +18 -11
  8. package/dist/adapters/cloudflare.d.mts +5 -4
  9. package/dist/adapters/cloudflare.d.ts +5 -4
  10. package/dist/adapters/cloudflare.mjs +52 -54
  11. package/dist/adapters/deno.d.mts +5 -4
  12. package/dist/adapters/deno.d.ts +5 -4
  13. package/dist/adapters/deno.mjs +42 -44
  14. package/dist/adapters/node.d.mts +13 -14
  15. package/dist/adapters/node.d.ts +13 -14
  16. package/dist/adapters/node.mjs +67 -62
  17. package/dist/adapters/sse.d.mts +5 -4
  18. package/dist/adapters/sse.d.ts +5 -4
  19. package/dist/adapters/sse.mjs +6 -6
  20. package/dist/adapters/uws.d.mts +6 -4
  21. package/dist/adapters/uws.d.ts +6 -4
  22. package/dist/adapters/uws.mjs +84 -81
  23. package/dist/index.d.mts +13 -4
  24. package/dist/index.d.ts +13 -4
  25. package/dist/index.mjs +1 -1
  26. package/dist/shared/{crossws.ChIJSJVK.d.mts → crossws.BQXMA5bH.d.mts} +1 -1
  27. package/dist/shared/{crossws.ChIJSJVK.d.ts → crossws.BQXMA5bH.d.ts} +1 -1
  28. package/dist/shared/{crossws.DelSCW9g.mjs → crossws.CipVM6lf.mjs} +197 -7
  29. package/dist/shared/{crossws.CB4awDDj.mjs → crossws.D9ehKjSh.mjs} +19 -6
  30. package/dist/shared/{crossws.DLRVRjZs.mjs → crossws.DfCzGthR.mjs} +12 -5
  31. package/dist/websocket/native.d.mts +2 -9
  32. package/dist/websocket/native.d.ts +2 -9
  33. package/dist/websocket/native.mjs +2 -2
  34. package/dist/websocket/node.d.mts +2 -9
  35. package/dist/websocket/node.d.ts +2 -9
  36. package/dist/websocket/node.mjs +3 -3
  37. package/dist/websocket/sse.d.mts +3 -2
  38. package/dist/websocket/sse.d.ts +3 -2
  39. package/dist/websocket/sse.mjs +1 -1
  40. package/package.json +32 -24
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { W as WebSocket } from './shared/crossws.ChIJSJVK.js';
1
+ import { W as WebSocket } from './shared/crossws.BQXMA5bH.js';
2
+
3
+ declare const kNodeInspect: unique symbol;
2
4
 
3
5
  interface AdapterInternal {
4
6
  ws: unknown;
@@ -32,6 +34,8 @@ declare abstract class Peer<Internal extends AdapterInternal = AdapterInternal>
32
34
  get websocket(): Partial<WebSocket>;
33
35
  /** All connected peers to the server */
34
36
  get peers(): Set<Peer>;
37
+ /** All topics, this peer has been subscribed to. */
38
+ get topics(): Set<string>;
35
39
  abstract close(code?: number, reason?: string): void;
36
40
  /** Abruptly close the connection */
37
41
  terminate(): void;
@@ -49,7 +53,8 @@ declare abstract class Peer<Internal extends AdapterInternal = AdapterInternal>
49
53
  }): void;
50
54
  toString(): string;
51
55
  [Symbol.toPrimitive](): string;
52
- [Symbol.toStringTag](): string;
56
+ [Symbol.toStringTag](): "WebSocket";
57
+ [kNodeInspect](): Record<string, unknown>;
53
58
  }
54
59
 
55
60
  interface AdapterInstance {
@@ -85,7 +90,7 @@ declare class Message implements Partial<MessageEvent> {
85
90
  *
86
91
  * If raw data is in any other format or string, it will be automatically converted and encoded.
87
92
  */
88
- uint8Array(): Uint8Array<ArrayBufferLike>;
93
+ uint8Array(): Uint8Array;
89
94
  /**
90
95
  * Get data as [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or [SharedArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) value.
91
96
  *
@@ -113,6 +118,9 @@ declare class Message implements Partial<MessageEvent> {
113
118
  get data(): unknown;
114
119
  toString(): string;
115
120
  [Symbol.toPrimitive](): string;
121
+ [kNodeInspect](): {
122
+ data: unknown;
123
+ };
116
124
  }
117
125
 
118
126
  declare function defineHooks<T extends Partial<Hooks> = Partial<Hooks>>(hooks: T): T;
@@ -145,4 +153,5 @@ interface Hooks {
145
153
  error: (peer: Peer, error: WSError) => MaybePromise<void>;
146
154
  }
147
155
 
148
- export { type Adapter, type AdapterInstance, type AdapterOptions, type Hooks, Message, Peer, type ResolveHooks, WSError, defineHooks, defineWebSocketAdapter };
156
+ export { Message, Peer, WSError, defineHooks, defineWebSocketAdapter };
157
+ export type { Adapter, AdapterInstance, AdapterInternal, AdapterOptions, Hooks, ResolveHooks };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { b as defineHooks, d as defineWebSocketAdapter } from './shared/crossws.CB4awDDj.mjs';
1
+ export { d as defineHooks, b as defineWebSocketAdapter } from './shared/crossws.D9ehKjSh.mjs';
@@ -294,4 +294,4 @@ interface WebSocket extends EventTarget {
294
294
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
295
295
  }
296
296
 
297
- export type { CloseEvent as C, Event as E, MessageEvent as M, WebSocket as W, EventTarget as a };
297
+ export type { CloseEvent as C, EventTarget as E, MessageEvent as M, WebSocket as W, Event as a };
@@ -294,4 +294,4 @@ interface WebSocket extends EventTarget {
294
294
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
295
295
  }
296
296
 
297
- export type { CloseEvent as C, Event as E, MessageEvent as M, WebSocket as W, EventTarget as a };
297
+ export type { CloseEvent as C, EventTarget as E, MessageEvent as M, WebSocket as W, Event as a };
@@ -1,6 +1,6 @@
1
+ import require$$0$2 from 'stream';
1
2
  import require$$0$3 from 'events';
2
3
  import require$$2 from 'http';
3
- import require$$0$2 from 'stream';
4
4
  import require$$1 from 'crypto';
5
5
  import require$$0$1 from 'buffer';
6
6
  import require$$0 from 'zlib';
@@ -743,6 +743,14 @@ function requirePermessageDeflate () {
743
743
  this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';
744
744
  this[kError][kStatusCode] = 1009;
745
745
  this.removeListener('data', inflateOnData);
746
+
747
+ //
748
+ // The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the
749
+ // fact that in Node.js versions prior to 13.10.0, the callback for
750
+ // `zlib.flush()` is not called if `zlib.close()` is used. Utilizing
751
+ // `zlib.reset()` ensures that either the callback is invoked or an error is
752
+ // emitted.
753
+ //
746
754
  this.reset();
747
755
  }
748
756
 
@@ -758,6 +766,12 @@ function requirePermessageDeflate () {
758
766
  // closed when an error is emitted.
759
767
  //
760
768
  this[kPerMessageDeflate]._inflate = null;
769
+
770
+ if (this[kError]) {
771
+ this[kCallback](this[kError]);
772
+ return;
773
+ }
774
+
761
775
  err[kStatusCode] = 1007;
762
776
  this[kCallback](err);
763
777
  }
@@ -1639,8 +1653,6 @@ function requireReceiver () {
1639
1653
  return receiver;
1640
1654
  }
1641
1655
 
1642
- requireReceiver();
1643
-
1644
1656
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
1645
1657
 
1646
1658
  var sender;
@@ -1649,6 +1661,8 @@ var hasRequiredSender;
1649
1661
  function requireSender () {
1650
1662
  if (hasRequiredSender) return sender;
1651
1663
  hasRequiredSender = 1;
1664
+
1665
+ const { Duplex } = require$$0$2;
1652
1666
  const { randomFillSync } = require$$1;
1653
1667
 
1654
1668
  const PerMessageDeflate = requirePermessageDeflate();
@@ -2197,7 +2211,7 @@ function requireSender () {
2197
2211
  /**
2198
2212
  * Sends a frame.
2199
2213
  *
2200
- * @param {Buffer[]} list The frame to send
2214
+ * @param {(Buffer | String)[]} list The frame to send
2201
2215
  * @param {Function} [cb] Callback
2202
2216
  * @private
2203
2217
  */
@@ -2249,8 +2263,6 @@ function requireSender () {
2249
2263
  return sender;
2250
2264
  }
2251
2265
 
2252
- requireSender();
2253
-
2254
2266
  var eventTarget;
2255
2267
  var hasRequiredEventTarget;
2256
2268
 
@@ -2777,6 +2789,7 @@ function requireWebsocket () {
2777
2789
  const net = require$$3;
2778
2790
  const tls = require$$4;
2779
2791
  const { randomBytes, createHash } = require$$1;
2792
+ const { Duplex, Readable } = require$$0$2;
2780
2793
  const { URL } = require$$7;
2781
2794
 
2782
2795
  const PerMessageDeflate = requirePermessageDeflate();
@@ -3476,7 +3489,7 @@ function requireWebsocket () {
3476
3489
  if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
3477
3490
  invalidUrlMessage =
3478
3491
  'The URL\'s protocol must be one of "ws:", "wss:", ' +
3479
- '"http:", "https", or "ws+unix:"';
3492
+ '"http:", "https:", or "ws+unix:"';
3480
3493
  } else if (isIpcUrl && !parsedUrl.pathname) {
3481
3494
  invalidUrlMessage = "The URL's pathname is empty";
3482
3495
  } else if (parsedUrl.hash) {
@@ -4157,6 +4170,182 @@ function requireWebsocket () {
4157
4170
  return websocket;
4158
4171
  }
4159
4172
 
4173
+ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^WebSocket$" }] */
4174
+
4175
+ var stream;
4176
+ var hasRequiredStream;
4177
+
4178
+ function requireStream () {
4179
+ if (hasRequiredStream) return stream;
4180
+ hasRequiredStream = 1;
4181
+
4182
+ requireWebsocket();
4183
+ const { Duplex } = require$$0$2;
4184
+
4185
+ /**
4186
+ * Emits the `'close'` event on a stream.
4187
+ *
4188
+ * @param {Duplex} stream The stream.
4189
+ * @private
4190
+ */
4191
+ function emitClose(stream) {
4192
+ stream.emit('close');
4193
+ }
4194
+
4195
+ /**
4196
+ * The listener of the `'end'` event.
4197
+ *
4198
+ * @private
4199
+ */
4200
+ function duplexOnEnd() {
4201
+ if (!this.destroyed && this._writableState.finished) {
4202
+ this.destroy();
4203
+ }
4204
+ }
4205
+
4206
+ /**
4207
+ * The listener of the `'error'` event.
4208
+ *
4209
+ * @param {Error} err The error
4210
+ * @private
4211
+ */
4212
+ function duplexOnError(err) {
4213
+ this.removeListener('error', duplexOnError);
4214
+ this.destroy();
4215
+ if (this.listenerCount('error') === 0) {
4216
+ // Do not suppress the throwing behavior.
4217
+ this.emit('error', err);
4218
+ }
4219
+ }
4220
+
4221
+ /**
4222
+ * Wraps a `WebSocket` in a duplex stream.
4223
+ *
4224
+ * @param {WebSocket} ws The `WebSocket` to wrap
4225
+ * @param {Object} [options] The options for the `Duplex` constructor
4226
+ * @return {Duplex} The duplex stream
4227
+ * @public
4228
+ */
4229
+ function createWebSocketStream(ws, options) {
4230
+ let terminateOnDestroy = true;
4231
+
4232
+ const duplex = new Duplex({
4233
+ ...options,
4234
+ autoDestroy: false,
4235
+ emitClose: false,
4236
+ objectMode: false,
4237
+ writableObjectMode: false
4238
+ });
4239
+
4240
+ ws.on('message', function message(msg, isBinary) {
4241
+ const data =
4242
+ !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
4243
+
4244
+ if (!duplex.push(data)) ws.pause();
4245
+ });
4246
+
4247
+ ws.once('error', function error(err) {
4248
+ if (duplex.destroyed) return;
4249
+
4250
+ // Prevent `ws.terminate()` from being called by `duplex._destroy()`.
4251
+ //
4252
+ // - If the `'error'` event is emitted before the `'open'` event, then
4253
+ // `ws.terminate()` is a noop as no socket is assigned.
4254
+ // - Otherwise, the error is re-emitted by the listener of the `'error'`
4255
+ // event of the `Receiver` object. The listener already closes the
4256
+ // connection by calling `ws.close()`. This allows a close frame to be
4257
+ // sent to the other peer. If `ws.terminate()` is called right after this,
4258
+ // then the close frame might not be sent.
4259
+ terminateOnDestroy = false;
4260
+ duplex.destroy(err);
4261
+ });
4262
+
4263
+ ws.once('close', function close() {
4264
+ if (duplex.destroyed) return;
4265
+
4266
+ duplex.push(null);
4267
+ });
4268
+
4269
+ duplex._destroy = function (err, callback) {
4270
+ if (ws.readyState === ws.CLOSED) {
4271
+ callback(err);
4272
+ process.nextTick(emitClose, duplex);
4273
+ return;
4274
+ }
4275
+
4276
+ let called = false;
4277
+
4278
+ ws.once('error', function error(err) {
4279
+ called = true;
4280
+ callback(err);
4281
+ });
4282
+
4283
+ ws.once('close', function close() {
4284
+ if (!called) callback(err);
4285
+ process.nextTick(emitClose, duplex);
4286
+ });
4287
+
4288
+ if (terminateOnDestroy) ws.terminate();
4289
+ };
4290
+
4291
+ duplex._final = function (callback) {
4292
+ if (ws.readyState === ws.CONNECTING) {
4293
+ ws.once('open', function open() {
4294
+ duplex._final(callback);
4295
+ });
4296
+ return;
4297
+ }
4298
+
4299
+ // If the value of the `_socket` property is `null` it means that `ws` is a
4300
+ // client websocket and the handshake failed. In fact, when this happens, a
4301
+ // socket is never assigned to the websocket. Wait for the `'error'` event
4302
+ // that will be emitted by the websocket.
4303
+ if (ws._socket === null) return;
4304
+
4305
+ if (ws._socket._writableState.finished) {
4306
+ callback();
4307
+ if (duplex._readableState.endEmitted) duplex.destroy();
4308
+ } else {
4309
+ ws._socket.once('finish', function finish() {
4310
+ // `duplex` is not destroyed here because the `'end'` event will be
4311
+ // emitted on `duplex` after this `'finish'` event. The EOF signaling
4312
+ // `null` chunk is, in fact, pushed when the websocket emits `'close'`.
4313
+ callback();
4314
+ });
4315
+ ws.close();
4316
+ }
4317
+ };
4318
+
4319
+ duplex._read = function () {
4320
+ if (ws.isPaused) ws.resume();
4321
+ };
4322
+
4323
+ duplex._write = function (chunk, encoding, callback) {
4324
+ if (ws.readyState === ws.CONNECTING) {
4325
+ ws.once('open', function open() {
4326
+ duplex._write(chunk, encoding, callback);
4327
+ });
4328
+ return;
4329
+ }
4330
+
4331
+ ws.send(chunk, callback);
4332
+ };
4333
+
4334
+ duplex.on('end', duplexOnEnd);
4335
+ duplex.on('error', duplexOnError);
4336
+ return duplex;
4337
+ }
4338
+
4339
+ stream = createWebSocketStream;
4340
+ return stream;
4341
+ }
4342
+
4343
+ requireStream();
4344
+
4345
+ requireReceiver();
4346
+
4347
+ requireSender();
4348
+
4160
4349
  var websocketExports = requireWebsocket();
4161
4350
  const _WebSocket = /*@__PURE__*/getDefaultExportFromCjs(websocketExports);
4162
4351
 
@@ -4241,6 +4430,7 @@ function requireWebsocketServer () {
4241
4430
 
4242
4431
  const EventEmitter = require$$0$3;
4243
4432
  const http = require$$2;
4433
+ const { Duplex } = require$$0$2;
4244
4434
  const { createHash } = require$$1;
4245
4435
 
4246
4436
  const extension = requireExtension();
@@ -19,7 +19,14 @@ class AdapterHookable {
19
19
  );
20
20
  }
21
21
  async upgrade(request) {
22
- const context = request.context ??= {};
22
+ let context = request.context;
23
+ if (!context) {
24
+ context = {};
25
+ Object.defineProperty(request, "context", {
26
+ enumerable: true,
27
+ value: context
28
+ });
29
+ }
23
30
  try {
24
31
  const res = await this.callHook(
25
32
  "upgrade",
@@ -58,10 +65,16 @@ function adapterUtils(peers) {
58
65
  return {
59
66
  peers,
60
67
  publish(topic, message, options) {
61
- const firstPeer = peers.values().next().value;
62
- if (firstPeer) {
63
- firstPeer.send(message, options);
64
- firstPeer.publish(topic, message, options);
68
+ let firstPeerWithTopic;
69
+ for (const peer of peers) {
70
+ if (peer.topics.has(topic)) {
71
+ firstPeerWithTopic = peer;
72
+ break;
73
+ }
74
+ }
75
+ if (firstPeerWithTopic) {
76
+ firstPeerWithTopic.send(message, options);
77
+ firstPeerWithTopic.publish(topic, message, options);
65
78
  }
66
79
  }
67
80
  };
@@ -70,4 +83,4 @@ function defineWebSocketAdapter(factory) {
70
83
  return factory;
71
84
  }
72
85
 
73
- export { AdapterHookable as A, adapterUtils as a, defineHooks as b, defineWebSocketAdapter as d };
86
+ export { AdapterHookable as A, adapterUtils as a, defineWebSocketAdapter as b, defineHooks as d };
@@ -1,7 +1,10 @@
1
1
  import { randomUUID } from 'uncrypto';
2
2
 
3
+ const kNodeInspect = /* @__PURE__ */ Symbol.for(
4
+ "nodejs.util.inspect.custom"
5
+ );
3
6
  function toBufferLike(val) {
4
- if (val === undefined || val === null) {
7
+ if (val === void 0 || val === null) {
5
8
  return "";
6
9
  }
7
10
  const type = typeof val;
@@ -206,7 +209,7 @@ class Message {
206
209
  [Symbol.toPrimitive]() {
207
210
  return this.text();
208
211
  }
209
- [Symbol.for("nodejs.util.inspect.custom")]() {
212
+ [kNodeInspect]() {
210
213
  return { data: this.rawData };
211
214
  }
212
215
  }
@@ -234,7 +237,7 @@ class Peer {
234
237
  }
235
238
  /** IP address of the peer */
236
239
  get remoteAddress() {
237
- return undefined;
240
+ return void 0;
238
241
  }
239
242
  /** upgrade request */
240
243
  get request() {
@@ -260,6 +263,10 @@ class Peer {
260
263
  get peers() {
261
264
  return this._internal.peers || /* @__PURE__ */ new Set();
262
265
  }
266
+ /** All topics, this peer has been subscribed to. */
267
+ get topics() {
268
+ return this._topics;
269
+ }
263
270
  /** Abruptly close the connection */
264
271
  terminate() {
265
272
  this.close();
@@ -282,7 +289,7 @@ class Peer {
282
289
  [Symbol.toStringTag]() {
283
290
  return "WebSocket";
284
291
  }
285
- [Symbol.for("nodejs.util.inspect.custom")]() {
292
+ [kNodeInspect]() {
286
293
  return Object.fromEntries(
287
294
  [
288
295
  ["id", this.id],
@@ -306,7 +313,7 @@ function createWsProxy(ws, request) {
306
313
  return request?.headers?.get("sec-websocket-extensions") || "";
307
314
  }
308
315
  case "url": {
309
- return request?.url?.replace(/^http/, "ws") || undefined;
316
+ return request?.url?.replace(/^http/, "ws") || void 0;
310
317
  }
311
318
  }
312
319
  }
@@ -1,10 +1,3 @@
1
- declare const _default: {
2
- new (url: string | URL, protocols?: string | string[]): WebSocket;
3
- prototype: WebSocket;
4
- readonly CONNECTING: 0;
5
- readonly OPEN: 1;
6
- readonly CLOSING: 2;
7
- readonly CLOSED: 3;
8
- };
1
+ declare const WebSocket: typeof globalThis.WebSocket;
9
2
 
10
- export { _default as default };
3
+ export { WebSocket as default };
@@ -1,10 +1,3 @@
1
- declare const _default: {
2
- new (url: string | URL, protocols?: string | string[]): WebSocket;
3
- prototype: WebSocket;
4
- readonly CONNECTING: 0;
5
- readonly OPEN: 1;
6
- readonly CLOSING: 2;
7
- readonly CLOSED: 3;
8
- };
1
+ declare const WebSocket: typeof globalThis.WebSocket;
9
2
 
10
- export { _default as default };
3
+ export { WebSocket as default };
@@ -1,3 +1,3 @@
1
- const native = globalThis.WebSocket;
1
+ const WebSocket = globalThis.WebSocket;
2
2
 
3
- export { native as default };
3
+ export { WebSocket as default };
@@ -1,10 +1,3 @@
1
- declare const _default: {
2
- new (url: string | URL, protocols?: string | string[]): WebSocket;
3
- prototype: WebSocket;
4
- readonly CONNECTING: 0;
5
- readonly OPEN: 1;
6
- readonly CLOSING: 2;
7
- readonly CLOSED: 3;
8
- };
1
+ declare const Websocket: typeof globalThis.WebSocket;
9
2
 
10
- export { _default as default };
3
+ export { Websocket as default };
@@ -1,10 +1,3 @@
1
- declare const _default: {
2
- new (url: string | URL, protocols?: string | string[]): WebSocket;
3
- prototype: WebSocket;
4
- readonly CONNECTING: 0;
5
- readonly OPEN: 1;
6
- readonly CLOSING: 2;
7
- readonly CLOSED: 3;
8
- };
1
+ declare const Websocket: typeof globalThis.WebSocket;
9
2
 
10
- export { _default as default };
3
+ export { Websocket as default };
@@ -1,5 +1,5 @@
1
+ import { a as _WebSocket } from '../shared/crossws.CipVM6lf.mjs';
1
2
  import 'stream';
2
- import { a as _WebSocket } from '../shared/crossws.DelSCW9g.mjs';
3
3
  import 'events';
4
4
  import 'http';
5
5
  import 'crypto';
@@ -10,6 +10,6 @@ import 'net';
10
10
  import 'tls';
11
11
  import 'url';
12
12
 
13
- const node = globalThis.WebSocket || _WebSocket;
13
+ const Websocket = globalThis.WebSocket || _WebSocket;
14
14
 
15
- export { node as default };
15
+ export { Websocket as default };
@@ -1,4 +1,4 @@
1
- import { W as WebSocket, C as CloseEvent, E as Event, M as MessageEvent, a as EventTarget } from '../shared/crossws.ChIJSJVK.mjs';
1
+ import { E as EventTarget, W as WebSocket, C as CloseEvent, a as Event, M as MessageEvent } from '../shared/crossws.BQXMA5bH.mjs';
2
2
 
3
3
  type Ctor<T> = {
4
4
  prototype: T;
@@ -38,4 +38,5 @@ declare class WebSocketSSE extends _EventTarget implements WebSocket {
38
38
  send(data: any): Promise<void>;
39
39
  }
40
40
 
41
- export { WebSocketSSE, type WebSocketSSEOptions };
41
+ export { WebSocketSSE };
42
+ export type { WebSocketSSEOptions };
@@ -1,4 +1,4 @@
1
- import { W as WebSocket, C as CloseEvent, E as Event, M as MessageEvent, a as EventTarget } from '../shared/crossws.ChIJSJVK.js';
1
+ import { E as EventTarget, W as WebSocket, C as CloseEvent, a as Event, M as MessageEvent } from '../shared/crossws.BQXMA5bH.js';
2
2
 
3
3
  type Ctor<T> = {
4
4
  prototype: T;
@@ -38,4 +38,5 @@ declare class WebSocketSSE extends _EventTarget implements WebSocket {
38
38
  send(data: any): Promise<void>;
39
39
  }
40
40
 
41
- export { WebSocketSSE, type WebSocketSSEOptions };
41
+ export { WebSocketSSE };
42
+ export type { WebSocketSSEOptions };
@@ -70,7 +70,7 @@ class WebSocketSSE extends _EventTarget {
70
70
  this.#sendController = controller;
71
71
  },
72
72
  cancel: () => {
73
- this.#sendController = undefined;
73
+ this.#sendController = void 0;
74
74
  }
75
75
  }).pipeThrough(new TextEncoderStream())
76
76
  }).catch(() => {
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "crossws",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Cross-platform WebSocket Servers for Node.js, Deno, Bun and Cloudflare Workers",
5
- "repository": "unjs/crossws",
5
+ "repository": "h3js/crossws",
6
+ "homepage": "https://crossws.h3.dev",
6
7
  "license": "MIT",
7
8
  "sideEffects": false,
8
9
  "type": "module",
@@ -87,33 +88,40 @@
87
88
  "uncrypto": "^0.1.3"
88
89
  },
89
90
  "devDependencies": {
90
- "@cloudflare/workers-types": "^4.20250124.3",
91
- "@types/bun": "^1.2.0",
92
- "@types/deno": "^2.0.0",
93
- "@types/eventsource": "^1.1.15",
94
- "@types/node": "^22.10.10",
95
- "@types/web": "^0.0.198",
96
- "@types/ws": "^8.5.14",
97
- "@vitest/coverage-v8": "^3.0.4",
98
- "automd": "^0.3.12",
99
- "changelogen": "^0.5.7",
100
- "consola": "^3.4.0",
101
- "eslint": "^9.18.0",
91
+ "@cloudflare/workers-types": "^4.20250506.0",
92
+ "@types/bun": "^1.2.12",
93
+ "@types/deno": "^2.3.0",
94
+ "@types/node": "^22.15.14",
95
+ "@types/web": "^0.0.232",
96
+ "@types/ws": "^8.18.1",
97
+ "@vitest/coverage-v8": "^3.1.3",
98
+ "automd": "^0.4.0",
99
+ "changelogen": "^0.6.1",
100
+ "consola": "^3.4.2",
101
+ "eslint": "^9.26.0",
102
102
  "eslint-config-unjs": "^0.4.2",
103
- "eventsource": "^3.0.2",
103
+ "eventsource": "^3.0.6",
104
104
  "execa": "^9.5.2",
105
105
  "get-port-please": "^3.1.2",
106
- "h3": "^1.14.0",
106
+ "h3": "^1.15.3",
107
107
  "jiti": "^2.4.2",
108
108
  "listhen": "^1.9.0",
109
- "prettier": "^3.4.2",
110
- "typescript": "^5.7.3",
109
+ "prettier": "^3.5.3",
110
+ "typescript": "^5.8.3",
111
111
  "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.44.0",
112
- "unbuild": "^3.3.1",
113
- "undici": "^7.3.0",
114
- "vitest": "^3.0.4",
115
- "wrangler": "^3.105.1",
116
- "ws": "^8.18.0"
112
+ "unbuild": "^3.5.0",
113
+ "undici": "^7.8.0",
114
+ "vitest": "^3.1.3",
115
+ "wrangler": "^4.14.1",
116
+ "ws": "^8.18.2"
117
117
  },
118
- "packageManager": "pnpm@9.15.4"
118
+ "packageManager": "pnpm@10.10.0",
119
+ "pnpm": {
120
+ "ignoredBuiltDependencies": [
121
+ "@parcel/watcher",
122
+ "esbuild",
123
+ "sharp",
124
+ "workerd"
125
+ ]
126
+ }
119
127
  }