node-web-i2c 1.1.46 → 1.1.50
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/index.js +2 -2
- package/index.ts +3 -3
- package/package.json +10 -13
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OperationError = exports.I2CPort = exports.I2CPortMap = exports.I2CAccess = void 0;
|
|
4
|
+
exports.requestI2CAccess = requestI2CAccess;
|
|
4
5
|
const i2c_bus_1 = require("i2c-bus");
|
|
5
6
|
/**
|
|
6
7
|
* I2C Port Map Max サイズ
|
|
@@ -221,4 +222,3 @@ async function requestI2CAccess() {
|
|
|
221
222
|
]));
|
|
222
223
|
return new I2CAccess(ports);
|
|
223
224
|
}
|
|
224
|
-
exports.requestI2CAccess = requestI2CAccess;
|
package/index.ts
CHANGED
|
@@ -173,7 +173,7 @@ export class I2CPort {
|
|
|
173
173
|
const { bytesRead, buffer } = await bus.i2cRead(
|
|
174
174
|
slaveAddress,
|
|
175
175
|
length,
|
|
176
|
-
Buffer.allocUnsafe(length)
|
|
176
|
+
Buffer.allocUnsafe(length),
|
|
177
177
|
);
|
|
178
178
|
return new Uint8Array(buffer.slice(0, bytesRead));
|
|
179
179
|
} catch (error: any) {
|
|
@@ -205,7 +205,7 @@ export class I2CPort {
|
|
|
205
205
|
const { bytesWritten, buffer } = await bus.i2cWrite(
|
|
206
206
|
slaveAddress,
|
|
207
207
|
bytes.length,
|
|
208
|
-
Buffer.from(bytes)
|
|
208
|
+
Buffer.from(bytes),
|
|
209
209
|
);
|
|
210
210
|
return new Uint8Array(buffer.slice(0, bytesWritten));
|
|
211
211
|
} catch (error: any) {
|
|
@@ -300,7 +300,7 @@ export async function requestI2CAccess(): Promise<I2CAccess> {
|
|
|
300
300
|
[...Array(I2CPortMapSizeMax).keys()].map((portNumber) => [
|
|
301
301
|
portNumber,
|
|
302
302
|
new I2CPort(portNumber),
|
|
303
|
-
])
|
|
303
|
+
]),
|
|
304
304
|
);
|
|
305
305
|
|
|
306
306
|
return new I2CAccess(ports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-web-i2c",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.50",
|
|
4
4
|
"description": "I2C access with Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -13,24 +13,21 @@
|
|
|
13
13
|
"author": "Kohei Watanabe <kou029w@gmail.com>",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@types/i2c-bus": "^5.1.
|
|
17
|
-
"@types/node": "^
|
|
18
|
-
"i2c-bus": "^5.2.
|
|
16
|
+
"@types/i2c-bus": "^5.1.2",
|
|
17
|
+
"@types/node": "^24.10.1",
|
|
18
|
+
"i2c-bus": "^5.2.3"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@biomejs/biome": "^2.3.8",
|
|
21
22
|
"@types/node": "22.18.13",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"lint-staged": "15.5.2",
|
|
27
|
-
"prettier": "3.6.2",
|
|
28
|
-
"typedoc": "0.25.13",
|
|
29
|
-
"typescript": "5.4.5"
|
|
23
|
+
"husky": "9.1.7",
|
|
24
|
+
"lint-staged": "16.2.7",
|
|
25
|
+
"typedoc": "0.28.15",
|
|
26
|
+
"typescript": "5.9.3"
|
|
30
27
|
},
|
|
31
28
|
"scripts": {
|
|
32
29
|
"build": "tsc",
|
|
33
|
-
"lint": "
|
|
30
|
+
"lint": "biome check --write --no-errors-on-unmatched",
|
|
34
31
|
"prepare": "husky install && rm -rf dist && npm run build",
|
|
35
32
|
"precommit": "lint-staged",
|
|
36
33
|
"preversion": "npm run docs && git add docs",
|