usb 2.13.0 → 2.14.0

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.14.0] - 2024-09-15
4
+
5
+ ### Fixed
6
+ - Fixed fatal exceptions by using `ThrowAsJavaScriptException` instead of `Napi::Error::Fatal` - [`817`](https://github.com/node-usb/node-usb/pull/817) ([cleoo](https://github.com/cleoo))
7
+
3
8
  ## [2.13.0] - 2024-05-26
4
9
 
5
10
  ### Changed
package/README.md CHANGED
@@ -30,6 +30,10 @@ On Linux, you'll need libudev to build libusb if a prebuild is not available. On
30
30
  sudo apt-get install build-essential libudev-dev
31
31
  ```
32
32
 
33
+ You may need to modify your udev and permission rules in order to access your desired device. Along the lines of:
34
+
35
+ SUBSYSTEM=="usb", ATTR{idVendor}=="USB-VENDOR-ID", ATTR{idProduct}=="USB-PRODUCT-ID", MODE="0660", GROUP="GROUP-YOUR-USER-IS-IN"
36
+
33
37
  # Troubleshooting
34
38
 
35
39
  For libusb issues, please refer to the FAQ at https://github.com/libusb/libusb/wiki/FAQ
@@ -203,6 +207,12 @@ Please refer to the maintained example for using `node-usb` in electron:
203
207
 
204
208
  https://github.com/node-usb/node-usb-example-electron
205
209
 
210
+ If using a packaging system for electron, ensure the `node-usb` library does not get recompiled as the correct binaries are already shipped with the package. For example, for [electron-builder](https://www.electron.build/), use these settings:
211
+
212
+ - buildDependenciesFromSource: true
213
+ - nodeGypRebuild: false
214
+ - npmRebuild: false
215
+
206
216
  # APIs
207
217
  Since `v2.0.0`, the `node-usb` library supports two APIs:
208
218
 
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { DeviceDescriptor, ConfigDescriptor, BosDescriptor } from './descriptors';
3
2
  /**
4
3
  * Return a list of `Device` objects for the USB devices attached to the system.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Device } from './bindings';
3
2
  import { CapabilityDescriptor } from './descriptors';
4
3
  export declare class Capability {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /** A structure representing the standard USB device descriptor */
3
2
  export interface DeviceDescriptor {
4
3
  /** Size of this descriptor (in bytes) */
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as usb from './bindings';
3
2
  import { Interface } from './interface';
4
3
  import { Capability } from './capability';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { EventEmitter } from 'events';
4
2
  import { LibUSBException, Transfer, Device } from './bindings';
5
3
  import { EndpointDescriptor } from './descriptors';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="w3c-web-usb" />
3
1
  import * as usb from '../usb';
4
2
  import { EventEmitter } from 'events';
5
3
  import { WebUSBDevice } from './webusb-device';
@@ -1,4 +1,3 @@
1
- /// <reference types="w3c-web-usb" />
2
1
  import * as usb from '../usb';
3
2
  /**
4
3
  * Wrapper to make a node-usb device look like a webusb device
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": "2.13.0",
5
+ "version": "2.14.0",
6
6
  "main": "dist/index.js",
7
7
  "engines": {
8
8
  "node": ">=12.22.0 <13.0 || >=14.17.0"
@@ -66,8 +66,8 @@
66
66
  "node-gyp": "^10.0.1",
67
67
  "prebuildify": "^6.0.1",
68
68
  "prebuildify-ci": "^1.0.5",
69
- "prebuildify-cross": "^5.0.0",
70
- "typedoc": "^0.25.13",
69
+ "prebuildify-cross": "thegecko/prebuildify-cross#fix-docker",
70
+ "typedoc": "^0.26.7",
71
71
  "typescript": "^5.4.5"
72
72
  },
73
73
  "binary": {
Binary file
Binary file
Binary file
package/src/device.cc CHANGED
@@ -246,7 +246,7 @@ struct Req: Napi::AsyncWorker {
246
246
  Callback().Call(device->Value(), { error });
247
247
  }
248
248
  catch (const Napi::Error& e) {
249
- Napi::Error::Fatal("", e.what());
249
+ e.ThrowAsJavaScriptException();
250
250
  }
251
251
  }
252
252
  };
package/src/transfer.cc CHANGED
@@ -110,7 +110,7 @@ void handleCompletion(Transfer* self){
110
110
  Napi::Number::New(env, (uint32_t)self->transfer->actual_length) });
111
111
  }
112
112
  catch (const Napi::Error& e) {
113
- Napi::Error::Fatal("", e.what());
113
+ e.ThrowAsJavaScriptException();
114
114
  }
115
115
  }
116
116