njs-modbus 3.1.0 → 3.1.1

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/dist/index.cjs CHANGED
@@ -1194,12 +1194,6 @@ class UdpServerPhysicalLayer extends AbstractPhysicalLayer {
1194
1194
  super();
1195
1195
  this._opts = options ?? {};
1196
1196
  }
1197
- /**
1198
- * Bind the UDP socket and start accepting datagrams.
1199
- *
1200
- * @param options Bind options (port, address, etc.). Defaults to port 502.
1201
- * @param cb Callback invoked when binding completes or fails.
1202
- */
1203
1197
  open(options, cb) {
1204
1198
  // Node-style callback overload: if the first arg is a function, treat it as cb.
1205
1199
  if (typeof options === 'function') {
package/dist/index.d.ts CHANGED
@@ -206,7 +206,8 @@ declare class TcpClientPhysicalLayer extends AbstractPhysicalLayer {
206
206
  get state(): PhysicalState;
207
207
  get socket(): Socket | null;
208
208
  constructor(options?: SocketConstructorOpts);
209
- open(options?: SocketConnectOpts | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
209
+ open(cb?: (err?: Error | null) => void): void;
210
+ open(options: SocketConnectOpts, cb?: (err?: Error | null) => void): void;
210
211
  close(cb?: (err?: Error | null) => void): void;
211
212
  }
212
213
 
@@ -232,7 +233,8 @@ declare class TcpServerPhysicalLayer extends AbstractPhysicalLayer {
232
233
  get state(): PhysicalState;
233
234
  get server(): Server | null;
234
235
  constructor(options?: TcpServerPhysicalLayerOptions);
235
- open(options?: ListenOptions | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
236
+ open(cb?: (err?: Error | null) => void): void;
237
+ open(options: ListenOptions, cb?: (err?: Error | null) => void): void;
236
238
  close(cb?: (err?: Error | null) => void): void;
237
239
  }
238
240
 
@@ -248,10 +250,11 @@ declare class UdpClientPhysicalLayer extends AbstractPhysicalLayer {
248
250
  get state(): PhysicalState;
249
251
  get socket(): Socket$1 | null;
250
252
  constructor(options?: Partial<SocketOptions>);
251
- open(remote?: {
253
+ open(cb?: (err?: Error | null) => void): void;
254
+ open(remote: {
252
255
  port?: number;
253
256
  address?: string;
254
- } | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
257
+ }, cb?: (err?: Error | null) => void): void;
255
258
  close(cb?: (err?: Error | null) => void): void;
256
259
  }
257
260
 
@@ -283,7 +286,8 @@ declare class UdpServerPhysicalLayer extends AbstractPhysicalLayer {
283
286
  * @param options Bind options (port, address, etc.). Defaults to port 502.
284
287
  * @param cb Callback invoked when binding completes or fails.
285
288
  */
286
- open(options?: BindOptions | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
289
+ open(cb?: (err?: Error | null) => void): void;
290
+ open(options: BindOptions, cb?: (err?: Error | null) => void): void;
287
291
  close(cb?: (err?: Error | null) => void): void;
288
292
  }
289
293
 
package/dist/index.mjs CHANGED
@@ -1192,12 +1192,6 @@ class UdpServerPhysicalLayer extends AbstractPhysicalLayer {
1192
1192
  super();
1193
1193
  this._opts = options ?? {};
1194
1194
  }
1195
- /**
1196
- * Bind the UDP socket and start accepting datagrams.
1197
- *
1198
- * @param options Bind options (port, address, etc.). Defaults to port 502.
1199
- * @param cb Callback invoked when binding completes or fails.
1200
- */
1201
1195
  open(options, cb) {
1202
1196
  // Node-style callback overload: if the first arg is a function, treat it as cb.
1203
1197
  if (typeof options === 'function') {
@@ -14,6 +14,7 @@ export declare class TcpClientPhysicalLayer extends AbstractPhysicalLayer {
14
14
  get state(): PhysicalState;
15
15
  get socket(): Socket | null;
16
16
  constructor(options?: SocketConstructorOpts);
17
- open(options?: SocketConnectOpts | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
17
+ open(cb?: (err?: Error | null) => void): void;
18
+ open(options: SocketConnectOpts, cb?: (err?: Error | null) => void): void;
18
19
  close(cb?: (err?: Error | null) => void): void;
19
20
  }
@@ -23,6 +23,7 @@ export declare class TcpServerPhysicalLayer extends AbstractPhysicalLayer {
23
23
  get state(): PhysicalState;
24
24
  get server(): Server | null;
25
25
  constructor(options?: TcpServerPhysicalLayerOptions);
26
- open(options?: ListenOptions | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
26
+ open(cb?: (err?: Error | null) => void): void;
27
+ open(options: ListenOptions, cb?: (err?: Error | null) => void): void;
27
28
  close(cb?: (err?: Error | null) => void): void;
28
29
  }
@@ -25,9 +25,10 @@ export declare class UdpClientPhysicalLayer extends AbstractPhysicalLayer {
25
25
  get state(): PhysicalState;
26
26
  get socket(): Socket | null;
27
27
  constructor(options?: Partial<SocketOptions>);
28
- open(remote?: {
28
+ open(cb?: (err?: Error | null) => void): void;
29
+ open(remote: {
29
30
  port?: number;
30
31
  address?: string;
31
- } | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
32
+ }, cb?: (err?: Error | null) => void): void;
32
33
  close(cb?: (err?: Error | null) => void): void;
33
34
  }
@@ -45,6 +45,7 @@ export declare class UdpServerPhysicalLayer extends AbstractPhysicalLayer {
45
45
  * @param options Bind options (port, address, etc.). Defaults to port 502.
46
46
  * @param cb Callback invoked when binding completes or fails.
47
47
  */
48
- open(options?: BindOptions | ((err?: Error | null) => void), cb?: (err?: Error | null) => void): void;
48
+ open(cb?: (err?: Error | null) => void): void;
49
+ open(options: BindOptions, cb?: (err?: Error | null) => void): void;
49
50
  close(cb?: (err?: Error | null) => void): void;
50
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "njs-modbus",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "A pure JavaScript implementation of Modbus for Node.js.",
5
5
  "keywords": [
6
6
  "modbus",
@@ -31,10 +31,10 @@
31
31
  "*.d.ts"
32
32
  ],
33
33
  "scripts": {
34
- "benchmark": "tsx benchmark/encode-decode.ts && echo && tsx benchmark/tcp-throughput.ts && echo && tsx benchmark/concurrent.ts",
35
- "benchmark:report": "tsx benchmark/generate-report.ts",
36
34
  "build": "node -e \"fs.rmSync('dist', {recursive: true, force: true})\" && rollup -c",
37
35
  "test": "tsx --test test/**/*.test.ts",
36
+ "benchmark": "tsx benchmark/encode-decode.ts && echo && tsx benchmark/tcp-throughput.ts && echo && tsx benchmark/concurrent.ts",
37
+ "benchmark:report": "tsx benchmark/generate-report.ts",
38
38
  "util:sort-package-json": "sort-package-json"
39
39
  },
40
40
  "devDependencies": {