Update typesccript, simplify imports

This commit is contained in:
Kirill Zhumarin 2026-09-28 11:39:33 +00:00
parent 08754030ee
commit ef0c0e8cf7
6 changed files with 242 additions and 31 deletions

View file

@ -12,17 +12,18 @@
"./*": "./*"
},
"imports": {
"#src/*": "./dist/src/*"
"#src/*": "./dist/src/*",
"#tests/*": "./dist/tests/*"
},
"scripts": {
"build": "tsc",
"test": "vitest run --project unit",
"test:watch": "vitest --project unit",
"test:bfb-hardware": "BFB_HARDWARE=1 vitest run src/bfb/BFB.test.ts",
"test:obex-emulator": "vitest run --project obex-emulator --no-file-parallelism",
"test:obex-hardware": "vitest run --project obex-hardware",
"build": "tsc",
"watch": "tsc -w",
"test:bfb-hardware": "BFB_HARDWARE=1 vitest run src/bfb/BFB.test.ts",
"test:ppp-hardware": "PPP_HARDWARE=1 vitest run src/ppp/PPP.test.ts"
"test:ppp-hardware": "PPP_HARDWARE=1 vitest run src/ppp/PPP.test.ts",
"test:watch": "vitest --project unit",
"watch": "tsc -w"
},
"author": "kirill.zhumarin@gmail.com",
"license": "MIT",
@ -35,7 +36,6 @@
"!dist/src/**/*.test.*"
],
"dependencies": {
"@sie-js/node-serialport-bindings-cpp": "^0.0.2",
"sprintf-js": "^1.1.3"
},
"devDependencies": {
@ -43,6 +43,7 @@
"@serialport/bindings-interface": "^1.2.2",
"@serialport/stream": "^13.0.0",
"@sie-js/creampie": "^1.0.3",
"@sie-js/node-serialport-bindings-cpp": "^0.0.2",
"@types/debug": "^4.1.13",
"@types/node": "^22.20.4",
"@types/sprintf-js": "^1.1.4",
@ -51,7 +52,7 @@
"serialport": "^13.0.0",
"serialport-bindings-socket": "^1.0.4",
"tsx": "^4.23.15",
"typescript": "^5.9.3",
"typescript": "^7.0.2",
"vitest": "^3.2.7"
},
"packageManager": "pnpm@12.7.0+sha512.9c56477e360068d6e9dca6a92efb4e46b3dc5a52fcebf3d84d78b9736c0ded589a561621a52f68219a7a39facc63cdc079c3226ef9c9d5f02b79f74e69a807b6",

219
pnpm-lock.yaml generated
View file

