@mtcute/node 0.24.3 → 0.25.2
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/client.cjs +1 -1
- package/index.cjs +1 -1
- package/methods/download-file.cjs +1 -1
- package/methods/download-node-stream.cjs +1 -1
- package/methods.cjs +1 -1
- package/package.json +4 -4
- package/sqlite/driver.cjs +1 -1
- package/sqlite/index.cjs +1 -1
- package/utils/crypto.cjs +1 -1
- package/utils/exit-hook.cjs +1 -1
- package/utils/logging.cjs +1 -1
- package/utils/normalize-file.cjs +1 -1
- package/utils/platform.cjs +1 -1
- package/utils/proxies.cjs +1 -1
- package/utils/tcp.cjs +1 -1
- package/utils.cjs +1 -1
- package/worker.cjs +5 -8
- package/worker.d.cts +2 -1
- package/worker.d.ts +2 -1
- package/worker.js +4 -7
package/client.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/methods.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.2",
|
|
5
5
|
"description": "Meta-package for Node.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@mtcute/core": "^0.
|
|
9
|
-
"@mtcute/html-parser": "^0.
|
|
10
|
-
"@mtcute/markdown-parser": "^0.
|
|
8
|
+
"@mtcute/core": "^0.25.2",
|
|
9
|
+
"@mtcute/html-parser": "^0.25.0",
|
|
10
|
+
"@mtcute/markdown-parser": "^0.25.1",
|
|
11
11
|
"@mtcute/wasm": "^0.24.3",
|
|
12
12
|
"@fuman/utils": "0.0.15",
|
|
13
13
|
"@fuman/net": "0.0.15",
|
package/sqlite/driver.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/sqlite/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils/crypto.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils/exit-hook.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils/logging.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils/normalize-file.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils/platform.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils/proxies.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils/tcp.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/utils.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
package/worker.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
2
|
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
-
console.warn("[@mtcute/node] CommonJS
|
|
3
|
+
console.warn("[@mtcute/node] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
4
|
console.warn("[@mtcute/node] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
@@ -8,26 +8,23 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
8
8
|
const node_worker_threads = require("node:worker_threads");
|
|
9
9
|
const worker_js = require("@mtcute/core/worker.js");
|
|
10
10
|
const platform = require("./utils/platform.cjs");
|
|
11
|
-
let _registered = false;
|
|
12
11
|
class TelegramWorker extends worker_js.TelegramWorker {
|
|
13
12
|
registerWorker(handler) {
|
|
14
13
|
if (!node_worker_threads.parentPort) {
|
|
15
14
|
throw new Error("TelegramWorker must be created from a worker thread");
|
|
16
15
|
}
|
|
17
|
-
if (_registered) {
|
|
18
|
-
throw new Error("TelegramWorker must be created only once");
|
|
19
|
-
}
|
|
20
|
-
_registered = true;
|
|
21
16
|
const port = node_worker_threads.parentPort;
|
|
22
17
|
const respond = port.postMessage.bind(port);
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const messageHandler = (message) => handler(message, respond);
|
|
19
|
+
port.on("message", messageHandler);
|
|
20
|
+
return [respond, () => port.off("message", messageHandler)];
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
23
|
class TelegramWorkerPort extends worker_js.TelegramWorkerPort {
|
|
28
24
|
constructor(options) {
|
|
29
25
|
super({
|
|
30
26
|
worker: options.worker,
|
|
27
|
+
workerId: options.workerId,
|
|
31
28
|
platform: new platform.NodePlatform()
|
|
32
29
|
});
|
|
33
30
|
}
|
package/worker.d.cts
CHANGED
|
@@ -2,9 +2,10 @@ import { ClientMessageHandler, RespondFn, SendFn, SomeWorker, TelegramWorkerOpti
|
|
|
2
2
|
export type { TelegramWorkerOptions, WorkerCustomMethods };
|
|
3
3
|
export interface TelegramWorkerPortOptions {
|
|
4
4
|
worker: SomeWorker;
|
|
5
|
+
workerId?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare class TelegramWorker<T extends WorkerCustomMethods> extends TelegramWorkerBase<T> {
|
|
7
|
-
registerWorker(handler: WorkerMessageHandler): RespondFn;
|
|
8
|
+
registerWorker(handler: WorkerMessageHandler): [RespondFn, VoidFunction];
|
|
8
9
|
}
|
|
9
10
|
export declare class TelegramWorkerPort<T extends WorkerCustomMethods> extends TelegramWorkerPortBase<T> {
|
|
10
11
|
constructor(options: TelegramWorkerPortOptions);
|
package/worker.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { ClientMessageHandler, RespondFn, SendFn, SomeWorker, TelegramWorkerOpti
|
|
|
2
2
|
export type { TelegramWorkerOptions, WorkerCustomMethods };
|
|
3
3
|
export interface TelegramWorkerPortOptions {
|
|
4
4
|
worker: SomeWorker;
|
|
5
|
+
workerId?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare class TelegramWorker<T extends WorkerCustomMethods> extends TelegramWorkerBase<T> {
|
|
7
|
-
registerWorker(handler: WorkerMessageHandler): RespondFn;
|
|
8
|
+
registerWorker(handler: WorkerMessageHandler): [RespondFn, VoidFunction];
|
|
8
9
|
}
|
|
9
10
|
export declare class TelegramWorkerPort<T extends WorkerCustomMethods> extends TelegramWorkerPortBase<T> {
|
|
10
11
|
constructor(options: TelegramWorkerPortOptions);
|
package/worker.js
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import { parentPort, Worker } 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
|
-
let _registered = false;
|
|
5
4
|
class TelegramWorker extends TelegramWorker$1 {
|
|
6
5
|
registerWorker(handler) {
|
|
7
6
|
if (!parentPort) {
|
|
8
7
|
throw new Error("TelegramWorker must be created from a worker thread");
|
|
9
8
|
}
|
|
10
|
-
if (_registered) {
|
|
11
|
-
throw new Error("TelegramWorker must be created only once");
|
|
12
|
-
}
|
|
13
|
-
_registered = true;
|
|
14
9
|
const port = parentPort;
|
|
15
10
|
const respond = port.postMessage.bind(port);
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const messageHandler = (message) => handler(message, respond);
|
|
12
|
+
port.on("message", messageHandler);
|
|
13
|
+
return [respond, () => port.off("message", messageHandler)];
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
class TelegramWorkerPort extends TelegramWorkerPort$1 {
|
|
21
17
|
constructor(options) {
|
|
22
18
|
super({
|
|
23
19
|
worker: options.worker,
|
|
20
|
+
workerId: options.workerId,
|
|
24
21
|
platform: new NodePlatform()
|
|
25
22
|
});
|
|
26
23
|
}
|