usb 1.9.2 → 2.0.2

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 (60) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.json +87 -0
  3. package/.gitattributes +1 -0
  4. package/.vscode/launch.json +15 -0
  5. package/.vscode/tasks.json +23 -0
  6. package/CHANGELOG.md +13 -0
  7. package/README.md +400 -175
  8. package/dist/index.d.ts +17 -0
  9. package/dist/index.js +138 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/usb/bindings.d.ts +253 -0
  12. package/dist/usb/bindings.js +10 -0
  13. package/dist/usb/bindings.js.map +1 -0
  14. package/dist/usb/capability.d.ts +14 -0
  15. package/dist/usb/capability.js +18 -0
  16. package/dist/usb/capability.js.map +1 -0
  17. package/dist/usb/descriptors.d.ts +129 -0
  18. package/dist/usb/descriptors.js +3 -0
  19. package/dist/usb/descriptors.js.map +1 -0
  20. package/dist/usb/device.d.ts +94 -0
  21. package/dist/usb/device.js +300 -0
  22. package/dist/usb/device.js.map +1 -0
  23. package/dist/usb/endpoint.d.ts +91 -0
  24. package/dist/usb/endpoint.js +236 -0
  25. package/dist/usb/endpoint.js.map +1 -0
  26. package/dist/usb/index.d.ts +25 -0
  27. package/dist/usb/index.js +116 -0
  28. package/dist/usb/index.js.map +1 -0
  29. package/dist/usb/interface.d.ts +78 -0
  30. package/dist/usb/interface.js +137 -0
  31. package/dist/usb/interface.js.map +1 -0
  32. package/dist/webusb/index.d.ts +56 -0
  33. package/dist/webusb/index.js +412 -0
  34. package/dist/webusb/index.js.map +1 -0
  35. package/dist/webusb/mutex.d.ts +22 -0
  36. package/dist/webusb/mutex.js +89 -0
  37. package/dist/webusb/mutex.js.map +1 -0
  38. package/dist/webusb/webusb-device.d.ts +49 -0
  39. package/dist/webusb/webusb-device.js +892 -0
  40. package/dist/webusb/webusb-device.js.map +1 -0
  41. package/package.json +28 -15
  42. package/prebuilds/win32-ia32/node.napi.node +0 -0
  43. package/prebuilds/win32-x64/node.napi.node +0 -0
  44. package/src/device.cc +2 -2
  45. package/test/usb.coffee +13 -7
  46. package/test/webusb.coffee +189 -0
  47. package/tsc/index.ts +72 -0
  48. package/tsc/usb/bindings.ts +304 -0
  49. package/tsc/usb/capability.ts +22 -0
  50. package/tsc/usb/descriptors.ts +180 -0
  51. package/tsc/usb/device.ts +325 -0
  52. package/tsc/usb/endpoint.ts +228 -0
  53. package/tsc/usb/index.ts +111 -0
  54. package/tsc/usb/interface.ts +172 -0
  55. package/tsc/webusb/index.ts +363 -0
  56. package/tsc/webusb/mutex.ts +38 -0
  57. package/tsc/webusb/webusb-device.ts +541 -0
  58. package/tsconfig.json +17 -0
  59. package/typedoc.json +9 -0
  60. package/usb.js +0 -573
package/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ build
3
+ dist
4
+ docs
package/.eslintrc.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": [
4
+ "@typescript-eslint"
5
+ ],
6
+ "extends": [
7
+ // https://eslint.org/docs/rules/
8
+ "eslint:recommended",
9
+ // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
10
+ "plugin:@typescript-eslint/recommended"
11
+ ],
12
+ "rules": {
13
+ "@typescript-eslint/no-empty-interface": [
14
+ "warn"
15
+ ],
16
+ "@typescript-eslint/no-this-alias": [
17
+ "warn"
18
+ ],
19
+ "@typescript-eslint/no-unused-vars": [
20
+ "warn",
21
+ {
22
+ "argsIgnorePattern": "^_"
23
+ }
24
+ ],
25
+ "block-spacing": [
26
+ "error",
27
+ "always"
28
+ ],
29
+ "brace-style": [
30
+ "error",
31
+ "1tbs",
32
+ {
33
+ "allowSingleLine": true
34
+ }
35
+ ],
36
+ "eol-last": [
37
+ "error"
38
+ ],
39
+ "indent": [
40
+ "error",
41
+ 4,
42
+ {
43
+ "SwitchCase": 1
44
+ }
45
+ ],
46
+ "linebreak-style": [
47
+ "error",
48
+ "unix"
49
+ ],
50
+ "no-console": [
51
+ "warn"
52
+ ],
53
+ "no-constant-condition": [
54
+ "error",
55
+ {
56
+ "checkLoops": false
57
+ }
58
+ ],
59
+ "no-trailing-spaces": [
60
+ "error"
61
+ ],
62
+ "object-curly-spacing": [
63
+ "error",
64
+ "always"
65
+ ],
66
+ "quotes": [
67
+ "error",
68
+ "single"
69
+ ],
70
+ "semi": [
71
+ "error",
72
+ "always"
73
+ ]
74
+ },
75
+ "env": {
76
+ "commonjs": true,
77
+ "es6": true,
78
+ "node": true
79
+ },
80
+ "parserOptions": {
81
+ "ecmaVersion": 12,
82
+ "sourceType": "module",
83
+ "project": [
84
+ "./tsconfig.json"
85
+ ]
86
+ }
87
+ }
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * -text
@@ -0,0 +1,15 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Full Test",
9
+ "type": "node-terminal",
10
+ "request": "launch",
11
+ "preLaunchTask": "test",
12
+ "command": "exit 0",
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "tasks": [
3
+ {
4
+ "label": "compile",
5
+ "type": "npm",
6
+ "script": "compile"
7
+ },
8
+ {
9
+ "label": "watch",
10
+ "type": "npm",
11
+ "script": "watch",
12
+ "group": {
13
+ "kind": "build",
14
+ "isDefault": true
15
+ }
16
+ },
17
+ {
18
+ "label": "test",
19
+ "type": "npm",
20
+ "script": "full-test"
21
+ }
22
+ ]
23
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.2] - 2021-12-12
4
+
5
+ ### Fixed
6
+ - Fixed error with trying to close WebUSB devices after they had failed to open - ([Rob Moran](https://github.com/thegecko))
7
+
8
+ ## [2.0.1] - 2021-12-11
9
+
10
+ ### Added
11
+ - Added new WebUSB API - [`443`](https://github.com/node-usb/node-usb/pull/443) ([Rob Moran](https://github.com/thegecko))
12
+ - Switched to TypeScript
13
+ - Switched to yarn instead of npm
14
+ - Added docs using Typedoc
15
+
3
16
  ## [1.9.2] - 2021-12-05
4
17
 
5
18
  ### Fixed