@ -172,9 +172,6 @@ importers:
.:
dependencies:
'@sie-js/node-serialport-bindings-cpp':
specifier: ^0.0.2
version: 0.0.2
sprintf-js:
specifier: ^1.1.3
version: 1.1.3
@ -191,6 +188,9 @@ importers:
'@sie-js/creampie':
specifier: ^1.0.3
version: 1.0.3
'@sie-js/node-serialport-bindings-cpp':
specifier: ^0.0.2
version: 0.0.2
'@types/debug':
specifier: ^4.1.13
version: 4.1.13
@ -216,8 +216,8 @@ importers:
specifier: ^4.23.15
version: 4.23.15
typescript:
specifier: ^5.9.3
version: 5.9.3
specifier: ^7.0.2
version: 7.0.2
vitest:
specifier: ^3.2.7
version: 3.2.7(@types/debug@4.1.13)(@types/node@22.20.4)(tsx@4.23.15)
@ -611,6 +611,126 @@ packages:
'@types/throttle-debounce@5.0.2':
resolution: {integrity: sha512-pDzSNulqooSKvSNcksnV72nk8p7gRqN8As71Sp28nov1IgmPKWbOEIwAWvBME5pPTtaXJAvG3O4oc76HlQ4kqQ==}
'@typescript/typescript-aix-ppc64@7.0.2':
resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==}
engines: {node: '>=16.20.0'}
cpu: [ppc64]
os: [aix]
'@typescript/typescript-darwin-arm64@7.0.2':
resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [darwin]
'@typescript/typescript-darwin-x64@7.0.2':
resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [darwin]
'@typescript/typescript-freebsd-arm64@7.0.2':
resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [freebsd]
'@typescript/typescript-freebsd-x64@7.0.2':
resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [freebsd]
'@typescript/typescript-linux-arm64@7.0.2':
resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [linux]
'@typescript/typescript-linux-arm@7.0.2':
resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==}
engines: {node: '>=16.20.0'}
cpu: [arm]
os: [linux]
'@typescript/typescript-linux-loong64@7.0.2':
resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==}
engines: {node: '>=16.20.0'}
cpu: [loong64]
os: [linux]
'@typescript/typescript-linux-mips64el@7.0.2':
resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==}
engines: {node: '>=16.20.0'}
cpu: [mips64el]
os: [linux]
'@typescript/typescript-linux-ppc64@7.0.2':
resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==}
engines: {node: '>=16.20.0'}
cpu: [ppc64]
os: [linux]
'@typescript/typescript-linux-riscv64@7.0.2':
resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==}
engines: {node: '>=16.20.0'}
cpu: [riscv64]
os: [linux]
'@typescript/typescript-linux-s390x@7.0.2':
resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==}
engines: {node: '>=16.20.0'}
cpu: [s390x]
os: [linux]
'@typescript/typescript-linux-x64@7.0.2':
resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [linux]
'@typescript/typescript-netbsd-arm64@7.0.2':
resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [netbsd]
'@typescript/typescript-netbsd-x64@7.0.2':
resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [netbsd]
'@typescript/typescript-openbsd-arm64@7.0.2':
resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [openbsd]
'@typescript/typescript-openbsd-x64@7.0.2':
resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [openbsd]
'@typescript/typescript-sunos-x64@7.0.2':
resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [sunos]
'@typescript/typescript-win32-arm64@7.0.2':
resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [win32]
'@typescript/typescript-win32-x64@7.0.2':
resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [win32]
'@vitest/expect@3.2.7':
resolution: {integrity: sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==}
@ -808,9 +928,9 @@ packages:
engines: {node: '>=18.0.0'}
hasBin: true
typescript@5.9.3:
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
engines: {node: '>=14.17'}
typescript@7.0.2:
resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==}
engines: {node: '>=16.20.0'}
hasBin: true
undici-types@6.21.0:
@ -1127,6 +1247,66 @@ snapshots:
'@types/throttle-debounce@5.0.2': {}
'@typescript/typescript-aix-ppc64@7.0.2':
optional: true
'@typescript/typescript-darwin-arm64@7.0.2':
optional: true
'@typescript/typescript-darwin-x64@7.0.2':
optional: true
'@typescript/typescript-freebsd-arm64@7.0.2':
optional: true
'@typescript/typescript-freebsd-x64@7.0.2':
optional: true
'@typescript/typescript-linux-arm64@7.0.2':
optional: true
'@typescript/typescript-linux-arm@7.0.2':
optional: true
'@typescript/typescript-linux-loong64@7.0.2':
optional: true
'@typescript/typescript-linux-mips64el@7.0.2':
optional: true
'@typescript/typescript-linux-ppc64@7.0.2':
optional: true
'@typescript/typescript-linux-riscv64@7.0.2':
optional: true
'@typescript/typescript-linux-s390x@7.0.2':
optional: true
'@typescript/typescript-linux-x64@7.0.2':
optional: true
'@typescript/typescript-netbsd-arm64@7.0.2':
optional: true
'@typescript/typescript-netbsd-x64@7.0.2':
optional: true
'@typescript/typescript-openbsd-arm64@7.0.2':
optional: true
'@typescript/typescript-openbsd-x64@7.0.2':
optional: true
'@typescript/typescript-sunos-x64@7.0.2':
optional: true
'@typescript/typescript-win32-arm64@7.0.2':
optional: true
'@typescript/typescript-win32-x64@7.0.2':
optional: true
'@vitest/expect@3.2.7':
dependencies:
'@types/chai': 5.2.3
@ -1355,7 +1535,28 @@ snapshots:
optionalDependencies:
fsevents: 2.3.3
typescript@5.9.3: {}
typescript@7.0.2:
optionalDependencies:
'@typescript/typescript-aix-ppc64': 7.0.2
'@typescript/typescript-darwin-arm64': 7.0.2
'@typescript/typescript-darwin-x64': 7.0.2
'@typescript/typescript-freebsd-arm64': 7.0.2
'@typescript/typescript-freebsd-x64': 7.0.2
'@typescript/typescript-linux-arm': 7.0.2
'@typescript/typescript-linux-arm64': 7.0.2
'@typescript/typescript-linux-loong64': 7.0.2
'@typescript/typescript-linux-mips64el': 7.0.2
'@typescript/typescript-linux-ppc64': 7.0.2
'@typescript/typescript-linux-riscv64': 7.0.2
'@typescript/typescript-linux-s390x': 7.0.2
'@typescript/typescript-linux-x64': 7.0.2
'@typescript/typescript-netbsd-arm64': 7.0.2
'@typescript/typescript-netbsd-x64': 7.0.2
'@typescript/typescript-openbsd-arm64': 7.0.2
'@typescript/typescript-openbsd-x64': 7.0.2
'@typescript/typescript-sunos-x64': 7.0.2
'@typescript/typescript-win32-arm64': 7.0.2
'@typescript/typescript-win32-x64': 7.0.2
undici-types@6.21.0: {}

