@psdk/device-webusb 0.2.67 → 0.3.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.
Files changed (2) hide show
  1. package/build/index.js +9 -15
  2. package/package.json +13 -32
package/build/index.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,10 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DeviceFilter = exports.WebusbReadOptions = exports.Webusb = void 0;
13
- const frame_father_1 = require("@psdk/frame-father");
14
- class Webusb {
10
+ import { ConnectionState, ReadOptions } from "@psdk/frame-father";
11
+ export class Webusb {
15
12
  constructor(options) {
16
13
  var _a, _b, _c, _d;
17
14
  if (options.filters.length == 0) {
@@ -20,7 +17,7 @@ class Webusb {
20
17
  this.filters = options.filters;
21
18
  this.configuration = (_a = options.configuration) !== null && _a !== void 0 ? _a : 1;
22
19
  this.interface = (_b = options.interface) !== null && _b !== void 0 ? _b : 0;
23
- this.state = frame_father_1.ConnectionState.DISCONNECTED;
20
+ this.state = ConnectionState.DISCONNECTED;
24
21
  this.readEndpoint = (_c = options.readEndpoint) !== null && _c !== void 0 ? _c : 2;
25
22
  this.writeEndpoint = (_d = options.writeEndpoint) !== null && _d !== void 0 ? _d : 2;
26
23
  }
@@ -45,14 +42,14 @@ class Webusb {
45
42
  yield device.open();
46
43
  yield device.selectConfiguration(this.configuration);
47
44
  yield device.claimInterface(device.configuration.interfaces[this.interface].interfaceNumber);
48
- this.state = frame_father_1.ConnectionState.CONNECTED;
45
+ this.state = ConnectionState.CONNECTED;
49
46
  // @ts-ignore
50
47
  navigator.usb.addEventListener('connect', e => {
51
- this.state = frame_father_1.ConnectionState.CONNECTED;
48
+ this.state = ConnectionState.CONNECTED;
52
49
  });
53
50
  // @ts-ignore
54
51
  navigator.usb.addEventListener('disconnect', e => {
55
- this.state = frame_father_1.ConnectionState.DISCONNECTED;
52
+ this.state = ConnectionState.DISCONNECTED;
56
53
  });
57
54
  this.device = device;
58
55
  return yield this.connectedDevice();
@@ -71,7 +68,7 @@ class Webusb {
71
68
  connectionState() {
72
69
  const device = _device();
73
70
  if (!device.opened) {
74
- return frame_father_1.ConnectionState.DISCONNECTED;
71
+ return ConnectionState.DISCONNECTED;
75
72
  }
76
73
  return _connectionState();
77
74
  }
@@ -116,8 +113,7 @@ class Webusb {
116
113
  });
117
114
  }
118
115
  }
119
- exports.Webusb = Webusb;
120
- class WebusbReadOptions extends frame_father_1.ReadOptions {
116
+ export class WebusbReadOptions extends ReadOptions {
121
117
  constructor(options) {
122
118
  var _a;
123
119
  super(options);
@@ -130,11 +126,9 @@ class WebusbReadOptions extends frame_father_1.ReadOptions {
130
126
  return this._length;
131
127
  }
132
128
  }
133
- exports.WebusbReadOptions = WebusbReadOptions;
134
- class DeviceFilter {
129
+ export class DeviceFilter {
135
130
  constructor(options) {
136
131
  this.vendorId = options.vendorId;
137
132
  this.productId = options.productId;
138
133
  }
139
134
  }
140
- exports.DeviceFilter = DeviceFilter;
package/package.json CHANGED
@@ -1,52 +1,33 @@
1
1
  {
2
2
  "name": "@psdk/device-webusb",
3
- "version": "0.2.67",
3
+ "version": "0.3.0",
4
4
  "description": "psdk",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
- "package": "tsc && ncc build --source-map build/index.js -m -C -o dist && npx webpack",
9
+ "package": "tsc && ncc build --source-map build/index.js -m -C -o dist",
10
10
  "test": "jest",
11
11
  "docs": "npx typedoc --out dist/docs index.ts"
12
12
  },
13
13
  "author": "",
14
14
  "devDependencies": {
15
- "@babel/plugin-proposal-class-properties": "^7.17.12",
16
- "@babel/plugin-proposal-decorators": "^7.17.12",
17
- "@babel/plugin-proposal-export-namespace-from": "^7.17.12",
18
- "@babel/plugin-proposal-function-sent": "^7.17.12",
19
- "@babel/plugin-proposal-numeric-separator": "^7.16.7",
20
- "@babel/plugin-proposal-object-rest-spread": "^7.18.0",
21
- "@babel/plugin-proposal-throw-expressions": "^7.16.7",
22
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
23
- "@babel/plugin-syntax-import-meta": "^7.10.4",
24
- "@babel/plugin-transform-modules-commonjs": "^7.18.0",
25
- "@babel/plugin-transform-object-assign": "^7.16.7",
26
- "@babel/plugin-transform-runtime": "^7.18.0",
27
- "@babel/preset-env": "^7.18.0",
28
- "@babel/preset-typescript": "^7.17.12",
29
- "@babel/register": "^7.17.7",
30
- "@babel/runtime-corejs3": "^7.18.0",
31
- "@types/jest": "^27.5.1",
32
- "@types/node": "^17.0.35",
33
- "@vercel/ncc": "^0.33.4",
34
- "babel-loader": "^8.2.5",
35
- "buffer": "^6.0.3",
36
- "jest": "^28.1.0",
37
- "string_decoder": "^1.3.0",
38
- "ts-jest": "^28.0.2",
39
- "typedoc": "^0.22.15",
40
- "typescript": "^4.6.4",
41
- "webpack": "^5.72.1",
42
- "webpack-cli": "^4.9.2"
15
+ "@babel/core": "^7.24.5",
16
+ "@babel/preset-env": "^7.24.5",
17
+ "@babel/preset-typescript": "^7.24.1",
18
+ "@types/jest": "^29.5.12",
19
+ "@vercel/ncc": "^0.38.1",
20
+ "babel-jest": "^29.7.0",
21
+ "jest": "^29.7.0",
22
+ "typedoc": "^0.25.13",
23
+ "typescript": "^5.4.5"
43
24
  },
44
25
  "dependencies": {
45
- "@psdk/frame-father": "0.2.67"
26
+ "@psdk/frame-father": "0.3.0"
46
27
  },
47
28
  "files": [
48
29
  "build",
49
30
  "!build/browser/psdk*"
50
31
  ],
51
- "gitHead": "1b469612990a3efbf1a3fe4296ed13e8c8865988"
32
+ "gitHead": "9796259a6a24ae7e334340f6c28d5ae9b3e45401"
52
33
  }