ventiws 1.0.0-rc.1 → 1.0.0-rc.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/README.md +2 -2
- package/dist/index.cjs +9 -5
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +9 -5
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
A WebSocket implementation for Node.js with the API of
|
|
8
8
|
[`ws`](https://github.com/websockets/ws), delivered as a native addon whose framing
|
|
9
|
-
engine is written in Zig. It targets `ws` 8.
|
|
9
|
+
engine is written in Zig. It targets `ws` 8.22.0 and reproduces that release's
|
|
10
10
|
observable behaviour rather than its source. ventiws is not affiliated with the
|
|
11
11
|
`ws` project and vendors none of its code; the upstream API reference is vendored
|
|
12
12
|
as the pinned contract, credited in
|
|
13
13
|
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
14
14
|
|
|
15
|
-
**ventiws is at `1.0.0-rc.
|
|
15
|
+
**ventiws is at `1.0.0-rc.2`.** The surface may change between beta
|
|
16
16
|
releases. What "beta" means here is bounded: the `ws` compatibility
|
|
17
17
|
contract is tracked row by row in
|
|
18
18
|
[COMPATIBILITY.md](COMPATIBILITY.md), and the four places ventiws knowingly
|
package/dist/index.cjs
CHANGED
|
@@ -475,7 +475,7 @@ function trackClient(state, socket) {
|
|
|
475
475
|
}
|
|
476
476
|
//#endregion
|
|
477
477
|
//#region package.json
|
|
478
|
-
var version = "1.0.0-rc.
|
|
478
|
+
var version = "1.0.0-rc.2";
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region src/logging/lifecycle.ts
|
|
481
481
|
const CONTROL = /\p{Cc}/gu;
|
|
@@ -1389,9 +1389,9 @@ function closeConnection(state, code, reason) {
|
|
|
1389
1389
|
return;
|
|
1390
1390
|
}
|
|
1391
1391
|
if (state.readyState === 2) return;
|
|
1392
|
-
state.readyState = 2;
|
|
1393
1392
|
const closeCode = closeCodeOf(code);
|
|
1394
1393
|
const closeReason = toCloseReason(reason);
|
|
1394
|
+
state.readyState = 2;
|
|
1395
1395
|
if (state.codec !== null) {
|
|
1396
1396
|
closeFramed(state, closeCode, closeReason);
|
|
1397
1397
|
armCloseTimeout(state, state.closeTimeout);
|
|
@@ -2351,13 +2351,16 @@ function createWebSocketServer(socketClass, options, callback) {
|
|
|
2351
2351
|
//#endregion
|
|
2352
2352
|
//#region src/compat/client/protocols.ts
|
|
2353
2353
|
const TOKEN = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
|
|
2354
|
+
function invalidProtocols() {
|
|
2355
|
+
return createError("ERR_INVALID_OPTION", "An invalid or duplicated subprotocol was specified", SyntaxError);
|
|
2356
|
+
}
|
|
2354
2357
|
function normalizeProtocols(protocols) {
|
|
2355
2358
|
if (protocols === void 0) return [];
|
|
2356
2359
|
const list = typeof protocols === "string" ? [protocols] : protocols;
|
|
2357
|
-
if (!Array.isArray(list)) throw
|
|
2360
|
+
if (!Array.isArray(list)) throw invalidProtocols();
|
|
2358
2361
|
const seen = /* @__PURE__ */ new Set();
|
|
2359
2362
|
for (const protocol of list) {
|
|
2360
|
-
if (typeof protocol !== "string" || !TOKEN.test(protocol) || seen.has(protocol)) throw
|
|
2363
|
+
if (typeof protocol !== "string" || !TOKEN.test(protocol) || seen.has(protocol)) throw invalidProtocols();
|
|
2361
2364
|
seen.add(protocol);
|
|
2362
2365
|
}
|
|
2363
2366
|
return [...list];
|
|
@@ -2814,6 +2817,7 @@ function normalizeClientOptions(options) {
|
|
|
2814
2817
|
skipUTF8Validation: source.skipUTF8Validation ?? false,
|
|
2815
2818
|
allowSynchronousEvents: source.allowSynchronousEvents ?? true,
|
|
2816
2819
|
autoPong: source.autoPong ?? true,
|
|
2820
|
+
protocols: source.protocols,
|
|
2817
2821
|
closeTimeout: closeTimeoutOf(source),
|
|
2818
2822
|
perMessageDeflate: normalizePerMessageDeflate(source.perMessageDeflate, true),
|
|
2819
2823
|
origin: source.origin,
|
|
@@ -3211,7 +3215,7 @@ function dial(attempt) {
|
|
|
3211
3215
|
function connectSocket(address, protocols, options) {
|
|
3212
3216
|
const normalized = normalizeClientOptions(options);
|
|
3213
3217
|
const parsed = parseAddress(address);
|
|
3214
|
-
const requested = normalizeProtocols(protocols);
|
|
3218
|
+
const requested = normalizeProtocols(protocols === void 0 ? normalized.protocols : protocols);
|
|
3215
3219
|
const state = createSocketState();
|
|
3216
3220
|
state.isServer = false;
|
|
3217
3221
|
state.url = parsed.url;
|
package/dist/index.d.cts
CHANGED
|
@@ -202,6 +202,8 @@ declare namespace WebSocket$1 {
|
|
|
202
202
|
allowSynchronousEvents?: boolean | undefined;
|
|
203
203
|
autoPong?: boolean | undefined;
|
|
204
204
|
maxPayload?: number | undefined;
|
|
205
|
+
maxBufferedChunks?: number | undefined;
|
|
206
|
+
maxFragments?: number | undefined;
|
|
205
207
|
skipUTF8Validation?: boolean | undefined;
|
|
206
208
|
createConnection?: typeof createConnection | undefined;
|
|
207
209
|
finishRequest?: FinishRequestCallback | undefined;
|
|
@@ -271,6 +273,8 @@ declare namespace WebSocket$1 {
|
|
|
271
273
|
clientTracking?: boolean | undefined;
|
|
272
274
|
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;
|
|
273
275
|
maxPayload?: number | undefined;
|
|
276
|
+
maxBufferedChunks?: number | undefined;
|
|
277
|
+
maxFragments?: number | undefined;
|
|
274
278
|
skipUTF8Validation?: boolean | undefined;
|
|
275
279
|
WebSocket?: U | undefined;
|
|
276
280
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -203,6 +203,8 @@ declare namespace WebSocket$1 {
|
|
|
203
203
|
allowSynchronousEvents?: boolean | undefined;
|
|
204
204
|
autoPong?: boolean | undefined;
|
|
205
205
|
maxPayload?: number | undefined;
|
|
206
|
+
maxBufferedChunks?: number | undefined;
|
|
207
|
+
maxFragments?: number | undefined;
|
|
206
208
|
skipUTF8Validation?: boolean | undefined;
|
|
207
209
|
createConnection?: typeof createConnection | undefined;
|
|
208
210
|
finishRequest?: FinishRequestCallback | undefined;
|
|
@@ -272,6 +274,8 @@ declare namespace WebSocket$1 {
|
|
|
272
274
|
clientTracking?: boolean | undefined;
|
|
273
275
|
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;
|
|
274
276
|
maxPayload?: number | undefined;
|
|
277
|
+
maxBufferedChunks?: number | undefined;
|
|
278
|
+
maxFragments?: number | undefined;
|
|
275
279
|
skipUTF8Validation?: boolean | undefined;
|
|
276
280
|
WebSocket?: U | undefined;
|
|
277
281
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -448,7 +448,7 @@ function trackClient(state, socket) {
|
|
|
448
448
|
}
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region package.json
|
|
451
|
-
var version = "1.0.0-rc.
|
|
451
|
+
var version = "1.0.0-rc.2";
|
|
452
452
|
//#endregion
|
|
453
453
|
//#region src/logging/lifecycle.ts
|
|
454
454
|
const CONTROL = /\p{Cc}/gu;
|
|
@@ -1362,9 +1362,9 @@ function closeConnection(state, code, reason) {
|
|
|
1362
1362
|
return;
|
|
1363
1363
|
}
|
|
1364
1364
|
if (state.readyState === 2) return;
|
|
1365
|
-
state.readyState = 2;
|
|
1366
1365
|
const closeCode = closeCodeOf(code);
|
|
1367
1366
|
const closeReason = toCloseReason(reason);
|
|
1367
|
+
state.readyState = 2;
|
|
1368
1368
|
if (state.codec !== null) {
|
|
1369
1369
|
closeFramed(state, closeCode, closeReason);
|
|
1370
1370
|
armCloseTimeout(state, state.closeTimeout);
|
|
@@ -2324,13 +2324,16 @@ function createWebSocketServer(socketClass, options, callback) {
|
|
|
2324
2324
|
//#endregion
|
|
2325
2325
|
//#region src/compat/client/protocols.ts
|
|
2326
2326
|
const TOKEN = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
|
|
2327
|
+
function invalidProtocols() {
|
|
2328
|
+
return createError("ERR_INVALID_OPTION", "An invalid or duplicated subprotocol was specified", SyntaxError);
|
|
2329
|
+
}
|
|
2327
2330
|
function normalizeProtocols(protocols) {
|
|
2328
2331
|
if (protocols === void 0) return [];
|
|
2329
2332
|
const list = typeof protocols === "string" ? [protocols] : protocols;
|
|
2330
|
-
if (!Array.isArray(list)) throw
|
|
2333
|
+
if (!Array.isArray(list)) throw invalidProtocols();
|
|
2331
2334
|
const seen = /* @__PURE__ */ new Set();
|
|
2332
2335
|
for (const protocol of list) {
|
|
2333
|
-
if (typeof protocol !== "string" || !TOKEN.test(protocol) || seen.has(protocol)) throw
|
|
2336
|
+
if (typeof protocol !== "string" || !TOKEN.test(protocol) || seen.has(protocol)) throw invalidProtocols();
|
|
2334
2337
|
seen.add(protocol);
|
|
2335
2338
|
}
|
|
2336
2339
|
return [...list];
|
|
@@ -2787,6 +2790,7 @@ function normalizeClientOptions(options) {
|
|
|
2787
2790
|
skipUTF8Validation: source.skipUTF8Validation ?? false,
|
|
2788
2791
|
allowSynchronousEvents: source.allowSynchronousEvents ?? true,
|
|
2789
2792
|
autoPong: source.autoPong ?? true,
|
|
2793
|
+
protocols: source.protocols,
|
|
2790
2794
|
closeTimeout: closeTimeoutOf(source),
|
|
2791
2795
|
perMessageDeflate: normalizePerMessageDeflate(source.perMessageDeflate, true),
|
|
2792
2796
|
origin: source.origin,
|
|
@@ -3184,7 +3188,7 @@ function dial(attempt) {
|
|
|
3184
3188
|
function connectSocket(address, protocols, options) {
|
|
3185
3189
|
const normalized = normalizeClientOptions(options);
|
|
3186
3190
|
const parsed = parseAddress(address);
|
|
3187
|
-
const requested = normalizeProtocols(protocols);
|
|
3191
|
+
const requested = normalizeProtocols(protocols === void 0 ? normalized.protocols : protocols);
|
|
3188
3192
|
const state = createSocketState();
|
|
3189
3193
|
state.isServer = false;
|
|
3190
3194
|
state.url = parsed.url;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ventiws",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"description": "A drop-in replacement for ws for Node.js, built on the first-party µWebZockets Zig engine via napi-zig.",
|
|
5
5
|
"homepage": "https://github.com/farbenbuilds/ventiws#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"node": ">=22.12.0"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@ventiws/binding-darwin-arm64": "1.0.0-rc.
|
|
38
|
-
"@ventiws/binding-darwin-x64": "1.0.0-rc.
|
|
39
|
-
"@ventiws/binding-linux-arm64-gnu": "1.0.0-rc.
|
|
40
|
-
"@ventiws/binding-linux-x64-gnu": "1.0.0-rc.
|
|
41
|
-
"@ventiws/binding-linux-x64-musl": "1.0.0-rc.
|
|
37
|
+
"@ventiws/binding-darwin-arm64": "1.0.0-rc.2",
|
|
38
|
+
"@ventiws/binding-darwin-x64": "1.0.0-rc.2",
|
|
39
|
+
"@ventiws/binding-linux-arm64-gnu": "1.0.0-rc.2",
|
|
40
|
+
"@ventiws/binding-linux-x64-gnu": "1.0.0-rc.2",
|
|
41
|
+
"@ventiws/binding-linux-x64-musl": "1.0.0-rc.2"
|
|
42
42
|
}
|
|
43
43
|
}
|