Comparing version 6.0.0-beta.19 to 6.0.0-beta.20
@@ -1,6 +0,6 @@ | ||
'use strict' | ||
"use strict" | ||
module.exports = { | ||
require: ['ts-node/register', 'rocha'], | ||
spec: ['test/unit/*-test.ts', 'test/unit/compat/*-test.{ts,js}'], | ||
require: ["ts-node/register", "rocha"], | ||
spec: ["test/unit/*-test.ts", "test/unit/compat/*-test.{ts,js}"], | ||
"expose-gc": true, | ||
@@ -7,0 +7,0 @@ "experimental-worker": true, |
## Unreleased | ||
* Improved TypeScript compatibility by supplying version-specific types for situations where generated TypeScript typings are not backwards compatible. This reduces the minimum required TypeScript version to 3.0. | ||
- Improved TypeScript compatibility by supplying version-specific types for | ||
situations where generated TypeScript typings are not backwards compatible. | ||
This reduces the minimum required TypeScript version to 3.0. | ||
### v6.0.0-beta.6 | ||
* BREAKING: When inadvertedly executing two concurrent send() or receive() operations the errno attribute of the error thrown is now EBUSY instead of EAGAIN. | ||
- BREAKING: When inadvertedly executing two concurrent send() or receive() | ||
operations the errno attribute of the error thrown is now EBUSY instead of | ||
EAGAIN. | ||
* Error messages for EBUSY are more specific. | ||
- Error messages for EBUSY are more specific. | ||
* Compatibility mode will now provide an implementation for bindSync()/unbindSync() if the 'deasync' package is available. | ||
- Compatibility mode will now provide an implementation for | ||
bindSync()/unbindSync() if the 'deasync' package is available. | ||
* Produce a warning when messages are still queued at process exit and context termination takes more than 500ms. | ||
- Produce a warning when messages are still queued at process exit and context | ||
termination takes more than 500ms. | ||
* Bump version requirement to Node.js 10.2, but reduce N-API version to 3 to support more 10.x Node.js versions. | ||
- Bump version requirement to Node.js 10.2, but reduce N-API version to 3 to | ||
support more 10.x Node.js versions. | ||
### v6.0.0-beta.5 | ||
* Check if properties are defined before defining them. This ensures compatibility with alternative file loaders, notably by the Jest test framework. | ||
- Check if properties are defined before defining them. This ensures | ||
compatibility with alternative file loaders, notably by the Jest test | ||
framework. | ||
* Performance of calling methods & validating arguments has been improved. | ||
- Performance of calling methods & validating arguments has been improved. | ||
* Header files from node-addon-api are now bundled to reduce runtime depedencies. | ||
- Header files from node-addon-api are now bundled to reduce runtime | ||
depedencies. | ||
### v6.0.0-beta.4 | ||
* Break out of busy loops automatically when the number of synchronous I/O operations moves beyond a built-in threshold. This avoids the ZeroMQ background I/O process(es) starving the Node.js event loop when it can process messages faster than the application. This could have caused decreased responsiveness and/or high memory usage. This only happens when sending/receiving messages as quickly as possible, such as in a benchmark or in test code. | ||
- Break out of busy loops automatically when the number of synchronous I/O | ||
operations moves beyond a built-in threshold. This avoids the ZeroMQ | ||
background I/O process(es) starving the Node.js event loop when it can process | ||
messages faster than the application. This could have caused decreased | ||
responsiveness and/or high memory usage. This only happens when | ||
sending/receiving messages as quickly as possible, such as in a benchmark or | ||
in test code. | ||
* Fixed a memory leak in socket construction that would manifest itself when repeatedly creating many sockets. | ||
- Fixed a memory leak in socket construction that would manifest itself when | ||
repeatedly creating many sockets. | ||
### v6.0.0-beta.3 | ||
* Error details have been added to the "handshake:error:protocol" and "handshake:error:auth" events. | ||
- Error details have been added to the "handshake:error:protocol" and | ||
"handshake:error:auth" events. | ||
* Reading from event observers now prevents the Node process from exiting, even if the underlying socket is no longer being used. | ||
- Reading from event observers now prevents the Node process from exiting, even | ||
if the underlying socket is no longer being used. | ||
* Reading or writing on unbound and unconnected sockets now prevents the Node process from exiting. | ||
- Reading or writing on unbound and unconnected sockets now prevents the Node | ||
process from exiting. | ||
### v6.0.0-beta.2 | ||
* Fix omission of "zeromq/v5-compat" export. | ||
- Fix omission of "zeromq/v5-compat" export. | ||
### v6.0.0-beta.1 | ||
* BREAKING: Complete rewrite of ZeroMQ.js with a modern and safe API. This version is based on ZeroMQ-NG version v5.0.0-beta.27. A compatibility layer for existing users of versions 5.x or earlier of ZeroMQ.js is available as "zeromq/v5-compat". | ||
- BREAKING: Complete rewrite of ZeroMQ.js with a modern and safe API. This | ||
version is based on ZeroMQ-NG version v5.0.0-beta.27. A compatibility layer | ||
for existing users of versions 5.x or earlier of ZeroMQ.js is available as | ||
"zeromq/v5-compat". | ||
### Previous changes | ||
* See https://github.com/rolftimmermans/zeromq-ng/blob/master/CHANGELOG.md for the changelog of the next generation API before the merge back into ZeroMQ.js. | ||
- See https://github.com/rolftimmermans/zeromq-ng/blob/master/CHANGELOG.md for | ||
the changelog of the next generation API before the merge back into ZeroMQ.js. | ||
* See https://github.com/zeromq/zeromq.js/blob/5.x/History.md for the changelog of the previous API before the merge of ZeroMQ-NG. | ||
- See https://github.com/zeromq/zeromq.js/blob/5.x/History.md for the changelog | ||
of the previous API before the merge of ZeroMQ-NG. |
"use strict"; | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -32,3 +55,3 @@ exports.options = exports.proxy = exports.curveKeypair = exports.createSocket = exports.socket = exports.Socket = exports.Context = exports.version = void 0; | ||
const events_1 = require("events"); | ||
const zmq = require("."); | ||
const zmq = __importStar(require(".")); | ||
let count = 1; | ||
@@ -35,0 +58,0 @@ const types = { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -15,3 +38,3 @@ exports.Stream = exports.XSubscriber = exports.XPublisher = exports.Push = exports.Pull = exports.Router = exports.Dealer = exports.Reply = exports.Request = exports.Subscriber = exports.Publisher = exports.Pair = exports.Proxy = exports.Observer = exports.Socket = exports.Context = exports.version = exports.curveKeyPair = exports.context = exports.capability = void 0; | ||
const native_2 = require("./native"); | ||
const draft = require("./draft"); | ||
const draft = __importStar(require("./draft")); | ||
/* Support async iteration over received messages. Implementing this in JS | ||
@@ -18,0 +41,0 @@ is faster as long as there is no C++ native API to chain promises. */ |
{ | ||
"name": "zeromq", | ||
"version": "6.0.0-beta.19", | ||
"version": "6.0.0-beta.20", | ||
"description": "Next-generation ZeroMQ bindings for Node.js", | ||
@@ -21,5 +21,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@aminya/node-gyp-build": "4.5.0-aminya.5", | ||
"@aminya/node-gyp-build": "4.8.1-aminya.1", | ||
"cross-env": "^7.0.3", | ||
"node-addon-api": "^7.0.0", | ||
"node-addon-api": "^7.1.0", | ||
"shelljs": "^0.8.5", | ||
@@ -29,35 +29,36 @@ "shx": "^0.3.4" | ||
"devDependencies": { | ||
"@types/chai": "^4.3.4", | ||
"@types/chai": "^4.3.16", | ||
"@types/fs-extra": "^9.0.13", | ||
"@types/mocha": "^10.0.0", | ||
"@types/node": "^18.11.9", | ||
"@types/semver": "^7.3.13", | ||
"@types/shelljs": "^0.8.11", | ||
"@types/weak-napi": "^2.0.1", | ||
"@types/which": "^2.0.1", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^18.19.34", | ||
"@types/semver": "^7.5.8", | ||
"@types/shelljs": "^0.8.15", | ||
"@types/which": "^2.0.2", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.3.7", | ||
"deasync": "^0.1.29", | ||
"chai": "^4.4.1", | ||
"deasync": "^0.1.30", | ||
"downlevel-dts": "^0.11.0", | ||
"electron-mocha": "^11.0.2", | ||
"eslint-config-atomic": "^1.18.1", | ||
"eslint": "^8", | ||
"eslint-config-atomic": "^1.22.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"execa": "^9.2.0", | ||
"fs-extra": "^10.1.0", | ||
"gh-pages": "^4.0.0", | ||
"minify-all-cli": "^1.0.13", | ||
"mocha": "^10.1.0", | ||
"node-gyp": "^10.0.1", | ||
"npm-run-all2": "^6.0.4", | ||
"prebuildify": "^5.0.1", | ||
"prettier": "^2.8.0", | ||
"mocha": "^10.4.0", | ||
"node-gyp": "^10.1.0", | ||
"npm-run-all2": "^6.2.0", | ||
"prebuildify": "^6.0.1", | ||
"prettier": "^2.8.8", | ||
"rocha": "^2.5.10", | ||
"semver": "^7.3.8", | ||
"ts-node": "~10.9.1", | ||
"typedoc": "^0.23.21", | ||
"typescript": "~4.9.3", | ||
"weak-napi": "^2.0.2", | ||
"which": "^3.0.0" | ||
"semver": "^7.6.2", | ||
"ts-node": "~10.9.2", | ||
"typedoc": "^0.25.13", | ||
"typescript": "~4.9.5", | ||
"which": "^3.0.1" | ||
}, | ||
"engines": { | ||
"node": ">= 10.2" | ||
"node": ">= 10.2", | ||
"pnpm": ">= 9" | ||
}, | ||
@@ -99,17 +100,18 @@ "files": [ | ||
"clean": "shx rm -rf ./build ./lib/ ./prebuilds ./script/*.js ./script/*.js.map ./script/*.d.ts ./script/*.tsbuildinfo", | ||
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep", | ||
"build.library.compat": "shx rm -rf ./lib/ts3.7 && downlevel-dts ./lib ./lib/ts3.7 --to=3.7", | ||
"build.library": "tsc -p ./src/tsconfig.json && run-s build.library.compat", | ||
"build.script": "tsc -p ./script/tsconfig.json", | ||
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp", | ||
"build.library": "tsc -p ./src/tsconfig.json", | ||
"build.script": "tsc -p ./script/tsconfig.json && tsc -p ./script/tsconfig.esm.json", | ||
"build.js": "run-p build.script build.library", | ||
"build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-raw -d docs --jsCompressor terser", | ||
"deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"", | ||
"prebuild": "run-s build.js && node ./script/prebuild.js", | ||
"build.native": "node-gyp configure --release && node-gyp build --release", | ||
"build.native.debug": "cross-env CMAKE_BUILD_TYPE=Debug node-gyp configure --debug && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug", | ||
"build.prebuild": "run-s build.js && node ./script/prebuild.mjs", | ||
"build.native": "node-gyp configure --release && node-gyp configure --release -- -f compile_commands_json && node-gyp build --release", | ||
"build.native.debug": "node-gyp configure --debug && node-gyp configure --debug -- -f compile_commands_json && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug", | ||
"build": "run-s build.js build.native", | ||
"build.debug": "run-s build.js build.native.debug", | ||
"test": "run-s build && mocha --exit", | ||
"test.skip_gc_tests": "run-s build.debug && cross-env SKIP_GC_TESTS=true mocha --exit", | ||
"test.electron.main": "run-s build && electron-mocha", | ||
"test.deps": "cd test && pnpm install && cd ..", | ||
"test": "run-s clean.temp test.deps build && mocha", | ||
"test.skip_gc_tests": "run-s clean.temp test.deps build.debug && cross-env SKIP_GC_TESTS=true mocha", | ||
"test.electron.main": "run-s clean.temp test.deps build && electron-mocha", | ||
"format": "prettier --write .", | ||
"test.electron.renderer": "run-s build && electron-mocha --renderer", | ||
@@ -116,0 +118,0 @@ "lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h", |
230
README.md
# ZeroMQ.js Next Generation | ||
[![Latest version](https://img.shields.io/npm/v/zeromq?label=version)](https://www.npmjs.com/package/zeromq) [![Greenkeeper monitoring](https://img.shields.io/badge/dependencies-monitored-brightgreen)](https://greenkeeper.io/) [![Travis build status](https://img.shields.io/travis/zeromq/zeromq.js)](https://travis-ci.org/zeromq/zeromq.js) | ||
[![Latest version](https://img.shields.io/npm/v/zeromq?label=version)](https://www.npmjs.com/package/zeromq) | ||
[![Greenkeeper monitoring](https://img.shields.io/badge/dependencies-monitored-brightgreen)](https://greenkeeper.io/) | ||
[![Travis build status](https://img.shields.io/travis/zeromq/zeromq.js)](https://travis-ci.org/zeromq/zeromq.js) | ||
@@ -10,30 +12,33 @@ ## ⚠️ Version 6.0.0 (in beta) features a brand new API that solves many fundamental issues and is recommended for new projects. ⚠️ | ||
[ØMQ](http://zeromq.org) bindings for Node.js. The goals of this library are: | ||
* Semantically similar to the [native](https://github.com/zeromq/libzmq) ØMQ library, while sticking to JavaScript idioms. | ||
* Use modern JavaScript and Node.js features such as `async`/`await` and async iterators. | ||
* High performance. | ||
* Fully usable with TypeScript (3+). | ||
- Semantically similar to the [native](https://github.com/zeromq/libzmq) ØMQ | ||
library, while sticking to JavaScript idioms. | ||
- Use modern JavaScript and Node.js features such as `async`/`await` and async | ||
iterators. | ||
- High performance. | ||
- Fully usable with TypeScript (3+). | ||
## Useful links | ||
* [ZeroMQ.js API reference](http://zeromq.github.io/zeromq.js/globals.html). | ||
* [ZeroMQ project documentation](https://zeromq.org/get-started/). | ||
* **Note:** The Node.js examples on zeromq.org do not yet reflect the new API, but [the Guide](http://zguide.zeromq.org) in particular is still a good introduction to ZeroMQ for new users. | ||
- [ZeroMQ.js API reference](http://zeromq.github.io/zeromq.js/modules.html). | ||
- [ZeroMQ project documentation](https://zeromq.org/get-started/). | ||
- **Note:** The Node.js examples on zeromq.org do not yet reflect the new API, | ||
but [the Guide](http://zguide.zeromq.org) in particular is still a good | ||
introduction to ZeroMQ for new users. | ||
## Table of contents | ||
* [Installation](#installation) | ||
* [Prebuilt binaries](#prebuilt-binaries) | ||
* [Building from source](#building-from-source) | ||
* [Examples](#examples) | ||
* [Push/Pull](#pushpull) | ||
* [Pub/Sub](#pubsub) | ||
* [Req/Rep](#reqrep) | ||
* [TypeScript](#typescript) | ||
* [More examples](#more-examples) | ||
* [Compatibility layer for version 4/5](#compatibility-layer-for-version-45) | ||
* [Contribution](#contribution) | ||
* [History](#history) | ||
- [Installation](#installation) | ||
- [Prebuilt binaries](#prebuilt-binaries) | ||
- [Building from source](#building-from-source) | ||
- [Examples](#examples) | ||
- [Push/Pull](#pushpull) | ||
- [Pub/Sub](#pubsub) | ||
- [Req/Rep](#reqrep) | ||
- [TypeScript](#typescript) | ||
- [More examples](#more-examples) | ||
- [Compatibility layer for version 4/5](#compatibility-layer-for-version-45) | ||
- [Contribution](#contribution) | ||
- [History](#history) | ||
## Installation | ||
@@ -44,3 +49,3 @@ | ||
```sh | ||
npm install zeromq@6.0.0-beta.19 | ||
npm install zeromq@6.0.0-beta.20 | ||
``` | ||
@@ -50,5 +55,5 @@ | ||
* Node.js 10.2+ or Electron 3+ (requires a [N-API](https://nodejs.org/api/n-api.html) version 3+) | ||
- Node.js 10.2+ or Electron 3+ (requires a | ||
[N-API](https://nodejs.org/api/n-api.html) version 3+) | ||
### Prebuilt binaries | ||
@@ -58,24 +63,27 @@ | ||
* Linux on x86-64 with libstdc++.so.6.0.21+ (glibc++ 3.4.21+), for example: | ||
* Debian 9+ (Stretch or later) | ||
* Ubuntu 16.04+ (Xenial or later) | ||
* CentOS 8+ | ||
* Linux on x86-64 with musl, for example: | ||
* Alpine 3.3+ | ||
* MacOS 10.9+ on x86-64 | ||
* Windows on x86/x86-64 | ||
- Linux on x86-64 with libstdc++.so.6.0.21+ (glibc++ 3.4.21+), for example: | ||
- Debian 9+ (Stretch or later) | ||
- Ubuntu 16.04+ (Xenial or later) | ||
- CentOS 8+ | ||
- Linux on x86-64 with musl, for example: | ||
- Alpine 3.3+ | ||
- MacOS 10.9+ on x86-64 | ||
- Windows on x86/x86-64 | ||
If a prebuilt binary is not available for your platform, installing will attempt to start a build from source. | ||
If a prebuilt binary is not available for your platform, installing will attempt | ||
to start a build from source. | ||
### Building from source | ||
If a prebuilt binary is unavailable or if you want to pass certain options during build, you can build this package from source. | ||
If a prebuilt binary is unavailable or if you want to pass certain options | ||
during build, you can build this package from source. | ||
Make sure you have the following installed before attempting to build from source: | ||
Make sure you have the following installed before attempting to build from | ||
source: | ||
* Node.js 10+ or Electron 3+ | ||
* A working C++17 compiler toolchain with make | ||
* Python 3 with Node 12.13+ (or legacy Python 2.7) | ||
* CMake 2.8+ | ||
* curl | ||
- Node.js 10+ or Electron 3+ | ||
- A working C++17 compiler toolchain with make | ||
- Python 3 with Node 12.13+ (or legacy Python 2.7) | ||
- CMake 2.8+ | ||
- curl | ||
@@ -85,16 +93,17 @@ To install from source: | ||
```sh | ||
npm install zeromq@6.0.0-beta.19 --build-from-source | ||
npm install zeromq@6.0.0-beta.20 --build-from-source | ||
``` | ||
If you want to link against a shared ZeroMQ library, you can build skip downloading `libzmq` and link with the | ||
installed library instead as follows: | ||
If you want to link against a shared ZeroMQ library, you can build skip | ||
downloading `libzmq` and link with the installed library instead as follows: | ||
```sh | ||
npm install zeromq@6.0.0-beta.19 --zmq-shared | ||
npm install zeromq@6.0.0-beta.20 --zmq-shared | ||
``` | ||
If you wish to use any DRAFT sockets then it is also necessary to compile the library from source: | ||
If you wish to use any DRAFT sockets then it is also necessary to compile the | ||
library from source: | ||
```sh | ||
npm install zeromq@6.0.0-beta.19 --zmq-draft | ||
npm install zeromq@6.0.0-beta.20 --zmq-draft | ||
``` | ||
@@ -104,4 +113,5 @@ | ||
**Note:** These examples assume the reader is familiar with ZeroMQ. If you are new to ZeroMQ, please start | ||
with the [ZeroMQ documentation](https://zeromq.org/get-started/). | ||
**Note:** These examples assume the reader is familiar with ZeroMQ. If you are | ||
new to ZeroMQ, please start with the | ||
[ZeroMQ documentation](https://zeromq.org/get-started/). | ||
@@ -112,4 +122,4 @@ More examples can be found in the [examples directory](examples). | ||
This example demonstrates how a producer pushes information onto a | ||
socket and how a worker pulls information from the socket. | ||
This example demonstrates how a producer pushes information onto a socket and | ||
how a worker pulls information from the socket. | ||
@@ -124,3 +134,3 @@ #### `producer.js` | ||
async function run() { | ||
const sock = new zmq.Push | ||
const sock = new zmq.Push() | ||
@@ -132,3 +142,5 @@ await sock.bind("tcp://127.0.0.1:3000") | ||
await sock.send("some work") | ||
await new Promise(resolve => { setTimeout(resolve, 500) }) | ||
await new Promise(resolve => { | ||
setTimeout(resolve, 500) | ||
}) | ||
} | ||
@@ -148,3 +160,3 @@ } | ||
async function run() { | ||
const sock = new zmq.Pull | ||
const sock = new zmq.Pull() | ||
@@ -175,3 +187,3 @@ sock.connect("tcp://127.0.0.1:3000") | ||
async function run() { | ||
const sock = new zmq.Publisher | ||
const sock = new zmq.Publisher() | ||
@@ -184,3 +196,5 @@ await sock.bind("tcp://127.0.0.1:3000") | ||
await sock.send(["kitty cats", "meow!"]) | ||
await new Promise(resolve => { setTimeout(resolve, 500) }) | ||
await new Promise(resolve => { | ||
setTimeout(resolve, 500) | ||
}) | ||
} | ||
@@ -200,3 +214,3 @@ } | ||
async function run() { | ||
const sock = new zmq.Subscriber | ||
const sock = new zmq.Subscriber() | ||
@@ -208,3 +222,8 @@ sock.connect("tcp://127.0.0.1:3000") | ||
for await (const [topic, msg] of sock) { | ||
console.log("received a message related to:", topic, "containing message:", msg) | ||
console.log( | ||
"received a message related to:", | ||
topic, | ||
"containing message:", | ||
msg, | ||
) | ||
} | ||
@@ -226,3 +245,3 @@ } | ||
async function run() { | ||
const sock = new zmq.Request | ||
const sock = new zmq.Request() | ||
@@ -247,3 +266,3 @@ sock.connect("tcp://127.0.0.1:3000") | ||
async function run() { | ||
const sock = new zmq.Reply | ||
const sock = new zmq.Reply() | ||
@@ -266,15 +285,14 @@ await sock.bind("tcp://127.0.0.1:3000") | ||
* For TypeScript version >= 3: | ||
* [compilerOptions](https://www.typescriptlang.org/docs/handbook/compiler-options.html) | ||
* For TypeScript version < 3.6: | ||
* either set `compilerOptions.target` to `esnext` or later (e.g. `es2018`) | ||
* or add the following, or similar, libraries to `compilerOptions.lib` | ||
(and include their corresponding polyfills if needed): | ||
`es2015`, `ESNext.AsyncIterable` | ||
- For TypeScript version >= 3: | ||
- [compilerOptions](https://www.typescriptlang.org/docs/handbook/compiler-options.html) | ||
- For TypeScript version < 3.6: | ||
- either set `compilerOptions.target` to `esnext` or later (e.g. `es2018`) | ||
- or add the following, or similar, libraries to `compilerOptions.lib` (and | ||
include their corresponding polyfills if needed): `es2015`, | ||
`ESNext.AsyncIterable` | ||
_Example Usage_ | ||
```typescript | ||
import { Request } from "zeromq" | ||
import {Request} from "zeromq" | ||
// or as namespace | ||
@@ -290,12 +308,15 @@ import * as zmq from "zeromq" | ||
More advanced examples can be found in the [examples](examples) directory of this repository. | ||
More advanced examples can be found in the [examples](examples) directory of | ||
this repository. | ||
Or you can [browse the API reference documentation](http://zeromq.github.io/zeromq.js/globals.html) to see all socket | ||
types, methods & options as well as more detailed information about how to apply them. | ||
Or you can | ||
[browse the API reference documentation](http://zeromq.github.io/zeromq.js/globals.html) | ||
to see all socket types, methods & options as well as more detailed information | ||
about how to apply them. | ||
### Compatibility layer for version 4/5 | ||
The next generation version of the library features a compatibility layer for ZeroMQ.js versions 4 and 5. This is | ||
recommended for users upgrading from previous versions. | ||
The next generation version of the library features a compatibility layer for | ||
ZeroMQ.js versions 4 and 5. This is recommended for users upgrading from | ||
previous versions. | ||
@@ -325,17 +346,20 @@ Example: | ||
If you are interested in making contributions to this project, please read the following sections. | ||
If you are interested in making contributions to this project, please read the | ||
following sections. | ||
### Dependencies | ||
In order to develop and test the library, you'll need the tools required to build from source ([see above](#building-from-source)). | ||
In order to develop and test the library, you'll need the tools required to | ||
build from source ([see above](#building-from-source)). | ||
Additionally, having clang-format is strongly recommended. | ||
### Defining new options | ||
Socket and context options can be set at runtime, even if they are not implemented by this library. By design, this | ||
requires no recompilation if the built version of ZeroMQ has support for them. This allows library users to test and | ||
use options that have been introduced in recent versions of ZeroMQ without having to modify this library. Of course | ||
we'd love to include support for new options in an idiomatic way. | ||
Socket and context options can be set at runtime, even if they are not | ||
implemented by this library. By design, this requires no recompilation if the | ||
built version of ZeroMQ has support for them. This allows library users to test | ||
and use options that have been introduced in recent versions of ZeroMQ without | ||
having to modify this library. Of course we'd love to include support for new | ||
options in an idiomatic way. | ||
@@ -364,10 +388,13 @@ Options can be set as follows: | ||
When submitting pull requests for new socket/context options, please consider the following: | ||
When submitting pull requests for new socket/context options, please consider | ||
the following: | ||
* The option is documented in the TypeScript interface. | ||
* The option is only added to relevant socket types, and if the ZMQ_ constant has a prefix indicating which type it | ||
applies to, it is stripped from the name as it is exposed in JavaScript. | ||
* The name as exposed in this library is idiomatic for JavaScript, spelling out any abbreviations and using proper | ||
`camelCase` naming conventions. | ||
* The option is a value that can be set on a socket, and you don't think it should actually be a method. | ||
- The option is documented in the TypeScript interface. | ||
- The option is only added to relevant socket types, and if the ZMQ\_ constant | ||
has a prefix indicating which type it applies to, it is stripped from the name | ||
as it is exposed in JavaScript. | ||
- The name as exposed in this library is idiomatic for JavaScript, spelling out | ||
any abbreviations and using proper `camelCase` naming conventions. | ||
- The option is a value that can be set on a socket, and you don't think it | ||
should actually be a method. | ||
@@ -384,11 +411,11 @@ ### Testing | ||
The test suite will validate and fix the coding style, run all unit tests and verify the validity of the included | ||
TypeScript type definitions. | ||
The test suite will validate and fix the coding style, run all unit tests and | ||
verify the validity of the included TypeScript type definitions. | ||
Some tests are not enabled by default: | ||
* API Compatibility tests from ZeroMQ 5.x have been disabled by default. You can include the tests with | ||
`INCLUDE_COMPAT_TESTS=1 npm run test` | ||
* Some transports are not reliable on some older versions of ZeroMQ, the relevant tests will be skipped for those | ||
versions automatically. | ||
- API Compatibility tests from ZeroMQ 5.x have been disabled by default. You can | ||
include the tests with `INCLUDE_COMPAT_TESTS=1 npm run test` | ||
- Some transports are not reliable on some older versions of ZeroMQ, the | ||
relevant tests will be skipped for those versions automatically. | ||
@@ -404,10 +431,15 @@ ### Publishing | ||
Wait for continuous integration to finish. Prebuilds will be generated for all supported platforms and attached to a Github release. Documentation is automatically generated and committed to `gh-pages`. Finally, a new NPM package version will be automatically released. | ||
Wait for continuous integration to finish. Prebuilds will be generated for all | ||
supported platforms and attached to a Github release. Documentation is | ||
automatically generated and committed to `gh-pages`. Finally, a new NPM package | ||
version will be automatically released. | ||
## History | ||
Version 6+ is a complete rewrite of previous versions of ZeroMQ.js in order to be more reliable, correct, and usable in | ||
modern JavaScript & TypeScript code as first outlined in [this issue](https://github.com/zeromq/zeromq.js/issues/189). | ||
Previous versions of ZeroMQ.js were based on `zmq` and a fork that included prebuilt binaries. | ||
Version 6+ is a complete rewrite of previous versions of ZeroMQ.js in order to | ||
be more reliable, correct, and usable in modern JavaScript & TypeScript code as | ||
first outlined in [this issue](https://github.com/zeromq/zeromq.js/issues/189). | ||
Previous versions of ZeroMQ.js were based on `zmq` and a fork that included | ||
prebuilt binaries. | ||
See detailed changes in the [CHANGELOG](CHANGELOG.md). |
@@ -10,3 +10,3 @@ "use strict"; | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/strict-boolean-expressions | ||
process.env.ZMQ_VERSION || "20de92ac0a2b2b9a1869782a429df68f93c3625e"; | ||
process.env.ZMQ_VERSION || "5657b4586f24ec433930e8ece02ddba7afcf0fe0"; | ||
const src_url = `https://github.com/zeromq/libzmq/archive/${zmq_rev}.tar.gz`; | ||
@@ -66,3 +66,3 @@ const libzmq_build_prefix = `${root}/build/libzmq-staging`; | ||
(0, shelljs_1.exec)(cmake_configure, execOptions); | ||
const cmake_build = `cmake --build ./build --config ${CMAKE_BUILD_TYPE} --target install`; | ||
const cmake_build = `cmake --build ./build --config ${CMAKE_BUILD_TYPE} --target install --parallel`; | ||
console.log(cmake_build); | ||
@@ -69,0 +69,0 @@ (0, shelljs_1.exec)(cmake_build, execOptions); |
@@ -10,3 +10,3 @@ import {dirname} from "path" | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/strict-boolean-expressions | ||
process.env.ZMQ_VERSION || "20de92ac0a2b2b9a1869782a429df68f93c3625e" | ||
process.env.ZMQ_VERSION || "5657b4586f24ec433930e8ece02ddba7afcf0fe0" | ||
const src_url = `https://github.com/zeromq/libzmq/archive/${zmq_rev}.tar.gz` | ||
@@ -86,3 +86,3 @@ | ||
const cmake_build = `cmake --build ./build --config ${CMAKE_BUILD_TYPE} --target install` | ||
const cmake_build = `cmake --build ./build --config ${CMAKE_BUILD_TYPE} --target install --parallel` | ||
console.log(cmake_build) | ||
@@ -89,0 +89,0 @@ exec(cmake_build, execOptions) |
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./" | ||
}, | ||
"include": ["./**/*.ts"], | ||
"exclude": [] | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./" | ||
}, | ||
"include": ["./**/*.ts"], | ||
"exclude": [] | ||
} |
@@ -7,6 +7,3 @@ { | ||
"module": "commonjs", | ||
"types": [ | ||
"node", | ||
"mocha" | ||
], | ||
"types": ["node", "mocha"], | ||
"strictPropertyInitialization": false, // TODO | ||
@@ -23,7 +20,5 @@ "strict": true, | ||
"sourceMap": true, | ||
"lib": [ | ||
"ES2020", | ||
"dom" | ||
] | ||
"esModuleInterop": true, | ||
"lib": ["ES2020", "dom"] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
11341034
100
424
13
+ Added@aminya/node-gyp-build@4.8.1-aminya.1(transitive)
- Removed@aminya/node-gyp-build@4.5.0-aminya.5(transitive)
Updatednode-addon-api@^7.1.0