View file

@ -5,9 +5,9 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, test } from 'vitest';
import { OBEX, ObexDelays } from './OBEX.js';
import { clientPlatform, isUsable, loadDatabase, PhoneEntry } from '../../tests/obex/phones/entry.js';
import { openFakePhonePort } from '../../tests/obex/phones/fakePhone.js';
import { probePhone } from '../../tests/obex/phones/probe.js';
import { clientPlatform, isUsable, loadDatabase, PhoneEntry } from '#tests/obex/phones/entry.js';
import { openFakePhonePort } from '#tests/obex/phones/fakePhone.js';
import { probePhone } from '#tests/obex/phones/probe.js';
const DB = path.join(path.dirname(fileURLToPath(import.meta.url)), '../../tests/obex/phones/db');
const database = loadDatabase(DB);

View file

@ -2,15 +2,14 @@
// set up per test from a few knobs, with faults injected: lost answers, failed
// writes, a slow or silent AT interpreter, answers of the test's own.
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { setTimeout as delay } from 'node:timers/promises';
import { describe, expect, test } from 'vitest';
import { AsyncSerialPort } from '#src/AsyncSerialPort.js';
import { OBEX, OBEX_TARGET_FLEXMEM, ObexDelays, ObexHeaderId, ObexOpcode, ObexProgress, parseObexHeaders } from './OBEX.js';
import { loadEntry, PhoneEntry } from '../../tests/obex/phones/entry.js';
import { FakePhone, openFakePhonePort } from '../../tests/obex/phones/fakePhone.js';
import { obexPacket } from '../../tests/obex/packets.js';
import { loadEntry, PhoneEntry } from '#tests/obex/phones/entry.js';
import { FakePhone, openFakePhonePort } from '#tests/obex/phones/fakePhone.js';
import { obexPacket } from '#tests/obex/packets.js';
// The phones answer at once, so the protocol delays only keep their order, and a
// lost answer is given up on quickly
@ -19,7 +18,7 @@ const FAST: Partial<ObexDelays> = { escape: 30, flush: 10, response: 400, abort:
const ALL_SPEEDS = [115200, 57600, 19200, 230400, 9600, 38400];
// The BFB behaviors of a pre-x55 phone
const S45 = loadEntry(path.join(path.dirname(fileURLToPath(import.meta.url)), '../../tests/obex/phones/db/synthetic-S45v56.json'));
const S45 = loadEntry(fileURLToPath(new URL('../../tests/obex/phones/db/synthetic-S45v56.json', import.meta.url)));
type PhoneOptions = {
model?: string;

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'vitest';
import { ObexBfbLink } from './ObexBfbLink.js';
import { openDevicePort, SerialDevice } from '../../tests/obex/phones/fakePhone.js';
import { openDevicePort, SerialDevice } from '#tests/obex/phones/fakePhone.js';
// Wire bytes of siefs' tra_send() and obexftp's bfb_stuff_data(), which frame
// these packets byte-identically: 0x02 marks the first packet of the session,

View file

@ -1,16 +1,26 @@
{
"compilerOptions": {
"declaration": true,
"rootDir": ".",
"outDir": "./dist",
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ESNext",
"lib": ["ESNext"],
"types": ["node"],
"paths": {
"@sie-js/serial": ["./src/index.ts"],
"#src/*": ["./src/*"],
"#tests/*": ["./tests/*"]
},
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"strict": true,
"noUncheckedSideEffectImports": true,
"moduleDetection": "force",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"lib": ["ESNext"]
"skipLibCheck": true
},
"include": ["src", "examples", "tests", "tools", "mmu.ts"],
"exclude": ["node_modules", "dist"]