@encharm/cws 4.8.3 → 4.8.4
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/CHANGELOG.md +3 -0
- package/CLAUDE.md +1 -1
- package/README.md +1 -0
- package/package.json +2 -2
- package/scripts/install.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
## Released 4.8.4
|
|
2
|
+
* `npm install` no longer rebuilds the binding from source when a prebuilt one matches the platform and Node ABI. Since the node-gyp fallback was repaired in 4.8.0, every install on a machine with a compiler was silently replacing the shipped zlib-ng binding with a Node-zlib build. `CWS_FORCE_BUILD=1` forces the source build.
|
|
3
|
+
|
|
1
4
|
## Released 4.8.3
|
|
2
5
|
* Corked sends up to 1 KB use the per-loop block pool instead of malloc/free per message; queued messages remember their pool block. Also initialise the `reserved` callback argument, which was passed uninitialised for messages that hit the write queue.
|
|
3
6
|
* JS: resolve the native namespace once per socket instead of on every `send`/`close`/`ping`.
|
package/CLAUDE.md
CHANGED
|
@@ -21,7 +21,7 @@ Tests bind ports 3000 (ws) and 3001 (wss, certs in `tests/certs/`). The test fil
|
|
|
21
21
|
|
|
22
22
|
### Building the release binaries (multi-ABI)
|
|
23
23
|
|
|
24
|
-
`binding.gyp` is only used by `npm install` for a local build against the running Node (Node's zlib, no zlib-ng); it must carry the same include path and defines as the Makefile or it fails silently (the install script discards the exit code). Release binaries are built by the `Makefile` (macOS/Linux) and `make.bat` (Windows), which:
|
|
24
|
+
`binding.gyp` is only used by `npm install` for a local build against the running Node (Node's zlib, no zlib-ng), and only when `scripts/install.js` finds no prebuilt binding for the platform/ABI (`CWS_FORCE_BUILD=1` overrides); it must carry the same include path and defines as the Makefile or it fails silently (the install script discards the exit code). Release binaries are built by the `Makefile` (macOS/Linux) and `make.bat` (Windows), which:
|
|
25
25
|
|
|
26
26
|
1. Download official Node header tarballs for one pinned version per supported major into `targets/` (`VER_115`=Node 20, `VER_127`=Node 22, `VER_137`=Node 24, `VER_147`=Node 26; the number is the Node ABI / `process.versions.modules`).
|
|
27
27
|
2. Compile `src/*.cpp` once per ABI with `g++`/`cl` directly, with `-I src/headers/$V` for the matching Node major.
|
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ This table is true if you run ssl directly with `cws` (`Node.js`). In case if yo
|
|
|
14
14
|
|
|
15
15
|
| cWS Version | Node 26 | Node 24 | Node 22 | Node 20 |
|
|
16
16
|
|-------------|---------|----------|---------|----------
|
|
17
|
+
| 4.8.4 | X | X | X | X |
|
|
17
18
|
| 4.8.3 | X | X | X | X |
|
|
18
19
|
| 4.8.2 | X | X | X | X |
|
|
19
20
|
| 4.8.1 | X | X | X | X |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@encharm/cws",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.4",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"description": "cWS - fast C++ WebSocket implementation for Node.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"lint": "tslint -c tslint.json 'lib/**/*.ts'",
|
|
9
9
|
"test": "nyc mocha './tests/**/*.test.ts' --exit",
|
|
10
10
|
"clean": "rimraf dist/bindings/*",
|
|
11
|
-
"install": "node
|
|
11
|
+
"install": "node scripts/install.js",
|
|
12
12
|
"build-ts": "rimraf dist/*.js && rimraf dist/*.ts && npm run lint && tsc",
|
|
13
13
|
"build-cpp": "node-gyp rebuild > build_log.txt 2>&1 || exit 0"
|
|
14
14
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// npm/yarn `install` hook. The package ships prebuilt bindings under dist/bindings; only
|
|
2
|
+
// fall back to a node-gyp source build (against Node's own zlib, no zlib-ng) when none
|
|
3
|
+
// matches this platform and Node ABI. Set CWS_FORCE_BUILD=1 to build regardless.
|
|
4
|
+
// The build is best effort: failures are logged to build_log.txt and never fail the install.
|
|
5
|
+
'use strict';
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { spawnSync } = require('child_process');
|
|
9
|
+
|
|
10
|
+
const root = path.join(__dirname, '..');
|
|
11
|
+
const binding = path.join(root, 'dist', 'bindings', `cws_${process.platform}_${process.arch}_node${process.versions.modules}.node`);
|
|
12
|
+
|
|
13
|
+
if (fs.existsSync(binding) && !process.env.CWS_FORCE_BUILD) {
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const log = fs.openSync(path.join(root, 'build_log.txt'), 'w');
|
|
18
|
+
fs.writeSync(log, process.env.CWS_FORCE_BUILD ? `CWS_FORCE_BUILD set, building from source (prebuilt: ${binding})\n` : `no prebuilt binding at ${binding}, building from source\n`);
|
|
19
|
+
spawnSync('node-gyp', ['rebuild'], { cwd: root, stdio: ['ignore', log, log], shell: true });
|
|
20
|
+
fs.closeSync(log);
|
|
21
|
+
process.exit(0);
|