usb 3.0.0-alpha.3 → 3.0.0-alpha.5

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 CHANGED
@@ -8,6 +8,9 @@ Node.JS library for communicating with USB devices.
8
8
 
9
9
  This is a complete rewrite in rust using [@kevinmehall](https://github.com/kevinmehall)'s excellent [nusb library](https://docs.rs/nusb/latest/nusb) and [napi-rs](https://napi.rs/).
10
10
 
11
+ # License
12
+ [MIT](LICENSE.md)
13
+
11
14
  # Prerequisites
12
15
 
13
16
  [Node.js >= v12.22.0](https://nodejs.org), which includes `npm`.
@@ -16,7 +19,8 @@ This is a complete rewrite in rust using [@kevinmehall](https://github.com/kevin
16
19
 
17
20
  On Windows, if you get a `NOT_SUPPORTED` error when attempting to open your device, it's possible your device doesn't have a WinUSB driver to use.
18
21
 
19
- You can install one using [Zadig](http://zadig.akeo.ie/).
22
+ If you are a device vendor, consider implementing [WCID](https://github.com/pbatard/libwdi/wiki/WCID-Devices) to get WinUSB driver support automatically.
23
+ Otherwise, you can install a WinUSB driver using [Zadig](http://zadig.akeo.ie/).
20
24
 
21
25
  ## Linux
22
26
 
@@ -26,7 +30,22 @@ You may need to modify your udev and permission rules in order to access your de
26
30
  SUBSYSTEM=="usb", ATTR{idVendor}=="USB-VENDOR-ID", ATTR{idProduct}=="USB-PRODUCT-ID", MODE="0660", GROUP="GROUP-YOUR-USER-IS-IN"
27
31
  ```
28
32
 
29
- # Installation
33
+ # Getting Started
34
+
35
+ ## Supported Architectures and Operating Systems
36
+
37
+ - i686-pc-windows-msvc
38
+ - x86_64-apple-darwin
39
+ - x86_64-pc-windows-msvc
40
+ - x86_64-unknown-linux-gnu
41
+ - x86_64-unknown-linux-musl
42
+ - aarch64-apple-darwin
43
+ - aarch64-pc-windows-msvc
44
+ - aarch64-unknown-linux-gnu
45
+ - aarch64-unknown-linux-musl
46
+ - armv7-unknown-linux-gnueabihf
47
+
48
+ ## Installation
30
49
 
31
50
  Native modules are bundled as separate optional packages, so installation should be as simple as installing the package.
32
51
 
@@ -42,27 +61,85 @@ With `yarn`:
42
61
  yarn add usb
43
62
  ```
44
63
 
45
- # License
46
- [MIT](LICENSE.md)
64
+ ## Examples
65
+ Use the following examples to kickstart your development. Once you have a desired device, use the APIs below to interact with it.
47
66
 
48
- # Limitations
49
- Does not support:
67
+ ### List all devices
68
+ ```typescript
69
+ import { usb } from 'usb';
50
70
 
51
- - Isochronous transfers
71
+ const devices = await usb.getDevices();
52
72
 
53
- # Getting Started
54
- Use the following examples to kickstart your development. Once you have a desired device, use the APIs below to interact with it.
73
+ for (const device of devices) {
74
+ console.log(device); // WebUSB device
75
+ }
76
+ ```
55
77
 
56
- ## APIs
57
- Since `v3.0.0`, the `node-usb` library supports the WebUSB API which follows the [WebUSB Specification](https://wicg.github.io/webusb/)
78
+ ### Find device by vid/pid
79
+ ```typescript
80
+ import { usb } from 'usb';
58
81
 
59
- Convenience methods also exist to easily list or find devices.
82
+ const device = await usb.findDeviceByIds(0x59e3, 0x0a23);
60
83
 
61
- Full auto-generated API documentation can be seen here:
84
+ if (device) {
85
+ console.log(device); // WebUSB device
86
+ }
87
+ ```
62
88
 
63
- https://node-usb.github.io/node-usb-rs/
89
+ ### Find device by SerialNumber
90
+ ```typescript
91
+ import { usb } from 'usb';
92
+
93
+ const device = await usb.findDeviceBySerial('TEST_DEVICE');
94
+
95
+ if (device) {
96
+ console.log(device); // WebUSB device
97
+ }
98
+ ```
99
+
100
+ ### Watch for connect/disconnect events
101
+ ```typescript
102
+ import { usb } from 'usb';
103
+
104
+ usb.addEventListener('connect', (event) => {
105
+ console.log('Device connected:', event.device.serialNumber);
106
+ });
107
+
108
+ usb.addEventListener('disconnect', (event) => {
109
+ console.log('Device disconnected:', event.device.serialNumber);
110
+ });
111
+ ```
112
+
113
+ ### Use WebUSB approach to find a device
114
+ ```typescript
115
+ import { webusb } from 'usb';
116
+
117
+ // Returns first matching device
118
+ const device = await webusb.requestDevice({
119
+ filters: [{}]
120
+ })
64
121
 
65
- ## Electron
122
+ console.log(device); // WebUSB device
123
+ ```
124
+
125
+ ### Use WebUSB approach to find a device with custom selection method
126
+ ```typescript
127
+ import { WebUSB } from 'usb';
128
+
129
+ const customWebUSB = new WebUSB({
130
+ // This function can return a promise which allows a UI to be displayed if required
131
+ devicesFound: devices => devices.find(device => device.serialNumber === 'TEST_DEVICE')
132
+ });
133
+
134
+ // Returns device based on injected 'devicesFound' function
135
+ const device = await customWebUSB.requestDevice({
136
+ filters: [{}]
137
+ })
138
+
139
+ console.log(device); // WebUSB device
140
+ ```
141
+
142
+ ### Electron
66
143
  Please refer to the maintained example for using `node-usb` in electron:
67
144
 
68
145
  https://github.com/node-usb/node-usb-example-electron
@@ -73,46 +150,39 @@ If using a packaging system for electron, ensure the `node-usb` library does not
73
150
  - nodeGypRebuild: false
74
151
  - npmRebuild: false
75
152
 
76
- ## Convenience Functions
153
+ # APIs
154
+ Since `v3.0.0`, the `node-usb` API follows the WebUSB specification which can be found here:
77
155
 
78
- ### getDeviceList()
79
- Return a list of `USB` objects for the USB devices attached to the system.
80
-
81
- ### findByIds(vid, pid)
82
- Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present.
156
+ https://wicg.github.io/webusb/
83
157
 
84
- ### findBySerialNumber(serialNumber)
85
- Convenience method to get the device with the specified serial number, or `undefined` if no such device is present.
158
+ Two versions of the WebUSB API exist by default:
86
159
 
87
- ## WebUSB
160
+ - `usb` - which exposes all functionality in an unrestricted manner (e.g. without needing to `requestDevice()` first)
161
+ - `webusb` - which follows the WebUSB specification exactly and requires the user to authorise devices via `requestDevice()` first.
88
162
 
89
- Please refer to the WebUSB specification which be found here:
163
+ You may also construct your own WebUSB (e.g. to specify a `requestDevice()` callback) using the exported `WebUSB` class.
90
164
 
91
- https://wicg.github.io/webusb/
165
+ Full auto-generated API documentation can be seen here:
92
166
 
93
- ### Implementation Status
167
+ https://node-usb.github.io/node-usb-rs/
94
168
 
95
- #### Architectures and Operating Systems
169
+ ## Implementation Status
96
170
 
97
- - i686-pc-windows-msvc
98
- - x86_64-apple-darwin
99
- - x86_64-pc-windows-msvc
100
- - x86_64-unknown-linux-gnu
101
- - x86_64-unknown-linux-musl
102
- - aarch64-apple-darwin
103
- - aarch64-pc-windows-msvc
104
- - aarch64-unknown-linux-gnu
105
- - aarch64-unknown-linux-musl
106
- - armv7-unknown-linux-gnueabihf
171
+ ### USB
107
172
 
108
- #### USB
173
+ #### WebUSB Features
109
174
 
110
175
  - [x] getDevices()
111
176
  - [x] requestDevice()
112
177
 
113
- #### USBDevice
178
+ #### Extended Features
179
+
180
+ - [x] findDeviceByIds()
181
+ - [x] findDeviceBySerial()
182
+
183
+ ### USBDevice
114
184
 
115
- ##### WebUSB Features
185
+ #### WebUSB Features
116
186
 
117
187
  - [x] usbVersionMajor
118
188
  - [x] usbVersionMinor
@@ -147,7 +217,7 @@ https://wicg.github.io/webusb/
147
217
  - [ ] isochronousTransferIn()
148
218
  - [ ] isochronousTransferOut()
149
219
 
150
- ##### Extended Features
220
+ #### Extended Features
151
221
 
152
222
  - [x] bus
153
223
  - [x] address
@@ -156,11 +226,28 @@ https://wicg.github.io/webusb/
156
226
  - [x] detachKernelDriver() (Linux only)
157
227
  - [x] attachKernelDriver() (Linux only)
158
228
 
159
- #### Events
229
+ ### Events
160
230
 
161
231
  - [x] connect
162
232
  - [x] disconnect
163
233
 
234
+ ## Extended Functions
235
+
236
+ This library extends the WebUSB specification to add further functionality and convenience
237
+
238
+ ### findDeviceByIds(vid, pid)
239
+ Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present.
240
+
241
+ ### findDeviceBySerial(serialNumber)
242
+ Convenience method to get the device with the specified serial number, or `undefined` if no such device is present.
243
+
244
+ ### detachKernelDriver(interfaceNumber) (Linux only)
245
+ Detaches the kernel driver from the interface.
246
+ You may need to execute this with elevated privileges.
247
+
248
+ ### attachKernelDriver(interfaceNumber) (Linux only)
249
+ Re-attaches the kernel driver for the interface.
250
+
164
251
  # Development
165
252
  The library is based on native rust bindings wrapping the [nusb](https://docs.rs/nusb/latest/nusb) crate.
166
253
 
package/dist/index.d.ts CHANGED
@@ -20,12 +20,6 @@ interface USBOptions {
20
20
  */
21
21
  deviceTimeout?: number;
22
22
  }
23
- interface WebUSB {
24
- addEventListener(type: "connect" | "disconnect", listener: (this: this, ev: USBConnectionEvent) => any, useCapture?: boolean): void;
25
- addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
26
- removeEventListener(type: "connect" | "disconnect", callback: (this: this, ev: USBConnectionEvent) => any, useCapture?: boolean): void;
27
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
28
- }
29
23
  /**
30
24
  * WebUSB class
31
25
  *
@@ -40,8 +34,15 @@ declare class WebUSB extends EventTarget implements USB {
40
34
  private options;
41
35
  protected nativeEmitter: Emitter;
42
36
  protected authorisedDevices: Set<USBDeviceFilter>;
37
+ protected listenerCount: number;
43
38
  protected knownDevices: Map<string, UsbDevice>;
44
39
  constructor(options?: USBOptions);
40
+ private deviceConnectCallback;
41
+ private deviceDisconnectCallback;
42
+ addEventListener(type: 'connect' | 'disconnect', listener: (this: this, ev: USBConnectionEvent) => void): void;
43
+ addEventListener(type: 'connect' | 'disconnect', listener: EventListener): void;
44
+ removeEventListener(type: 'connect' | 'disconnect', callback: (this: this, ev: USBConnectionEvent) => void): void;
45
+ removeEventListener(type: 'connect' | 'disconnect', callback: EventListener): void;
45
46
  private _onconnect;
46
47
  set onconnect(fn: (ev: USBConnectionEvent) => void);
47
48
  private _ondisconnect;
@@ -57,28 +58,28 @@ declare class WebUSB extends EventTarget implements USB {
57
58
  * @returns Promise containing an array of devices
58
59
  */
59
60
  getDevices(): Promise<UsbDevice[]>;
61
+ /**
62
+ * Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present.
63
+ * @param vid
64
+ * @param pid
65
+ */
66
+ findDeviceByIds(vid: number, pid: number): Promise<UsbDevice | undefined>;
67
+ /**
68
+ * Convenience method to get the device with the specified serial number, or `undefined` if no such device is present.
69
+ * @param serialNumber
70
+ */
71
+ findDeviceBySerial(serialNumber: string): Promise<UsbDevice | undefined>;
60
72
  private loadDevices;
61
73
  private quickFilter;
62
74
  private filterDevice;
63
75
  private isAuthorisedDevice;
64
76
  }
65
77
  /**
66
- * Convenience method to get an array of all connected devices.
67
- */
68
- declare const getDeviceList: () => Promise<UsbDevice[]>;
69
- /**
70
- * Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present.
71
- * @param vid
72
- * @param pid
73
- */
74
- declare const findByIds: (vid: number, pid: number) => Promise<UsbDevice | undefined>;
75
- /**
76
- * Convenience method to get the device with the specified serial number, or `undefined` if no such device is present.
77
- * @param serialNumber
78
+ * Default USB object (allows all devices by default)
78
79
  */
79
- declare const findBySerialNumber: (serialNumber: string) => Promise<UsbDevice | undefined>;
80
+ declare const usb: WebUSB;
80
81
  /**
81
82
  * Default WebUSB object (mimics navigator.usb)
82
83
  */
83
84
  declare const webusb: WebUSB | USB;
84
- export { webusb, WebUSB, USBOptions, getDeviceList, findByIds, findBySerialNumber, };
85
+ export { usb, webusb, WebUSB, USBOptions, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findBySerialNumber = exports.findByIds = exports.getDeviceList = exports.WebUSB = exports.webusb = void 0;
3
+ exports.WebUSB = exports.webusb = exports.usb = void 0;
4
4
  const index_js_1 = require("../index.js");
5
5
  /**
6
6
  * Hidden
@@ -59,14 +59,16 @@ index_js_1.UsbDevice.prototype.transferOut = async function (endpointNumber, dat
59
59
  /**
60
60
  * Hidden
61
61
  */
62
- index_js_1.UsbDevice.prototype.isochronousTransferIn = async function (_endpointNumber, _packetLengths) {
63
- throw new Error('isochronousTransferIn error: method not implemented');
62
+ index_js_1.UsbDevice.prototype.isochronousTransferIn = async function (endpointNumber, packetLengths, timeout = DEFAULT_TIMEOUT) {
63
+ const res = await this.nativeIsochronousTransferIn(endpointNumber, packetLengths, timeout);
64
+ return res;
64
65
  };
65
66
  /**
66
67
  * Hidden
67
68
  */
68
- index_js_1.UsbDevice.prototype.isochronousTransferOut = async function (_endpointNumber, _data, _packetLengths) {
69
- throw new Error('isochronousTransferOut error: method not implemented');
69
+ index_js_1.UsbDevice.prototype.isochronousTransferOut = async function (endpointNumber, data, packetLengths, timeout = DEFAULT_TIMEOUT) {
70
+ const res = await this.nativeIsochronousTransferOut(endpointNumber, toUint8Array(data), packetLengths, timeout);
71
+ return res;
70
72
  };
71
73
  class NamedError extends Error {
72
74
  constructor(message, name) {
@@ -99,15 +101,16 @@ class WebUSB extends EventTarget {
99
101
  this.options = options;
100
102
  this.nativeEmitter = new index_js_1.Emitter();
101
103
  this.authorisedDevices = new Set();
104
+ this.listenerCount = 0;
102
105
  this.knownDevices = new Map();
103
- const deviceConnectCallback = async (device) => {
106
+ this.deviceConnectCallback = async (device) => {
104
107
  this.knownDevices.set(device.handle, device);
105
108
  // When connected, emit an event if it is an allowed device
106
109
  if (device && this.isAuthorisedDevice(device)) {
107
110
  this.dispatchEvent(new ConnectionEvent('connect', { device }));
108
111
  }
109
112
  };
110
- const deviceDisconnectCallback = async (handle) => {
113
+ this.deviceDisconnectCallback = async (handle) => {
111
114
  // When disconnected, emit an event if the device was a known allowed device
112
115
  if (this.knownDevices.has(handle)) {
113
116
  const device = this.knownDevices.get(handle);
@@ -117,10 +120,31 @@ class WebUSB extends EventTarget {
117
120
  this.knownDevices.delete(handle);
118
121
  }
119
122
  };
120
- this.nativeEmitter.start();
121
- this.nativeEmitter.addAttach(deviceConnectCallback);
122
- this.nativeEmitter.addDetach(deviceDisconnectCallback);
123
- getDeviceList().then(devices => devices.forEach(device => this.knownDevices.set(device.handle, device)));
123
+ this.nativeEmitter.init();
124
+ }
125
+ addEventListener(type, listener) {
126
+ if (type !== 'connect' && type !== 'disconnect') {
127
+ return;
128
+ }
129
+ super.addEventListener(type, listener);
130
+ this.listenerCount++;
131
+ if (this.listenerCount === 1) {
132
+ this.nativeEmitter.addAttach(this.deviceConnectCallback);
133
+ this.nativeEmitter.addDetach(this.deviceDisconnectCallback);
134
+ (0, index_js_1.nativeGetDevices)().then(devices => devices.forEach(device => this.knownDevices.set(device.handle, device)));
135
+ }
136
+ }
137
+ removeEventListener(type, callback) {
138
+ if (type !== 'connect' && type !== 'disconnect') {
139
+ return;
140
+ }
141
+ super.removeEventListener(type, callback);
142
+ this.listenerCount--;
143
+ if (this.listenerCount === 0) {
144
+ this.nativeEmitter.removeAttach();
145
+ this.nativeEmitter.removeDetach();
146
+ this.knownDevices.clear();
147
+ }
124
148
  }
125
149
  set onconnect(fn) {
126
150
  if (this._onconnect) {
@@ -210,8 +234,25 @@ class WebUSB extends EventTarget {
210
234
  const devices = await this.loadDevices(preFilters);
211
235
  return devices.filter(device => this.isAuthorisedDevice(device));
212
236
  }
237
+ /**
238
+ * Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present.
239
+ * @param vid
240
+ * @param pid
241
+ */
242
+ async findDeviceByIds(vid, pid) {
243
+ const device = await (0, index_js_1.nativeFindDeviceByIds)(vid, pid);
244
+ return device || undefined;
245
+ }
246
+ /**
247
+ * Convenience method to get the device with the specified serial number, or `undefined` if no such device is present.
248
+ * @param serialNumber
249
+ */
250
+ async findDeviceBySerial(serialNumber) {
251
+ const device = await (0, index_js_1.nativeFindDeviceBySerial)(serialNumber);
252
+ return device || undefined;
253
+ }
213
254
  async loadDevices(preFilters) {
214
- let devices = await getDeviceList();
255
+ let devices = await (0, index_js_1.nativeGetDevices)();
215
256
  // Pre-filter devices
216
257
  devices = this.quickFilter(devices, preFilters);
217
258
  return devices;
@@ -304,32 +345,12 @@ class WebUSB extends EventTarget {
304
345
  }
305
346
  exports.WebUSB = WebUSB;
306
347
  /**
307
- * Convenience method to get an array of all connected devices.
308
- */
309
- const getDeviceList = async () => {
310
- const devices = await (0, index_js_1.nativeGetDeviceList)();
311
- return devices;
312
- };
313
- exports.getDeviceList = getDeviceList;
314
- /**
315
- * Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present.
316
- * @param vid
317
- * @param pid
348
+ * Default USB object (allows all devices by default)
318
349
  */
319
- const findByIds = async (vid, pid) => {
320
- const device = await (0, index_js_1.nativeFindByIds)(vid, pid);
321
- return device;
322
- };
323
- exports.findByIds = findByIds;
324
- /**
325
- * Convenience method to get the device with the specified serial number, or `undefined` if no such device is present.
326
- * @param serialNumber
327
- */
328
- const findBySerialNumber = async (serialNumber) => {
329
- const device = await (0, index_js_1.nativeFindBySerialNumber)(serialNumber);
330
- return device;
331
- };
332
- exports.findBySerialNumber = findBySerialNumber;
350
+ const usb = new WebUSB({
351
+ allowAllDevices: true
352
+ });
353
+ exports.usb = usb;
333
354
  /**
334
355
  * Default WebUSB object (mimics navigator.usb)
335
356
  */
package/index.d.ts CHANGED
@@ -35,11 +35,11 @@ export declare interface UsbDevice extends USBDevice {
35
35
  }
36
36
  export declare class Emitter {
37
37
  constructor()
38
- start(): Promise<void>
39
- addAttach(callback: ((arg: UsbDevice) => void)): void
40
- removeAttach(callback: ((arg: UsbDevice) => void)): void
41
- addDetach(callback: ((arg: string) => void)): void
42
- removeDetach(callback: ((arg: string) => void)): void
38
+ init(): Promise<void>
39
+ addAttach(callback: ((arg: UsbDevice) => void)): Promise<void>
40
+ removeAttach(): Promise<void>
41
+ addDetach(callback: ((arg: string) => void)): Promise<void>
42
+ removeDetach(): Promise<void>
43
43
  }
44
44
 
45
45
  export declare class UsbDevice {
@@ -77,18 +77,18 @@ export declare class UsbDevice {
77
77
  nativeControlTransferOut(setup: USBControlTransferParameters, timeout: number, data?: Uint8Array | undefined | null): Promise<number>
78
78
  nativeTransferIn(endpointNumber: number, timeout: number, length: number): Promise<Uint8Array | null>
79
79
  nativeTransferOut(endpointNumber: number, timeout: number, data: Uint8Array): Promise<number>
80
- nativeIsochronousTransferIn(endpointNumber: number, packetLengths: Array<number>): Promise<USBIsochronousInTransferResult>
81
- nativeIsochronousTransferOut(endpointNumber: number, data: Uint8Array, packetLengths: Array<number>): Promise<USBIsochronousOutTransferResult>
80
+ nativeIsochronousTransferIn(endpointNumber: number, packetLengths: Array<number>, timeout: number): Promise<USBIsochronousInTransferResult>
81
+ nativeIsochronousTransferOut(endpointNumber: number, data: Uint8Array, packetLengths: Array<number>, timeout: number): Promise<USBIsochronousOutTransferResult>
82
82
  clearHalt(direction: USBDirection, endpointNumber: number): Promise<void>
83
83
  detachKernelDriver(interfaceNumber: number): Promise<void>
84
84
  attachKernelDriver(interfaceNumber: number): Promise<void>
85
85
  }
86
86
 
87
- export declare function nativeFindByIds(vendorId: number, productId: number): Promise<UsbDevice>
87
+ export declare function nativeFindDeviceByIds(vendorId: number, productId: number): Promise<UsbDevice | null>
88
88
 
89
- export declare function nativeFindBySerialNumber(serialNumber: string): Promise<UsbDevice>
89
+ export declare function nativeFindDeviceBySerial(serialNumber: string): Promise<UsbDevice | null>
90
90
 
91
- export declare function nativeGetDeviceList(): Promise<Array<UsbDevice>>
91
+ export declare function nativeGetDevices(): Promise<Array<UsbDevice>>
92
92
 
93
93
  export interface UsbAlternateInterface {
94
94
  alternateSetting: number
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('@node-usb/usb-android-arm64')
79
79
  const bindingPackageVersion = require('@node-usb/usb-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('@node-usb/usb-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@node-usb/usb-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('@node-usb/usb-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@node-usb/usb-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('@node-usb/usb-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@node-usb/usb-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@node-usb/usb-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@node-usb/usb-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('@node-usb/usb-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@node-usb/usb-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('@node-usb/usb-darwin-universal')
184
184
  const bindingPackageVersion = require('@node-usb/usb-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('@node-usb/usb-darwin-x64')
200
200
  const bindingPackageVersion = require('@node-usb/usb-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('@node-usb/usb-darwin-arm64')
216
216
  const bindingPackageVersion = require('@node-usb/usb-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('@node-usb/usb-freebsd-x64')
236
236
  const bindingPackageVersion = require('@node-usb/usb-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('@node-usb/usb-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@node-usb/usb-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('@node-usb/usb-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@node-usb/usb-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('@node-usb/usb-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@node-usb/usb-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('@node-usb/usb-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@node-usb/usb-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('@node-usb/usb-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@node-usb/usb-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('@node-usb/usb-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@node-usb/usb-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('@node-usb/usb-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@node-usb/usb-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('@node-usb/usb-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@node-usb/usb-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('@node-usb/usb-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@node-usb/usb-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@node-usb/usb-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@node-usb/usb-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('@node-usb/usb-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@node-usb/usb-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@node-usb/usb-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@node-usb/usb-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@node-usb/usb-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@node-usb/usb-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('@node-usb/usb-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@node-usb/usb-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('@node-usb/usb-openharmony-x64')
494
494
  const bindingPackageVersion = require('@node-usb/usb-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('@node-usb/usb-openharmony-arm')
510
510
  const bindingPackageVersion = require('@node-usb/usb-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '3.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '3.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 3.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -578,6 +578,6 @@ if (!nativeBinding) {
578
578
  module.exports = nativeBinding
579
579
  module.exports.Emitter = nativeBinding.Emitter
580
580
  module.exports.UsbDevice = nativeBinding.UsbDevice
581
- module.exports.nativeFindByIds = nativeBinding.nativeFindByIds
582
- module.exports.nativeFindBySerialNumber = nativeBinding.nativeFindBySerialNumber
583
- module.exports.nativeGetDeviceList = nativeBinding.nativeGetDeviceList
581
+ module.exports.nativeFindDeviceByIds = nativeBinding.nativeFindDeviceByIds
582
+ module.exports.nativeFindDeviceBySerial = nativeBinding.nativeFindDeviceBySerial
583
+ module.exports.nativeGetDevices = nativeBinding.nativeGetDevices
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "usb",
3
3
  "description": "Library to access USB devices",
4
4
  "license": "MIT",
5
- "version": "3.0.0-alpha.3",
5
+ "version": "3.0.0-alpha.5",
6
6
  "main": "dist/index.js",
7
7
  "engines": {
8
8
  "node": ">= 12.22.0 < 13 || >= 14.17.0 < 15 || >= 15.12.0 < 16 || >= 16.0.0"
@@ -84,15 +84,15 @@
84
84
  "index.js"
85
85
  ],
86
86
  "optionalDependencies": {
87
- "@node-usb/usb-win32-x64-msvc": "3.0.0-alpha.3",
88
- "@node-usb/usb-darwin-x64": "3.0.0-alpha.3",
89
- "@node-usb/usb-linux-x64-gnu": "3.0.0-alpha.3",
90
- "@node-usb/usb-linux-x64-musl": "3.0.0-alpha.3",
91
- "@node-usb/usb-linux-arm64-gnu": "3.0.0-alpha.3",
92
- "@node-usb/usb-win32-ia32-msvc": "3.0.0-alpha.3",
93
- "@node-usb/usb-linux-arm-gnueabihf": "3.0.0-alpha.3",
94
- "@node-usb/usb-darwin-arm64": "3.0.0-alpha.3",
95
- "@node-usb/usb-linux-arm64-musl": "3.0.0-alpha.3",
96
- "@node-usb/usb-win32-arm64-msvc": "3.0.0-alpha.3"
87
+ "@node-usb/usb-win32-x64-msvc": "3.0.0-alpha.5",
88
+ "@node-usb/usb-darwin-x64": "3.0.0-alpha.5",
89
+ "@node-usb/usb-linux-x64-gnu": "3.0.0-alpha.5",
90
+ "@node-usb/usb-linux-x64-musl": "3.0.0-alpha.5",
91
+ "@node-usb/usb-linux-arm64-gnu": "3.0.0-alpha.5",
92
+ "@node-usb/usb-win32-ia32-msvc": "3.0.0-alpha.5",
93
+ "@node-usb/usb-linux-arm-gnueabihf": "3.0.0-alpha.5",
94
+ "@node-usb/usb-darwin-arm64": "3.0.0-alpha.5",
95
+ "@node-usb/usb-linux-arm64-musl": "3.0.0-alpha.5",
96
+ "@node-usb/usb-win32-arm64-msvc": "3.0.0-alpha.5"
97
97
  }
98
98
  }