Socket
Socket
Sign inDemoInstall

usb

Package Overview
Dependencies
Maintainers
3
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

usb - npm Package Compare versions

Comparing version 2.5.2 to 2.6.0

11

CHANGELOG.md
# Changelog
## [2.6.0] - 2022-12-10
### Changed
- Updated build dependencies and now using Python 3.x for builds (shouldn't affect package) - [`563`](https://github.com/node-usb/node-usb/pull/563) ([Rob Moran](https://github.com/thegecko))
## [2.5.3] - 2022-12-06
### Changed
- Allow multiple polling to fail - [`556`](https://github.com/node-usb/node-usb/pull/556) ([Tim Strazzere](https://github.com/strazzere))
- Ignore creation issues during attach and list - [`550`](https://github.com/node-usb/node-usb/pull/550) ([Rob Moran](https://github.com/thegecko))
## [2.5.2] - 2022-09-24

@@ -4,0 +15,0 @@

4

dist/usb/endpoint.js

@@ -110,3 +110,5 @@ "use strict";

_this.emit('error', error);
_this.stopPoll();
if (_this.pollActive) {
_this.stopPoll();
}
}

@@ -113,0 +115,0 @@ if (_this.pollActive) {

@@ -73,8 +73,15 @@ "use strict";

var deviceConnectCallback = function (device) { return __awaiter(_this, void 0, void 0, function () {
var webDevice, deviceId, event_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, webusb_device_1.WebUSBDevice.createInstance(device)];
var webDevice, _a, deviceId, event_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 2, , 3]);
return [4 /*yield*/, webusb_device_1.WebUSBDevice.createInstance(device)];
case 1:
webDevice = _a.sent();
webDevice = _b.sent();
return [3 /*break*/, 3];
case 2:
_a = _b.sent();
return [3 /*break*/, 3];
case 3:
// When connected, emit an event if it is an allowed device

@@ -284,6 +291,6 @@ if (webDevice && this.isAllowedDevice(webDevice)) {

return __awaiter(this, void 0, void 0, function () {
var devices, webDevices, devices_1, devices_1_1, device, webDevice, deviceId, e_1_1;
var e_1, _a;
return __generator(this, function (_b) {
switch (_b.label) {
var devices, webDevices, devices_1, devices_1_1, device, webDevice, _a, deviceId, e_1_1;
var e_1, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -294,9 +301,9 @@ devices = usb.getDeviceList();

webDevices = [];
_b.label = 1;
_c.label = 1;
case 1:
_b.trys.push([1, 6, 7, 8]);
_c.trys.push([1, 9, 10, 11]);
devices_1 = __values(devices), devices_1_1 = devices_1.next();
_b.label = 2;
_c.label = 2;
case 2:
if (!!devices_1_1.done) return [3 /*break*/, 5];
if (!!devices_1_1.done) return [3 /*break*/, 8];
device = devices_1_1.value;

@@ -306,5 +313,14 @@ if (this.options.deviceTimeout) {

}
webDevice = void 0;
_c.label = 3;
case 3:
_c.trys.push([3, 5, , 6]);
return [4 /*yield*/, webusb_device_1.WebUSBDevice.createInstance(device)];
case 3:
webDevice = _b.sent();
case 4:
webDevice = _c.sent();
return [3 /*break*/, 6];
case 5:
_a = _c.sent();
return [3 /*break*/, 6];
case 6:
if (webDevice) {

@@ -317,18 +333,18 @@ webDevices.push(webDevice);

}
_b.label = 4;
case 4:
_c.label = 7;
case 7:
devices_1_1 = devices_1.next();
return [3 /*break*/, 2];
case 5: return [3 /*break*/, 8];
case 6:
e_1_1 = _b.sent();
case 8: return [3 /*break*/, 11];
case 9:
e_1_1 = _c.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 8];
case 7:
return [3 /*break*/, 11];
case 10:
try {
if (devices_1_1 && !devices_1_1.done && (_a = devices_1.return)) _a.call(devices_1);
if (devices_1_1 && !devices_1_1.done && (_b = devices_1.return)) _b.call(devices_1);
}
finally { if (e_1) throw e_1.error; }
return [7 /*endfinally*/];
case 8: return [2 /*return*/, webDevices];
case 11: return [2 /*return*/, webDevices];
}

@@ -335,0 +351,0 @@ });

@@ -128,28 +128,27 @@ "use strict";

WebUSBDevice.prototype.close = function () {
var _a;
return __awaiter(this, void 0, void 0, function () {
var _b, _c, iface, e_1_1, _error_1, error_1;
var e_1, _d;
return __generator(this, function (_e) {
switch (_e.label) {
var _a, _b, iface, e_1_1, _error_1, error_1;
var e_1, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_e.trys.push([0, 12, , 13]);
_d.trys.push([0, 12, , 13]);
if (!this.opened) {
return [2 /*return*/];
}
_e.label = 1;
_d.label = 1;
case 1:
_e.trys.push([1, 10, , 11]);
_d.trys.push([1, 10, , 11]);
if (!this.configuration) return [3 /*break*/, 9];
_e.label = 2;
_d.label = 2;
case 2:
_e.trys.push([2, 7, 8, 9]);
_b = __values((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.interfaces), _c = _b.next();
_e.label = 3;
_d.trys.push([2, 7, 8, 9]);
_a = __values(this.configuration.interfaces), _b = _a.next();
_d.label = 3;
case 3:
if (!!_c.done) return [3 /*break*/, 6];
iface = _c.value;
if (!!_b.done) return [3 /*break*/, 6];
iface = _b.value;
return [4 /*yield*/, this._releaseInterface(iface.interfaceNumber)];
case 4:
_e.sent();
_d.sent();
// Re-create the USBInterface to set the claimed attribute

@@ -162,9 +161,9 @@ this.configuration.interfaces[this.configuration.interfaces.indexOf(iface)] = {

};
_e.label = 5;
_d.label = 5;
case 5:
_c = _b.next();
_b = _a.next();
return [3 /*break*/, 3];
case 6: return [3 /*break*/, 9];
case 7:
e_1_1 = _e.sent();
e_1_1 = _d.sent();
e_1 = { error: e_1_1 };

@@ -174,3 +173,3 @@ return [3 /*break*/, 9];

try {
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
}

@@ -181,3 +180,3 @@ finally { if (e_1) throw e_1.error; }

case 10:
_error_1 = _e.sent();
_error_1 = _d.sent();
return [3 /*break*/, 11];

@@ -188,3 +187,3 @@ case 11:

case 12:
error_1 = _e.sent();
error_1 = _d.sent();
throw new Error("close error: " + error_1);

@@ -191,0 +190,0 @@ case 13: return [2 /*return*/];

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "2.5.2",
"version": "2.6.0",
"main": "dist/index.js",

@@ -56,17 +56,17 @@ "engines": {

"dependencies": {
"@types/w3c-web-usb": "1.0.6",
"node-addon-api": "^4.2.0",
"node-gyp-build": "^4.3.0"
"@types/w3c-web-usb": "^1.0.6",
"node-addon-api": "^5.0.0",
"node-gyp-build": "^4.5.0"
},
"devDependencies": {
"@types/node": "^14.14.41",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"coffeescript": "^2.5.1",
"eslint": "^7.29.0",
"mocha": "^9.1.3",
"node-gyp": "^7.1.2",
"prebuildify": "^4.2.1",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"coffeescript": "^2.7.0",
"eslint": "^8.29.0",
"mocha": "^10.1.0",
"node-gyp": "^9.3.0",
"prebuildify": "^5.0.1",
"prebuildify-ci": "^1.0.5",
"prebuildify-cross": "^4.0.1",
"prebuildify-cross": "^5.0.0",
"typedoc": "^0.22.10",

@@ -73,0 +73,0 @@ "typescript": "~4.2.4"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc