@mtcute/node 0.28.2 → 0.29.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.
Files changed (3) hide show
  1. package/package.json +5 -5
  2. package/worker.cjs +2 -2
  3. package/worker.js +3 -3
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@mtcute/node",
3
3
  "type": "module",
4
- "version": "0.28.2",
4
+ "version": "0.29.0",
5
5
  "description": "Meta-package for Node.js",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
- "@mtcute/core": "^0.28.2",
9
- "@mtcute/html-parser": "^0.28.2",
10
- "@mtcute/markdown-parser": "^0.28.2",
11
- "@mtcute/wasm": "^0.27.8",
8
+ "@mtcute/core": "^0.29.0",
9
+ "@mtcute/html-parser": "^0.29.0",
10
+ "@mtcute/markdown-parser": "^0.29.0",
11
+ "@mtcute/wasm": "^0.29.0",
12
12
  "@fuman/utils": "0.0.19",
13
13
  "@fuman/net": "0.0.19",
14
14
  "@fuman/node": "0.0.19",
package/worker.cjs CHANGED
@@ -29,8 +29,8 @@ class TelegramWorkerPort extends worker_js.TelegramWorkerPort {
29
29
  });
30
30
  }
31
31
  connectToWorker(worker, handler) {
32
- if (!(worker instanceof node_worker_threads.Worker)) {
33
- throw new TypeError("Only worker_threads are supported");
32
+ if (!(worker instanceof node_worker_threads.Worker) && !(worker instanceof node_worker_threads.MessagePort)) {
33
+ throw new TypeError("Only worker_threads and MessagePorts are supported");
34
34
  }
35
35
  const send = worker.postMessage.bind(worker);
36
36
  worker.on("message", handler);
package/worker.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parentPort, Worker } from "node:worker_threads";
1
+ import { parentPort, Worker, MessagePort } from "node:worker_threads";
2
2
  import { TelegramWorker as TelegramWorker$1, TelegramWorkerPort as TelegramWorkerPort$1 } from "@mtcute/core/worker.js";
3
3
  import { NodePlatform } from "./utils/platform.js";
4
4
  class TelegramWorker extends TelegramWorker$1 {
@@ -22,8 +22,8 @@ class TelegramWorkerPort extends TelegramWorkerPort$1 {
22
22
  });
23
23
  }
24
24
  connectToWorker(worker, handler) {
25
- if (!(worker instanceof Worker)) {
26
- throw new TypeError("Only worker_threads are supported");
25
+ if (!(worker instanceof Worker) && !(worker instanceof MessagePort)) {
26
+ throw new TypeError("Only worker_threads and MessagePorts are supported");
27
27
  }
28
28
  const send = worker.postMessage.bind(worker);
29
29
  worker.on("message", handler);