diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a035af4d..1153f938 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,6 @@ jobs: strategy: matrix: node-version: - - 12 - 20 steps: diff --git a/lib/index.ts b/lib/index.ts index 3452ba4a..babe0bc5 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,6 +1,6 @@ -import cluster = require("cluster"); +import cluster from "node:cluster"; import { Adapter, BroadcastOptions, Room } from "socket.io-adapter"; -import { randomBytes } from "crypto"; +import { randomBytes } from "node:crypto"; const randomId = () => randomBytes(8).toString("hex"); const debug = require("debug")("socket.io-cluster-adapter"); @@ -297,7 +297,7 @@ export class ClusterAdapter extends Adapter { message.nsp ); - process.send(message, null, { swallowErrors: true }, ignoreError); + process.send(message, null, {}, ignoreError); } /** diff --git a/package-lock.json b/package-lock.json index 5fbba983..a32b1d27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "devDependencies": { "@types/expect.js": "^0.3.29", "@types/mocha": "^10.0.0", - "@types/node": "^15.12.4", + "@types/node": "~20.19.21", "expect.js": "0.3.1", "mocha": "^10.0.0", "nyc": "^15.1.0", @@ -22,7 +22,7 @@ "socket.io": "^4.6.1", "socket.io-client": "^4.7.1", "ts-node": "^9.1.1", - "typescript": "^4.0.5" + "typescript": "~5.9.3" }, "engines": { "node": ">=10.0.0" @@ -456,10 +456,14 @@ "dev": true }, "node_modules/@types/node": { - "version": "15.12.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.4.tgz", - "integrity": "sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==", - "dev": true + "version": "20.19.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.21.tgz", + "integrity": "sha512-CsGG2P3I5y48RPMfprQGfy4JPRZ6csfC3ltBZSRItG3ngggmNY/qs2uZKp4p9VbrpqNNSMzUZNFZKzgOGnd/VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } }, "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", @@ -2573,18 +2577,26 @@ } }, "node_modules/typescript": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz", - "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", @@ -3196,10 +3208,13 @@ "dev": true }, "@types/node": { - "version": "15.12.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.4.tgz", - "integrity": "sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==", - "dev": true + "version": "20.19.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.21.tgz", + "integrity": "sha512-CsGG2P3I5y48RPMfprQGfy4JPRZ6csfC3ltBZSRItG3ngggmNY/qs2uZKp4p9VbrpqNNSMzUZNFZKzgOGnd/VA==", + "dev": true, + "requires": { + "undici-types": "~6.21.0" + } }, "@ungap/promise-all-settled": { "version": "1.1.2", @@ -4766,9 +4781,15 @@ } }, "typescript": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz", - "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true + }, + "undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true }, "update-browserslist-db": { diff --git a/package.json b/package.json index 83e4916e..3e59d0c8 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "devDependencies": { "@types/expect.js": "^0.3.29", "@types/mocha": "^10.0.0", - "@types/node": "^15.12.4", + "@types/node": "~20.19.21", "expect.js": "0.3.1", "mocha": "^10.0.0", "nyc": "^15.1.0", @@ -35,7 +35,7 @@ "socket.io": "^4.6.1", "socket.io-client": "^4.7.1", "ts-node": "^9.1.1", - "typescript": "^4.0.5" + "typescript": "~5.9.3" }, "engines": { "node": ">=10.0.0" diff --git a/test/index.ts b/test/index.ts index ac5fb29a..36fcc116 100644 --- a/test/index.ts +++ b/test/index.ts @@ -2,8 +2,7 @@ import { io as ioc, Socket as ClientSocket } from "socket.io-client"; import expect = require("expect.js"); import { setupPrimary } from ".."; import { times, sleep } from "./util"; -import cluster = require("cluster"); -import { Worker } from "cluster"; +import cluster, { Worker } from "node:cluster"; const NODES_COUNT = 3; diff --git a/tsconfig.json b/tsconfig.json index 87d51bf0..bcd6128f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,8 @@ "allowJs": false, "target": "es2017", "module": "commonjs", - "declaration": true + "declaration": true, + "esModuleInterop": true }, "include": [ "./lib/**/*"