Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): npm:mqtt compatibility #27792

Merged
merged 9 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add a spec test
  • Loading branch information
kt3k committed Jan 24, 2025
commit dac73670c795344559233e70682ada5b8a41ca87
Binary file not shown.
73 changes: 73 additions & 0 deletions tests/registry/npm/bufferutil/registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "bufferutil",
"dist-tags": {
"latest": "4.0.9"
},
"versions": {
"4.0.9": {
"name": "bufferutil",
"version": "4.0.9",
"description": "WebSocket buffer utils",
"main": "index.js",
"engines": {
"node": ">=6.14.2"
},
"scripts": {
"install": "node-gyp-build",
"prebuild": "prebuildify --napi --strip --target=8.11.2",
"prebuild-darwin-x64+arm64": "prebuildify --arch x64+arm64 --napi --strip --target=8.11.2",
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/websockets/bufferutil.git"
},
"author": {
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com",
"url": "http://2x.io"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/websockets/bufferutil/issues"
},
"dependencies": {
"node-gyp-build": "^4.3.0"
},
"devDependencies": {
"mocha": "^11.0.1",
"node-gyp": "^11.0.0",
"prebuildify": "^6.0.0"
},
"_id": "bufferutil@4.0.9",
"gitHead": "35e2eb6a14a8d58b87bc1f9ff2ddff67e2f1fa97",
"_nodeVersion": "23.5.0",
"_npmVersion": "10.9.2",
"dist": {
"integrity": "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==",
"shasum": "6e81739ad48a95cad45a279588e13e95e24a800a",
"tarball": "http://localhost:4260/bufferutil/bufferutil-4.0.9.tgz",
"fileCount": 11,
"unpackedSize": 371859
},
"directories": {},
"_hasShrinkwrap": false
}
},
"bugs": {
"url": "https://github.com/websockets/bufferutil/issues"
},
"author": {
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com",
"url": "http://2x.io"
},
"license": "MIT",
"homepage": "https://github.com/websockets/bufferutil",
"repository": {
"type": "git",
"url": "git+https://github.com/websockets/bufferutil.git"
},
"description": "WebSocket buffer utils",
"readmeFilename": "README.md"
}
75 changes: 75 additions & 0 deletions tests/registry/npm/utf-8-validate/registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "utf-8-validate",
"dist-tags": {
"latest": "6.0.5"
},
"versions": {
"6.0.5": {
"name": "utf-8-validate",
"version": "6.0.5",
"description": "Check if a buffer contains valid UTF-8",
"main": "index.js",
"engines": {
"node": ">=6.14.2"
},
"scripts": {
"install": "node-gyp-build",
"prebuild": "prebuildify --napi --strip --target=8.11.2",
"prebuild-linux-musl-x64": "prebuildify-cross --image alpine --napi --strip --target=8.11.2",
"prebuild-darwin-x64+arm64": "prebuildify --arch x64+arm64 --napi --strip --target=8.11.2",
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/websockets/utf-8-validate.git"
},
"author": {
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com",
"url": "http://2x.io"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/websockets/utf-8-validate/issues"
},
"dependencies": {
"node-gyp-build": "^4.3.0"
},
"devDependencies": {
"mocha": "^10.0.0",
"node-gyp": "^10.0.1",
"prebuildify": "^6.0.0",
"prebuildify-cross": "^5.0.0"
},
"_id": "utf-8-validate@6.0.5",
"gitHead": "4a9a05728641674620818c6a78b01fce38e6f222",
"_nodeVersion": "22.10.0",
"_npmVersion": "10.9.0",
"dist": {
"integrity": "sha512-EYZR+OpIXp9Y1eG1iueg8KRsY8TuT8VNgnanZ0uA3STqhHQTLwbl+WX76/9X5OY12yQubymBpaBSmMPkSTQcKA==",
"shasum": "8087d39902be2cc15bdb21a426697ff256d65aab",
"tarball": "http://localhost:4260/utf-8-validate/utf-8-validate-6.0.5.tgz",
"fileCount": 15,
"unpackedSize": 717511
},
"directories": {},
"_hasShrinkwrap": false
}
},
"bugs": {
"url": "https://github.com/websockets/utf-8-validate/issues"
},
"author": {
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com",
"url": "http://2x.io"
},
"license": "MIT",
"homepage": "https://github.com/websockets/utf-8-validate",
"repository": {
"type": "git",
"url": "git+https://github.com/websockets/utf-8-validate.git"
},
"description": "Check if a buffer contains valid UTF-8",
"readmeFilename": "README.md"
}
Binary file not shown.
97 changes: 97 additions & 0 deletions tests/registry/npm/ws/registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"name": "ws",
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
"dist-tags": {
"latest": "8.18.0"
},
"versions": {
"8.18.0": {
"name": "ws",
"version": "8.18.0",
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
"bugs": {
"url": "https://github.com/websockets/ws/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/websockets/ws.git"
},
"author": {
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com",
"url": "http://2x.io"
},
"license": "MIT",
"main": "index.js",
"exports": {
".": {
"browser": "./browser.js",
"import": "./wrapper.mjs",
"require": "./index.js"
},
"./package.json": "./package.json"
},
"browser": "browser.js",
"engines": {
"node": ">=10.0.0"
},
"scripts": {
"test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js",
"integration": "mocha --throw-deprecation test/*.integration.js",
"lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
},
"devDependencies": {
"benchmark": "^2.1.4",
"bufferutil": "^4.0.1",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"globals": "^15.0.0",
"mocha": "^8.4.0",
"nyc": "^15.0.0",
"prettier": "^3.0.0",
"utf-8-validate": "^6.0.0"
},
"_id": "ws@8.18.0",
"gitHead": "976c53c4065c49ede73bfba824caf5a6e0f290cb",
"_nodeVersion": "22.4.0",
"_npmVersion": "10.8.1",
"dist": {
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
"shasum": "0d7505a6eafe2b0e712d232b42279f53bc289bbc",
"tarball": "http://localhost:4260/ws/ws-8.18.0.tgz",
"fileCount": 19,
"unpackedSize": 146647
},
"directories": {},
"_hasShrinkwrap": false
}
},
"author": {
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com",
"url": "http://2x.io"
},
"repository": {
"type": "git",
"url": "git+https://github.com/websockets/ws.git"
},
"license": "MIT",
"homepage": "https://github.com/websockets/ws",
"bugs": {
"url": "https://github.com/websockets/ws/issues"
},
"readmeFilename": "README.md"
}
Binary file added tests/registry/npm/ws/ws-8.18.0.tgz
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/specs/npm/ws_compat/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "run -A --cert=../../../testdata/tls/RootCA.pem main.ts",
"output": "main.out"
}
4 changes: 4 additions & 0 deletions tests/specs/npm/ws_compat/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[WILDCARD]
open on server
open on client
message on server
24 changes: 24 additions & 0 deletions tests/specs/npm/ws_compat/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import WebSocket from "npm:ws@8.18.0";

const key = Deno.readTextFileSync("../../../testdata/tls/localhost.key");
const cert = Deno.readTextFileSync("../../../testdata/tls/localhost.crt");

Deno.serve({ key, cert, port: 0, onListen }, (req) => {
const { socket, response } = Deno.upgradeWebSocket(req);
socket.addEventListener("open", () => {
console.log("open on server");
});
socket.addEventListener("message", () => {
console.log("message on server");
Deno.exit(0);
});
return response;
});

function onListen({ port }) {
const socket = new WebSocket(`wss://localhost:${port}`);
socket.on("open", () => {
console.log("open on client");
socket.send("hi");
});
}
Loading