mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-06 03:50:18 +02:00
chore: format code with prettier
This commit is contained in:
parent
6f1be248fb
commit
6ada4a7a06
77 changed files with 459 additions and 283 deletions
|
@ -50,6 +50,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"eslint-config-next": "13.1.5",
|
||||
"source-map-loader": "^4.0.1",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
44
common/config/rush/pnpm-lock.yaml
generated
44
common/config/rush/pnpm-lock.yaml
generated
|
@ -37,6 +37,7 @@ importers:
|
|||
mobx: ^6.7.0
|
||||
mobx-react-lite: ^3.4.0
|
||||
next: 13.1.5
|
||||
prettier: ^2.8.4
|
||||
react: ^18.2.0
|
||||
react-dom: ^18.2.0
|
||||
source-map-loader: ^4.0.1
|
||||
|
@ -85,6 +86,7 @@ importers:
|
|||
'@types/react': 18.0.27
|
||||
eslint: 8.32.0
|
||||
eslint-config-next: 13.1.5_7uibuqfxkfaozanbtbziikiqje
|
||||
prettier: 2.8.4
|
||||
source-map-loader: 4.0.1
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -102,6 +104,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
|
@ -120,6 +123,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1_@types+node@18.11.18
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -130,6 +134,7 @@ importers:
|
|||
'@yume-chan/stream-extra': workspace:^0.0.18
|
||||
'@yume-chan/tsconfig': workspace:^1.0.0
|
||||
eslint: ^8.31.0
|
||||
prettier: ^2.8.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
dependencies:
|
||||
|
@ -140,6 +145,7 @@ importers:
|
|||
'@yume-chan/eslint-config': link:../../toolchain/eslint-config
|
||||
'@yume-chan/tsconfig': link:../../toolchain/tsconfig
|
||||
eslint: 8.32.0
|
||||
prettier: 2.8.4
|
||||
typescript: 4.9.4
|
||||
|
||||
../../libraries/adb-backend-webusb:
|
||||
|
@ -151,6 +157,7 @@ importers:
|
|||
'@yume-chan/struct': workspace:^0.0.18
|
||||
'@yume-chan/tsconfig': workspace:^1.0.0
|
||||
eslint: ^8.31.0
|
||||
prettier: ^2.8.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
dependencies:
|
||||
|
@ -163,6 +170,7 @@ importers:
|
|||
'@yume-chan/eslint-config': link:../../toolchain/eslint-config
|
||||
'@yume-chan/tsconfig': link:../../toolchain/tsconfig
|
||||
eslint: 8.32.0
|
||||
prettier: 2.8.4
|
||||
typescript: 4.9.4
|
||||
|
||||
../../libraries/adb-backend-ws:
|
||||
|
@ -173,6 +181,7 @@ importers:
|
|||
'@yume-chan/tsconfig': workspace:^1.0.0
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
dependencies:
|
||||
|
@ -184,6 +193,7 @@ importers:
|
|||
'@yume-chan/tsconfig': link:../../toolchain/tsconfig
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
typescript: 4.9.4
|
||||
|
||||
../../libraries/adb-credential-web:
|
||||
|
@ -192,6 +202,7 @@ importers:
|
|||
'@yume-chan/eslint-config': workspace:^1.0.0
|
||||
'@yume-chan/tsconfig': workspace:^1.0.0
|
||||
eslint: ^8.31.0
|
||||
prettier: ^2.8.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
dependencies:
|
||||
|
@ -201,6 +212,7 @@ importers:
|
|||
'@yume-chan/eslint-config': link:../../toolchain/eslint-config
|
||||
'@yume-chan/tsconfig': link:../../toolchain/tsconfig
|
||||
eslint: 8.32.0
|
||||
prettier: 2.8.4
|
||||
typescript: 4.9.4
|
||||
|
||||
../../libraries/android-bin:
|
||||
|
@ -211,6 +223,7 @@ importers:
|
|||
'@yume-chan/struct': workspace:^0.0.18
|
||||
'@yume-chan/tsconfig': workspace:^1.0.0
|
||||
eslint: ^8.31.0
|
||||
prettier: ^2.8.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
dependencies:
|
||||
|
@ -222,6 +235,7 @@ importers:
|
|||
'@yume-chan/eslint-config': link:../../toolchain/eslint-config
|
||||
'@yume-chan/tsconfig': link:../../toolchain/tsconfig
|
||||
eslint: 8.32.0
|
||||
prettier: 2.8.4
|
||||
typescript: 4.9.4
|
||||
|
||||
../../libraries/b-tree:
|
||||
|
@ -232,6 +246,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
|
@ -244,6 +259,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -253,6 +269,7 @@ importers:
|
|||
'@yume-chan/tsconfig': workspace:^1.0.0
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
dependencies:
|
||||
|
@ -262,6 +279,7 @@ importers:
|
|||
'@yume-chan/tsconfig': link:../../toolchain/tsconfig
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
typescript: 4.9.4
|
||||
|
||||
../../libraries/event:
|
||||
|
@ -273,6 +291,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
|
@ -286,6 +305,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -303,6 +323,7 @@ importers:
|
|||
eslint: ^8.31.0
|
||||
gh-release-fetch: ^3.0.2
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
|
@ -321,6 +342,7 @@ importers:
|
|||
eslint: 8.32.0
|
||||
gh-release-fetch: 3.0.2
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -336,6 +358,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
tinyh264: ^0.0.7
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
|
@ -358,6 +381,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -372,6 +396,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
|
@ -387,6 +412,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -400,6 +426,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
|
@ -416,6 +443,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -428,6 +456,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.31.0
|
||||
jest: ^29.3.1
|
||||
prettier: ^2.8.4
|
||||
ts-jest: ^29.0.4
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.4
|
||||
|
@ -441,6 +470,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.32.0
|
||||
jest: 29.4.1
|
||||
prettier: 2.8.4
|
||||
ts-jest: 29.0.5_xnqx6kewz4og5i3pgc6ahzwloy
|
||||
typescript: 4.9.4
|
||||
|
||||
|
@ -451,6 +481,7 @@ importers:
|
|||
'@typescript-eslint/parser': ^5.48.1
|
||||
eslint: ^8.31.0
|
||||
eslint-plugin-import: ^2.27.4
|
||||
prettier: ^2.8.4
|
||||
typescript: ^4.9.4
|
||||
dependencies:
|
||||
'@rushstack/eslint-patch': 1.2.0
|
||||
|
@ -459,9 +490,14 @@ importers:
|
|||
eslint: 8.32.0
|
||||
eslint-plugin-import: 2.27.5_eslint@8.32.0
|
||||
typescript: 4.9.4
|
||||
devDependencies:
|
||||
prettier: 2.8.4
|
||||
|
||||
../../toolchain/tsconfig:
|
||||
specifiers: {}
|
||||
specifiers:
|
||||
prettier: ^2.8.4
|
||||
devDependencies:
|
||||
prettier: 2.8.4
|
||||
|
||||
packages:
|
||||
|
||||
|
@ -5392,6 +5428,12 @@ packages:
|
|||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/prettier/2.8.4:
|
||||
resolution: {integrity: sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/pretty-format/29.4.1:
|
||||
resolution: {integrity: sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
|
||||
{
|
||||
"pnpmShrinkwrapHash": "a24d7adf57216e6b77bdb8d7324e46c04d17c6e3",
|
||||
"pnpmShrinkwrapHash": "3e5a716ba1e8bfb6c9b5bd7018741744d14f80d0",
|
||||
"preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"
|
||||
}
|
||||
|
|
|
@ -28,14 +28,15 @@
|
|||
"scripts": {
|
||||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@yume-chan/eslint-config": "workspace:^1.0.0",
|
||||
"@yume-chan/tsconfig": "workspace:^1.0.0",
|
||||
"eslint": "^8.31.0",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@yume-chan/adb": "workspace:^0.0.18",
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"scripts": {
|
||||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -41,6 +41,7 @@
|
|||
"@yume-chan/eslint-config": "workspace:^1.0.0",
|
||||
"@yume-chan/tsconfig": "workspace:^1.0.0",
|
||||
"eslint": "^8.31.0",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from './backend.js';
|
||||
export { AdbWebUsbBackend as default } from './backend.js';
|
||||
export * from './watcher.js';
|
||||
export * from "./backend.js";
|
||||
export { AdbWebUsbBackend as default } from "./backend.js";
|
||||
export * from "./watcher.js";
|
||||
|
|
|
@ -4,13 +4,19 @@ export class AdbWebUsbBackendWatcher {
|
|||
public constructor(callback: (newDeviceSerial?: string) => void) {
|
||||
this.callback = callback;
|
||||
|
||||
window.navigator.usb.addEventListener('connect', this.handleConnect);
|
||||
window.navigator.usb.addEventListener('disconnect', this.handleDisconnect);
|
||||
window.navigator.usb.addEventListener("connect", this.handleConnect);
|
||||
window.navigator.usb.addEventListener(
|
||||
"disconnect",
|
||||
this.handleDisconnect
|
||||
);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
window.navigator.usb.removeEventListener('connect', this.handleConnect);
|
||||
window.navigator.usb.removeEventListener('disconnect', this.handleDisconnect);
|
||||
window.navigator.usb.removeEventListener("connect", this.handleConnect);
|
||||
window.navigator.usb.removeEventListener(
|
||||
"disconnect",
|
||||
this.handleDisconnect
|
||||
);
|
||||
}
|
||||
|
||||
private handleConnect = (e: USBConnectionEvent) => {
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
"@yume-chan/tsconfig": "workspace:^1.0.0",
|
||||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@yume-chan/adb": "workspace:^0.0.18",
|
||||
|
|
|
@ -26,14 +26,15 @@
|
|||
"scripts": {
|
||||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@yume-chan/eslint-config": "workspace:^1.0.0",
|
||||
"@yume-chan/tsconfig": "workspace:^1.0.0",
|
||||
"eslint": "^8.31.0",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@yume-chan/adb": "workspace:^0.0.18",
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -48,6 +48,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ export const AdbFrameBufferV1 = new Struct({ littleEndian: true })
|
|||
.uint32("alpha_length")
|
||||
.uint8Array("data", { lengthField: "size" });
|
||||
|
||||
export type AdbFrameBufferV1 = typeof AdbFrameBufferV1["TDeserializeResult"];
|
||||
export type AdbFrameBufferV1 = (typeof AdbFrameBufferV1)["TDeserializeResult"];
|
||||
|
||||
export const AdbFrameBufferV2 = new Struct({ littleEndian: true })
|
||||
.uint32("bpp")
|
||||
|
@ -38,7 +38,7 @@ export const AdbFrameBufferV2 = new Struct({ littleEndian: true })
|
|||
.uint32("alpha_length")
|
||||
.uint8Array("data", { lengthField: "size" });
|
||||
|
||||
export type AdbFrameBufferV2 = typeof AdbFrameBufferV2["TDeserializeResult"];
|
||||
export type AdbFrameBufferV2 = (typeof AdbFrameBufferV2)["TDeserializeResult"];
|
||||
|
||||
/**
|
||||
* ADB uses 8 int32 fields to describe bit depths
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
export * from './base.js';
|
||||
export * from './framebuffer.js';
|
||||
export * from './install.js';
|
||||
export * from './power.js';
|
||||
export * from './reverse.js';
|
||||
export * from './subprocess/index.js';
|
||||
export * from './sync/index.js';
|
||||
export * from './tcpip.js';
|
||||
export * from "./base.js";
|
||||
export * from "./framebuffer.js";
|
||||
export * from "./install.js";
|
||||
export * from "./power.js";
|
||||
export * from "./reverse.js";
|
||||
export * from "./subprocess/index.js";
|
||||
export * from "./sync/index.js";
|
||||
export * from "./tcpip.js";
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from './command.js';
|
||||
export * from './protocols/index.js';
|
||||
export * from './utils.js';
|
||||
export * from "./command.js";
|
||||
export * from "./protocols/index.js";
|
||||
export * from "./utils.js";
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from './none.js';
|
||||
export * from './shell.js';
|
||||
export * from './types.js';
|
||||
export * from "./none.js";
|
||||
export * from "./shell.js";
|
||||
export * from "./types.js";
|
||||
|
|
|
@ -37,7 +37,7 @@ const AdbShellProtocolPacket = new Struct({ littleEndian: true })
|
|||
.uint32("length")
|
||||
.uint8Array("data", { lengthField: "length" });
|
||||
|
||||
type AdbShellProtocolPacketInit = typeof AdbShellProtocolPacket["TInit"];
|
||||
type AdbShellProtocolPacketInit = (typeof AdbShellProtocolPacket)["TInit"];
|
||||
|
||||
type AdbShellProtocolPacket = StructValueType<typeof AdbShellProtocolPacket>;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export function escapeArg(s: string) {
|
||||
let result = '';
|
||||
let result = "";
|
||||
result += `'`;
|
||||
|
||||
let base = 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export * from './list.js';
|
||||
export * from './pull.js';
|
||||
export * from './push.js';
|
||||
export * from './request.js';
|
||||
export * from './response.js';
|
||||
export * from './stat.js';
|
||||
export * from './sync.js';
|
||||
export * from "./list.js";
|
||||
export * from "./pull.js";
|
||||
export * from "./push.js";
|
||||
export * from "./request.js";
|
||||
export * from "./response.js";
|
||||
export * from "./stat.js";
|
||||
export * from "./sync.js";
|
||||
|
|
|
@ -20,7 +20,7 @@ export const AdbSyncEntryResponse = new Struct({ littleEndian: true })
|
|||
.extra({ id: AdbSyncResponseId.Entry as const });
|
||||
|
||||
export type AdbSyncEntryResponse =
|
||||
typeof AdbSyncEntryResponse["TDeserializeResult"];
|
||||
(typeof AdbSyncEntryResponse)["TDeserializeResult"];
|
||||
|
||||
export const AdbSyncEntry2Response = new Struct({ littleEndian: true })
|
||||
.fields(AdbSyncStatResponse)
|
||||
|
@ -29,7 +29,7 @@ export const AdbSyncEntry2Response = new Struct({ littleEndian: true })
|
|||
.extra({ id: AdbSyncResponseId.Entry2 as const });
|
||||
|
||||
export type AdbSyncEntry2Response =
|
||||
typeof AdbSyncEntry2Response["TDeserializeResult"];
|
||||
(typeof AdbSyncEntry2Response)["TDeserializeResult"];
|
||||
|
||||
export async function* adbSyncOpenDir(
|
||||
stream: BufferedReadableStream,
|
||||
|
|
|
@ -14,7 +14,7 @@ export const AdbSyncDataResponse = new Struct({ littleEndian: true })
|
|||
.extra({ id: AdbSyncResponseId.Data as const });
|
||||
|
||||
export type AdbSyncDataResponse =
|
||||
typeof AdbSyncDataResponse["TDeserializeResult"];
|
||||
(typeof AdbSyncDataResponse)["TDeserializeResult"];
|
||||
|
||||
export function adbSyncPull(
|
||||
stream: BufferedReadableStream,
|
||||
|
|
|
@ -47,7 +47,7 @@ export const AdbSyncLstatResponse = new Struct({ littleEndian: true })
|
|||
});
|
||||
|
||||
export type AdbSyncLstatResponse =
|
||||
typeof AdbSyncLstatResponse["TDeserializeResult"];
|
||||
(typeof AdbSyncLstatResponse)["TDeserializeResult"];
|
||||
|
||||
export enum AdbSyncStatErrorCode {
|
||||
SUCCESS = 0,
|
||||
|
@ -101,7 +101,7 @@ export const AdbSyncStatResponse = new Struct({ littleEndian: true })
|
|||
});
|
||||
|
||||
export type AdbSyncStatResponse =
|
||||
typeof AdbSyncStatResponse["TDeserializeResult"];
|
||||
(typeof AdbSyncStatResponse)["TDeserializeResult"];
|
||||
|
||||
export async function adbSyncLstat(
|
||||
stream: BufferedReadableStream,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AdbCommandBase } from './base.js';
|
||||
import { AdbCommandBase } from "./base.js";
|
||||
|
||||
export class AdbTcpIpCommand extends AdbCommandBase {
|
||||
public async setPort(port: number): Promise<void> {
|
||||
|
@ -8,14 +8,14 @@ export class AdbTcpIpCommand extends AdbCommandBase {
|
|||
|
||||
const output = await this.adb.createSocketAndWait(`tcpip:${port}`);
|
||||
if (output !== `restarting in TCP mode port: ${port}\n`) {
|
||||
throw new Error('Invalid response');
|
||||
throw new Error("Invalid response");
|
||||
}
|
||||
}
|
||||
|
||||
public async disable(): Promise<void> {
|
||||
const output = await this.adb.createSocketAndWait('usb:');
|
||||
if (output !== 'restarting in USB mode\n') {
|
||||
throw new Error('Invalid response');
|
||||
const output = await this.adb.createSocketAndWait("usb:");
|
||||
if (output !== "restarting in USB mode\n") {
|
||||
throw new Error("Invalid response");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// The order follows
|
||||
// https://android.googlesource.com/platform/packages/modules/adb/+/79010dc6d5ca7490c493df800d4421730f5466ca/transport.cpp#1252
|
||||
export enum AdbFeatures {
|
||||
ShellV2 = 'shell_v2',
|
||||
Cmd = 'cmd',
|
||||
StatV2 = 'stat_v2',
|
||||
ListV2 = 'ls_v2',
|
||||
FixedPushMkdir = 'fixed_push_mkdir',
|
||||
ShellV2 = "shell_v2",
|
||||
Cmd = "cmd",
|
||||
StatV2 = "stat_v2",
|
||||
ListV2 = "ls_v2",
|
||||
FixedPushMkdir = "fixed_push_mkdir",
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ export const AdbPacketHeader = new Struct({ littleEndian: true })
|
|||
.uint32("checksum")
|
||||
.int32("magic");
|
||||
|
||||
export type AdbPacketHeader = typeof AdbPacketHeader["TDeserializeResult"];
|
||||
export type AdbPacketHeader = (typeof AdbPacketHeader)["TDeserializeResult"];
|
||||
|
||||
type AdbPacketHeaderInit = typeof AdbPacketHeader["TInit"];
|
||||
type AdbPacketHeaderInit = (typeof AdbPacketHeader)["TInit"];
|
||||
|
||||
export const AdbPacket = new Struct({ littleEndian: true })
|
||||
.fields(AdbPacketHeader)
|
||||
.uint8Array("payload", { lengthField: "payloadLength" });
|
||||
|
||||
export type AdbPacket = typeof AdbPacket["TDeserializeResult"];
|
||||
export type AdbPacket = (typeof AdbPacket)["TDeserializeResult"];
|
||||
|
||||
/**
|
||||
* `AdbPacketData` contains all the useful fields of `AdbPacket`.
|
||||
|
@ -39,12 +39,12 @@ export type AdbPacket = typeof AdbPacket["TDeserializeResult"];
|
|||
* so `AdbSocket#writable#write` only needs `AdbPacketData`.
|
||||
*/
|
||||
export type AdbPacketData = Omit<
|
||||
typeof AdbPacket["TInit"],
|
||||
(typeof AdbPacket)["TInit"],
|
||||
"checksum" | "magic"
|
||||
>;
|
||||
|
||||
// All fields except `magic`, which can be calculated in `AdbPacketSerializeStream`
|
||||
export type AdbPacketInit = Omit<typeof AdbPacket["TInit"], "magic">;
|
||||
export type AdbPacketInit = Omit<(typeof AdbPacket)["TInit"], "magic">;
|
||||
|
||||
export function calculateChecksum(payload: Uint8Array): number;
|
||||
export function calculateChecksum(init: AdbPacketData): AdbPacketInit;
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export * from './dispatcher.js';
|
||||
export * from './socket.js';
|
||||
export * from "./dispatcher.js";
|
||||
export * from "./socket.js";
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import { describe, expect, it } from '@jest/globals';
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
|
||||
import { calculateBase64EncodedLength, decodeBase64, encodeBase64 } from './base64.js';
|
||||
import {
|
||||
calculateBase64EncodedLength,
|
||||
decodeBase64,
|
||||
encodeBase64,
|
||||
} from "./base64.js";
|
||||
|
||||
describe('base64', () => {
|
||||
describe('calculateBase64EncodedLength', () => {
|
||||
it('should return correct length and padding', () => {
|
||||
describe("base64", () => {
|
||||
describe("calculateBase64EncodedLength", () => {
|
||||
it("should return correct length and padding", () => {
|
||||
expect(calculateBase64EncodedLength(0)).toEqual([0, 0]);
|
||||
expect(calculateBase64EncodedLength(1)).toEqual([4, 2]);
|
||||
expect(calculateBase64EncodedLength(2)).toEqual([4, 1]);
|
||||
|
@ -16,36 +20,34 @@ describe('base64', () => {
|
|||
});
|
||||
|
||||
const inputs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 254, 255, 256].map(
|
||||
x => new Uint8Array(
|
||||
Array.from(
|
||||
{ length: x },
|
||||
(_, index) => x - index
|
||||
)
|
||||
)
|
||||
(x) =>
|
||||
new Uint8Array(Array.from({ length: x }, (_, index) => x - index))
|
||||
);
|
||||
|
||||
describe('decodeBase64', () => {
|
||||
describe("decodeBase64", () => {
|
||||
function nodeEncodeBase64(input: Uint8Array) {
|
||||
return Buffer.from(input).toString('base64');
|
||||
return Buffer.from(input).toString("base64");
|
||||
}
|
||||
|
||||
inputs.forEach(input => {
|
||||
inputs.forEach((input) => {
|
||||
describe(`input length = ${input.length}`, () => {
|
||||
it('should return correct decoded buffer', () => {
|
||||
expect(decodeBase64(nodeEncodeBase64(input))).toEqual(input);
|
||||
it("should return correct decoded buffer", () => {
|
||||
expect(decodeBase64(nodeEncodeBase64(input))).toEqual(
|
||||
input
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('encodeBase64', () => {
|
||||
describe("encodeBase64", () => {
|
||||
function nodeEncodeBase64(input: Uint8Array) {
|
||||
// Convert Buffer to Uint8Array
|
||||
return new Uint8Array(
|
||||
// Convert base64 string to Buffer
|
||||
Buffer.from(
|
||||
// Convert `input` to base64 string
|
||||
Buffer.from(input).toString('base64')
|
||||
Buffer.from(input).toString("base64")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -57,7 +59,10 @@ describe('base64', () => {
|
|||
}
|
||||
|
||||
function concatBuffers(...buffers: Uint8Array[]) {
|
||||
const length = buffers.reduce((sum, buffer) => sum + buffer.length, 0);
|
||||
const length = buffers.reduce(
|
||||
(sum, buffer) => sum + buffer.length,
|
||||
0
|
||||
);
|
||||
const result = new Uint8Array(length);
|
||||
let offset = 0;
|
||||
for (const buffer of buffers) {
|
||||
|
@ -67,34 +72,40 @@ describe('base64', () => {
|
|||
return result;
|
||||
}
|
||||
|
||||
inputs.forEach(input => {
|
||||
inputs.forEach((input) => {
|
||||
const correct = nodeEncodeBase64(input);
|
||||
|
||||
describe(`input length = ${input.length}`, () => {
|
||||
it('should return correct encoded buffer', () => {
|
||||
it("should return correct encoded buffer", () => {
|
||||
expect(encodeBase64(input)).toEqual(correct);
|
||||
});
|
||||
|
||||
it('should take `output`', () => {
|
||||
it("should take `output`", () => {
|
||||
const output = createFilledBuffer(correct.length + 4, 0xcc);
|
||||
|
||||
const expectedOutput = output.slice();
|
||||
expectedOutput.set(correct, 2);
|
||||
|
||||
const outputLength = encodeBase64(input, output.subarray(2, 2 + correct.length + 2));
|
||||
const outputLength = encodeBase64(
|
||||
input,
|
||||
output.subarray(2, 2 + correct.length + 2)
|
||||
);
|
||||
expect(outputLength).toEqual(correct.length);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
|
||||
it('should throw if `output` is too small', () => {
|
||||
it("should throw if `output` is too small", () => {
|
||||
if (correct.length !== 0) {
|
||||
const output = new Uint8Array(correct.length - 1);
|
||||
expect(() => encodeBase64(input, output)).toThrow();
|
||||
}
|
||||
});
|
||||
|
||||
describe('in-place encoding', () => {
|
||||
function canEncodeInPlaceForward(inputOffset: number, outputOffset: number) {
|
||||
describe("in-place encoding", () => {
|
||||
function canEncodeInPlaceForward(
|
||||
inputOffset: number,
|
||||
outputOffset: number
|
||||
) {
|
||||
let inputIndex = inputOffset;
|
||||
let outputIndex = outputOffset;
|
||||
|
||||
|
@ -115,13 +126,18 @@ describe('base64', () => {
|
|||
return true;
|
||||
}
|
||||
|
||||
function canEncodeInPlaceBackward(inputOffset: number, outputOffset: number) {
|
||||
function canEncodeInPlaceBackward(
|
||||
inputOffset: number,
|
||||
outputOffset: number
|
||||
) {
|
||||
let inputIndex = inputOffset + input.length - 1;
|
||||
let outputIndex = outputOffset + correct.length - 1;
|
||||
|
||||
const paddingLength = correct.filter(x => x === '='.charCodeAt(0)).length;
|
||||
const paddingLength = correct.filter(
|
||||
(x) => x === "=".charCodeAt(0)
|
||||
).length;
|
||||
if (paddingLength !== 0) {
|
||||
inputIndex -= (3 - paddingLength);
|
||||
inputIndex -= 3 - paddingLength;
|
||||
outputIndex -= 4;
|
||||
}
|
||||
|
||||
|
@ -138,9 +154,17 @@ describe('base64', () => {
|
|||
return true;
|
||||
}
|
||||
|
||||
function canEncodeInPlace(inputOffset: number, outputOffset: number) {
|
||||
return canEncodeInPlaceForward(inputOffset, outputOffset) ||
|
||||
canEncodeInPlaceBackward(inputOffset, outputOffset);
|
||||
function canEncodeInPlace(
|
||||
inputOffset: number,
|
||||
outputOffset: number
|
||||
) {
|
||||
return (
|
||||
canEncodeInPlaceForward(
|
||||
inputOffset,
|
||||
outputOffset
|
||||
) ||
|
||||
canEncodeInPlaceBackward(inputOffset, outputOffset)
|
||||
);
|
||||
}
|
||||
|
||||
function testInPlaceEncodeBase64(outputOffset: number) {
|
||||
|
@ -154,7 +178,10 @@ describe('base64', () => {
|
|||
expectedBuffer.set(correct, outputOffset);
|
||||
|
||||
const outputLength = encodeBase64(
|
||||
buffer.subarray(correct.length + 2, correct.length + 2 + input.length),
|
||||
buffer.subarray(
|
||||
correct.length + 2,
|
||||
correct.length + 2 + input.length
|
||||
),
|
||||
buffer.subarray(outputOffset)
|
||||
);
|
||||
expect(outputLength).toEqual(correct.length);
|
||||
|
@ -173,8 +200,12 @@ describe('base64', () => {
|
|||
prev = true;
|
||||
|
||||
if (i - 1 !== last) {
|
||||
it(`should throw with offset = ${i - 1}`, () => {
|
||||
expect(() => testInPlaceEncodeBase64(i - 1)).toThrow();
|
||||
it(`should throw with offset = ${
|
||||
i - 1
|
||||
}`, () => {
|
||||
expect(() =>
|
||||
testInPlaceEncodeBase64(i - 1)
|
||||
).toThrow();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -189,7 +220,9 @@ describe('base64', () => {
|
|||
prev = false;
|
||||
|
||||
if (i - 1 !== last) {
|
||||
it(`should encode in place with offset = ${i - 1}`, () => {
|
||||
it(`should encode in place with offset = ${
|
||||
i - 1
|
||||
}`, () => {
|
||||
testInPlaceEncodeBase64(i - 1);
|
||||
});
|
||||
}
|
||||
|
@ -197,7 +230,9 @@ describe('base64', () => {
|
|||
last = i;
|
||||
|
||||
it(`should throw with offset = ${i}`, () => {
|
||||
expect(() => testInPlaceEncodeBase64(i)).toThrow();
|
||||
expect(() =>
|
||||
testInPlaceEncodeBase64(i)
|
||||
).toThrow();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export { decodeUtf8, encodeUtf8 } from '@yume-chan/struct';
|
||||
export * from './auto-reset-event.js';
|
||||
export * from './base64.js';
|
||||
export { decodeUtf8, encodeUtf8 } from "@yume-chan/struct";
|
||||
export * from "./auto-reset-event.js";
|
||||
export * from "./base64.js";
|
||||
export * from "./conditional-variable.js";
|
||||
|
|
|
@ -27,14 +27,15 @@
|
|||
"scripts": {
|
||||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@yume-chan/eslint-config": "workspace:^1.0.0",
|
||||
"@yume-chan/tsconfig": "workspace:^1.0.0",
|
||||
"eslint": "^8.31.0",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@yume-chan/adb": "workspace:^0.0.18",
|
||||
|
|
|
@ -38,7 +38,7 @@ export const DemoModeMobileDataTypes = [
|
|||
"null",
|
||||
] as const;
|
||||
|
||||
export type DemoModeMobileDataType = typeof DemoModeMobileDataTypes[number];
|
||||
export type DemoModeMobileDataType = (typeof DemoModeMobileDataTypes)[number];
|
||||
|
||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java;l=3136
|
||||
export const DemoModeStatusBarModes = [
|
||||
|
@ -49,7 +49,7 @@ export const DemoModeStatusBarModes = [
|
|||
"warning",
|
||||
] as const;
|
||||
|
||||
export type DemoModeStatusBarMode = typeof DemoModeStatusBarModes[number];
|
||||
export type DemoModeStatusBarMode = (typeof DemoModeStatusBarModes)[number];
|
||||
|
||||
export class DemoMode extends AdbCommandBase {
|
||||
private settings: Settings;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// cspell: ignore logcat
|
||||
|
||||
export * from './bug-report.js';
|
||||
export * from './demo-mode.js';
|
||||
export * from './logcat.js';
|
||||
export * from './settings.js';
|
||||
export * from "./bug-report.js";
|
||||
export * from "./demo-mode.js";
|
||||
export * from "./logcat.js";
|
||||
export * from "./settings.js";
|
||||
|
|
|
@ -104,7 +104,7 @@ export const LoggerEntry = new Struct({ littleEndian: true })
|
|||
},
|
||||
});
|
||||
|
||||
export type LoggerEntry = typeof LoggerEntry["TDeserializeResult"];
|
||||
export type LoggerEntry = (typeof LoggerEntry)["TDeserializeResult"];
|
||||
|
||||
// https://cs.android.com/android/platform/superproject/+/master:system/logging/liblog/logprint.cpp;drc=bbe77d66e7bee8bd1f0bc7e5492b5376b0207ef6;bpv=0
|
||||
export interface AndroidLogEntry extends LoggerEntry {
|
||||
|
|
|
@ -1,49 +1,78 @@
|
|||
import { AdbCommandBase } from "@yume-chan/adb";
|
||||
|
||||
export type SettingsNamespace = 'system' | 'secure' | 'global';
|
||||
export type SettingsNamespace = "system" | "secure" | "global";
|
||||
|
||||
export type SettingsResetMode = 'untrusted_defaults' | 'untrusted_clear' | 'trusted_defaults';
|
||||
export type SettingsResetMode =
|
||||
| "untrusted_defaults"
|
||||
| "untrusted_clear"
|
||||
| "trusted_defaults";
|
||||
|
||||
// frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsService.java
|
||||
export class Settings extends AdbCommandBase {
|
||||
// TODO: `--user <user>` argument
|
||||
|
||||
public base(command: string, namespace: SettingsNamespace, ...args: string[]) {
|
||||
return this.adb.subprocess.spawnAndWaitLegacy(['settings', command, namespace, ...args]);
|
||||
public base(
|
||||
command: string,
|
||||
namespace: SettingsNamespace,
|
||||
...args: string[]
|
||||
) {
|
||||
return this.adb.subprocess.spawnAndWaitLegacy([
|
||||
"settings",
|
||||
command,
|
||||
namespace,
|
||||
...args,
|
||||
]);
|
||||
}
|
||||
|
||||
public get(namespace: SettingsNamespace, key: string) {
|
||||
return this.base('get', namespace, key);
|
||||
return this.base("get", namespace, key);
|
||||
}
|
||||
|
||||
public delete(namespace: SettingsNamespace, key: string) {
|
||||
return this.base('delete', namespace, key);
|
||||
return this.base("delete", namespace, key);
|
||||
}
|
||||
|
||||
public put(namespace: SettingsNamespace, key: string, value: string, tag?: string, makeDefault?: boolean) {
|
||||
public put(
|
||||
namespace: SettingsNamespace,
|
||||
key: string,
|
||||
value: string,
|
||||
tag?: string,
|
||||
makeDefault?: boolean
|
||||
) {
|
||||
return this.base(
|
||||
'put',
|
||||
"put",
|
||||
namespace,
|
||||
key,
|
||||
value,
|
||||
...(tag ? [tag] : []),
|
||||
...(makeDefault ? ['default'] : []),
|
||||
...(makeDefault ? ["default"] : [])
|
||||
);
|
||||
}
|
||||
|
||||
public reset(namespace: SettingsNamespace, mode: SettingsResetMode): Promise<string>;
|
||||
public reset(namespace: SettingsNamespace, packageName: string, tag?: string): Promise<string>;
|
||||
public reset(namespace: SettingsNamespace, modeOrPackageName: string, tag?: string): Promise<string> {
|
||||
public reset(
|
||||
namespace: SettingsNamespace,
|
||||
mode: SettingsResetMode
|
||||
): Promise<string>;
|
||||
public reset(
|
||||
namespace: SettingsNamespace,
|
||||
packageName: string,
|
||||
tag?: string
|
||||
): Promise<string>;
|
||||
public reset(
|
||||
namespace: SettingsNamespace,
|
||||
modeOrPackageName: string,
|
||||
tag?: string
|
||||
): Promise<string> {
|
||||
return this.base(
|
||||
'reset',
|
||||
"reset",
|
||||
namespace,
|
||||
modeOrPackageName,
|
||||
...(tag ? [tag] : []),
|
||||
...(tag ? [tag] : [])
|
||||
);
|
||||
}
|
||||
|
||||
public async list(namespace: SettingsNamespace): Promise<string[]> {
|
||||
const output = await this.base('list', namespace);
|
||||
return output.split('\n');
|
||||
const output = await this.base("list", namespace);
|
||||
return output.split("\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -44,6 +44,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"//test": "jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -43,6 +43,7 @@
|
|||
"@yume-chan/tsconfig": "workspace:^1.0.0",
|
||||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,44 @@
|
|||
import { getBigInt64 as fallbackGetBigInt64, getBigUint64 as fallbackGetBigUint64, setBigInt64 as fallbackSetBigInt64, setBigUint64 as fallbackSetBigUint64 } from './pure.js';
|
||||
import {
|
||||
getBigInt64 as fallbackGetBigInt64,
|
||||
getBigUint64 as fallbackGetBigUint64,
|
||||
setBigInt64 as fallbackSetBigInt64,
|
||||
setBigUint64 as fallbackSetBigUint64,
|
||||
} from "./pure.js";
|
||||
|
||||
export const getBigInt64 =
|
||||
'getBigInt64' in DataView.prototype ?
|
||||
(dataView: DataView, byteOffset: number, littleEndian: boolean | undefined) => dataView.getBigInt64(byteOffset, littleEndian) :
|
||||
fallbackGetBigInt64;
|
||||
"getBigInt64" in DataView.prototype
|
||||
? (
|
||||
dataView: DataView,
|
||||
byteOffset: number,
|
||||
littleEndian: boolean | undefined
|
||||
) => dataView.getBigInt64(byteOffset, littleEndian)
|
||||
: fallbackGetBigInt64;
|
||||
|
||||
export const getBigUint64 =
|
||||
'getBigUint64' in DataView.prototype ?
|
||||
(dataView: DataView, byteOffset: number, littleEndian: boolean | undefined) => dataView.getBigUint64(byteOffset, littleEndian) :
|
||||
fallbackGetBigUint64;
|
||||
"getBigUint64" in DataView.prototype
|
||||
? (
|
||||
dataView: DataView,
|
||||
byteOffset: number,
|
||||
littleEndian: boolean | undefined
|
||||
) => dataView.getBigUint64(byteOffset, littleEndian)
|
||||
: fallbackGetBigUint64;
|
||||
|
||||
export const setBigInt64 =
|
||||
'setBigInt64' in DataView.prototype ?
|
||||
(dataView: DataView, byteOffset: number, value: bigint, littleEndian: boolean | undefined) => dataView.setBigInt64(byteOffset, value, littleEndian) :
|
||||
fallbackSetBigInt64;
|
||||
"setBigInt64" in DataView.prototype
|
||||
? (
|
||||
dataView: DataView,
|
||||
byteOffset: number,
|
||||
value: bigint,
|
||||
littleEndian: boolean | undefined
|
||||
) => dataView.setBigInt64(byteOffset, value, littleEndian)
|
||||
: fallbackSetBigInt64;
|
||||
|
||||
export const setBigUint64 =
|
||||
'setBigUint64' in DataView.prototype ?
|
||||
(dataView: DataView, byteOffset: number, value: bigint, littleEndian: boolean | undefined) => dataView.setBigUint64(byteOffset, value, littleEndian) :
|
||||
fallbackSetBigUint64;
|
||||
"setBigUint64" in DataView.prototype
|
||||
? (
|
||||
dataView: DataView,
|
||||
byteOffset: number,
|
||||
value: bigint,
|
||||
littleEndian: boolean | undefined
|
||||
) => dataView.setBigUint64(byteOffset, value, littleEndian)
|
||||
: fallbackSetBigUint64;
|
||||
|
|
|
@ -1 +1 @@
|
|||
export * from './pure.js';
|
||||
export * from "./pure.js";
|
||||
|
|
|
@ -1,25 +1,38 @@
|
|||
import { getBigInt64, getBigUint64, setBigInt64, setBigUint64 } from './pure.js';
|
||||
import {
|
||||
getBigInt64,
|
||||
getBigUint64,
|
||||
setBigInt64,
|
||||
setBigUint64,
|
||||
} from "./pure.js";
|
||||
|
||||
if (!('getBigInt64' in DataView)) {
|
||||
if (!("getBigInt64" in DataView)) {
|
||||
DataView.prototype.getBigInt64 = function (byteOffset, littleEndian) {
|
||||
return getBigInt64(this, byteOffset, littleEndian);
|
||||
};
|
||||
}
|
||||
|
||||
if (!('getBigUint64' in DataView)) {
|
||||
if (!("getBigUint64" in DataView)) {
|
||||
DataView.prototype.getBigUint64 = function (byteOffset, littleEndian) {
|
||||
return getBigUint64(this, byteOffset, littleEndian);
|
||||
};
|
||||
}
|
||||
|
||||
if (!('setBigInt64' in DataView)) {
|
||||
DataView.prototype.setBigInt64 = function (byteOffset, value, littleEndian) {
|
||||
if (!("setBigInt64" in DataView)) {
|
||||
DataView.prototype.setBigInt64 = function (
|
||||
byteOffset,
|
||||
value,
|
||||
littleEndian
|
||||
) {
|
||||
setBigInt64(this, byteOffset, value, littleEndian);
|
||||
};
|
||||
}
|
||||
|
||||
if (!('setBigUint64' in DataView)) {
|
||||
DataView.prototype.setBigUint64 = function (byteOffset, value, littleEndian) {
|
||||
if (!("setBigUint64" in DataView)) {
|
||||
DataView.prototype.setBigUint64 = function (
|
||||
byteOffset,
|
||||
value,
|
||||
littleEndian
|
||||
) {
|
||||
setBigUint64(this, byteOffset, value, littleEndian);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -44,6 +44,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export * from './disposable.js';
|
||||
export * from './event.js';
|
||||
export * from './event-emitter.js';
|
||||
export * from './utils.js';
|
||||
export * from "./disposable.js";
|
||||
export * from "./event.js";
|
||||
export * from "./event-emitter.js";
|
||||
export * from "./utils.js";
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"//test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -51,6 +51,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { PromiseResolver } from "@yume-chan/async";
|
||||
import {
|
||||
AndroidCodecLevel,
|
||||
AndroidCodecProfile,
|
||||
type H264Configuration,
|
||||
type ScrcpyVideoStreamPacket,
|
||||
import type {
|
||||
H264Configuration,
|
||||
ScrcpyVideoStreamPacket,
|
||||
} from "@yume-chan/scrcpy";
|
||||
import { AndroidCodecLevel, AndroidCodecProfile } from "@yume-chan/scrcpy";
|
||||
import { WritableStream } from "@yume-chan/stream-extra";
|
||||
import { type default as YuvBuffer } from "yuv-buffer";
|
||||
import { type default as YuvCanvas } from "yuv-canvas";
|
||||
import type { default as YuvBuffer } from "yuv-buffer";
|
||||
import type { default as YuvCanvas } from "yuv-canvas";
|
||||
|
||||
import { createTinyH264Wrapper, type TinyH264Wrapper } from "./wrapper.js";
|
||||
import type { TinyH264Wrapper } from "./wrapper.js";
|
||||
import { createTinyH264Wrapper } from "./wrapper.js";
|
||||
|
||||
let cachedInitializePromise:
|
||||
| Promise<{ YuvBuffer: typeof YuvBuffer; YuvCanvas: typeof YuvCanvas }>
|
||||
|
|
|
@ -143,7 +143,7 @@ declare module "yuv-buffer" {
|
|||
}
|
||||
|
||||
declare module "yuv-canvas" {
|
||||
import { type YUVFrame } from "yuv-buffer";
|
||||
import type { YUVFrame } from "yuv-buffer";
|
||||
|
||||
export default class YUVCanvas {
|
||||
public static attach(canvas: HTMLCanvasElement): YUVCanvas;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import { init } from 'tinyh264';
|
||||
import { init } from "tinyh264";
|
||||
|
||||
init();
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import { PromiseResolver } from "@yume-chan/async";
|
||||
import {
|
||||
AutoDisposable,
|
||||
EventEmitter,
|
||||
type Disposable,
|
||||
} from "@yume-chan/event";
|
||||
import { AutoDisposable, EventEmitter } from "@yume-chan/event";
|
||||
import type { Disposable } from "@yume-chan/event";
|
||||
|
||||
let worker: Worker | undefined;
|
||||
let workerReady = false;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"//test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -47,6 +47,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
type H264Configuration,
|
||||
type ScrcpyVideoStreamPacket,
|
||||
import type {
|
||||
H264Configuration,
|
||||
ScrcpyVideoStreamPacket,
|
||||
} from "@yume-chan/scrcpy";
|
||||
import { WritableStream } from "@yume-chan/stream-extra";
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -52,7 +52,8 @@
|
|||
"gh-release-fetch": "^3.0.2",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@yume-chan/adb": "workspace:^0.0.18",
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from './options/index.js';
|
||||
export * from './client.js';
|
||||
export * from './connection.js';
|
||||
export * from "./options/index.js";
|
||||
export * from "./client.js";
|
||||
export * from "./connection.js";
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from './1_16.js';
|
||||
export * from './1_22.js';
|
||||
export * from './types.js';
|
||||
export * from "./1_16.js";
|
||||
export * from "./1_22.js";
|
||||
export * from "./types.js";
|
||||
|
|
|
@ -202,4 +202,4 @@ export const ScrcpyInjectKeyCodeControlMessage = new Struct()
|
|||
.uint32("metaState");
|
||||
|
||||
export type ScrcpyInjectKeyCodeControlMessage =
|
||||
typeof ScrcpyInjectKeyCodeControlMessage["TInit"];
|
||||
(typeof ScrcpyInjectKeyCodeControlMessage)["TInit"];
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import Struct from '@yume-chan/struct';
|
||||
import Struct from "@yume-chan/struct";
|
||||
|
||||
import { ScrcpyControlMessageType } from './type.js';
|
||||
import { ScrcpyControlMessageType } from "./type.js";
|
||||
|
||||
export const ScrcpyInjectTextControlMessage =
|
||||
new Struct()
|
||||
.uint8('type', ScrcpyControlMessageType.InjectText as const)
|
||||
.uint32('length')
|
||||
.string('text', { lengthField: 'length' });
|
||||
export const ScrcpyInjectTextControlMessage = new Struct()
|
||||
.uint8("type", ScrcpyControlMessageType.InjectText as const)
|
||||
.uint32("length")
|
||||
.string("text", { lengthField: "length" });
|
||||
|
||||
export type ScrcpyInjectTextControlMessage =
|
||||
typeof ScrcpyInjectTextControlMessage['TInit'];
|
||||
(typeof ScrcpyInjectTextControlMessage)["TInit"];
|
||||
|
|
|
@ -75,4 +75,4 @@ export const ScrcpyInjectTouchControlMessage = new Struct()
|
|||
.uint32("buttons");
|
||||
|
||||
export type ScrcpyInjectTouchControlMessage =
|
||||
typeof ScrcpyInjectTouchControlMessage["TInit"];
|
||||
(typeof ScrcpyInjectTouchControlMessage)["TInit"];
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import Struct from '@yume-chan/struct';
|
||||
import Struct from "@yume-chan/struct";
|
||||
|
||||
import { ScrcpyControlMessageType } from './type.js';
|
||||
import { ScrcpyControlMessageType } from "./type.js";
|
||||
|
||||
export const ScrcpyRotateDeviceControlMessage =
|
||||
new Struct()
|
||||
.uint8('type', ScrcpyControlMessageType.RotateDevice as const)
|
||||
export const ScrcpyRotateDeviceControlMessage = new Struct().uint8(
|
||||
"type",
|
||||
ScrcpyControlMessageType.RotateDevice as const
|
||||
);
|
||||
|
||||
export type ScrcpyRotateDeviceControlMessage =
|
||||
typeof ScrcpyRotateDeviceControlMessage['TInit'];
|
||||
(typeof ScrcpyRotateDeviceControlMessage)["TInit"];
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
import Struct, { placeholder } from '@yume-chan/struct';
|
||||
import Struct, { placeholder } from "@yume-chan/struct";
|
||||
|
||||
import { ScrcpyControlMessageType } from './type.js';
|
||||
import { ScrcpyControlMessageType } from "./type.js";
|
||||
|
||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/SurfaceControl.java;l=659;drc=20303e05bf73796124ab70a279cf849b61b97905
|
||||
export enum AndroidScreenPowerMode {
|
||||
Off = 0,
|
||||
Normal = 2
|
||||
Normal = 2,
|
||||
}
|
||||
|
||||
export const ScrcpySetScreenPowerModeControlMessage =
|
||||
new Struct()
|
||||
.uint8('type', ScrcpyControlMessageType.SetScreenPowerMode as const)
|
||||
.uint8('mode', placeholder<AndroidScreenPowerMode>());
|
||||
export const ScrcpySetScreenPowerModeControlMessage = new Struct()
|
||||
.uint8("type", ScrcpyControlMessageType.SetScreenPowerMode as const)
|
||||
.uint8("mode", placeholder<AndroidScreenPowerMode>());
|
||||
|
||||
export type ScrcpySetScreenPowerModeControlMessage =
|
||||
typeof ScrcpySetScreenPowerModeControlMessage['TInit'];
|
||||
(typeof ScrcpySetScreenPowerModeControlMessage)["TInit"];
|
||||
|
|
|
@ -7,4 +7,4 @@ export const ScrcpyAckClipboardDeviceMessage = new Struct()
|
|||
.extra({ type: ScrcpyDeviceMessageType.AckClipboard as const });
|
||||
|
||||
export type ScrcpyAckClipboardDeviceMessage =
|
||||
typeof ScrcpyAckClipboardDeviceMessage["TDeserializeResult"];
|
||||
(typeof ScrcpyAckClipboardDeviceMessage)["TDeserializeResult"];
|
||||
|
|
|
@ -8,4 +8,4 @@ export const ScrcpyClipboardDeviceMessage = new Struct()
|
|||
.extra({ type: ScrcpyDeviceMessageType.Clipboard as const });
|
||||
|
||||
export type ScrcpyClipboardDeviceMessage =
|
||||
typeof ScrcpyClipboardDeviceMessage["TDeserializeResult"];
|
||||
(typeof ScrcpyClipboardDeviceMessage)["TDeserializeResult"];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export * from './adb/index.js';
|
||||
export * from './codec.js';
|
||||
export * from './control/index.js';
|
||||
export * from './device-message/index.js';
|
||||
export * from './options/index.js';
|
||||
export * from "./adb/index.js";
|
||||
export * from "./codec.js";
|
||||
export * from "./control/index.js";
|
||||
export * from "./device-message/index.js";
|
||||
export * from "./options/index.js";
|
||||
|
|
|
@ -125,7 +125,7 @@ export const ScrcpySetClipboardControlMessage1_15 = new Struct()
|
|||
.string("content", { lengthField: "length" });
|
||||
|
||||
export type ScrcpySetClipboardControlMessage1_15 =
|
||||
typeof ScrcpySetClipboardControlMessage1_15["TInit"];
|
||||
(typeof ScrcpySetClipboardControlMessage1_15)["TInit"];
|
||||
|
||||
export class ScrcpyOptions1_16<
|
||||
T extends ScrcpyOptionsInit1_16 = ScrcpyOptionsInit1_16
|
||||
|
|
|
@ -21,7 +21,7 @@ export const ScrcpyBackOrScreenOnControlMessage1_18 = new Struct()
|
|||
.uint8("action", placeholder<AndroidKeyEventAction>());
|
||||
|
||||
export type ScrcpyBackOrScreenOnControlMessage1_18 =
|
||||
typeof ScrcpyBackOrScreenOnControlMessage1_18["TInit"];
|
||||
(typeof ScrcpyBackOrScreenOnControlMessage1_18)["TInit"];
|
||||
|
||||
export class ScrcpyOptions1_18<
|
||||
T extends ScrcpyOptionsInit1_18 = ScrcpyOptionsInit1_18
|
||||
|
|
|
@ -25,7 +25,7 @@ export const ScrcpySetClipboardControlMessage1_21 = new Struct()
|
|||
.string("content", { lengthField: "length" });
|
||||
|
||||
export type ScrcpySetClipboardControlMessage1_21 =
|
||||
typeof ScrcpySetClipboardControlMessage1_21["TInit"];
|
||||
(typeof ScrcpySetClipboardControlMessage1_21)["TInit"];
|
||||
|
||||
export class ScrcpyOptions1_21<
|
||||
T extends ScrcpyOptionsInit1_21 = ScrcpyOptionsInit1_21
|
||||
|
|
|
@ -10,7 +10,7 @@ export const ScrcpyInjectScrollControlMessage1_22 = new Struct()
|
|||
.int32("buttons");
|
||||
|
||||
export type ScrcpyInjectScrollControlMessage1_22 =
|
||||
typeof ScrcpyInjectScrollControlMessage1_22["TInit"];
|
||||
(typeof ScrcpyInjectScrollControlMessage1_22)["TInit"];
|
||||
|
||||
export class ScrcpyScrollController1_22 extends ScrcpyScrollController1_16 {
|
||||
public override serializeScrollMessage(
|
||||
|
|
|
@ -38,7 +38,7 @@ export const ScrcpyInjectScrollControlMessage1_25 = new Struct()
|
|||
.int32("buttons");
|
||||
|
||||
export type ScrcpyInjectScrollControlMessage1_25 =
|
||||
typeof ScrcpyInjectScrollControlMessage1_25["TInit"];
|
||||
(typeof ScrcpyInjectScrollControlMessage1_25)["TInit"];
|
||||
|
||||
export class ScrcpyScrollController1_25 implements ScrcpyScrollController {
|
||||
serializeScrollMessage(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export * from './1_16/index.js';
|
||||
export * from './1_18.js';
|
||||
export * from './1_21.js';
|
||||
export * from "./1_16/index.js";
|
||||
export * from "./1_18.js";
|
||||
export * from "./1_21.js";
|
||||
export * from "./1_22/index.js";
|
||||
export * from "./1_23.js";
|
||||
export * from "./1_24.js";
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -45,6 +45,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ export class ChunkStream extends TransformStream<Uint8Array, Uint8Array>{
|
|||
controller.enqueue(chunk.subarray(start, end));
|
||||
start = end;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ import { WritableStream } from "./stream.js";
|
|||
|
||||
export class GatherStringStream extends WritableStream<string> {
|
||||
// PERF: rope (concat strings) is faster than `[].join('')`
|
||||
private _result = '';
|
||||
public get result() { return this._result; }
|
||||
private _result = "";
|
||||
public get result() {
|
||||
return this._result;
|
||||
}
|
||||
|
||||
public constructor() {
|
||||
super({
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
export * from './buffered-transform.js';
|
||||
export * from './buffered.js';
|
||||
export * from './chunk.js';
|
||||
export * from './decode-utf8.js';
|
||||
export * from './duplex.js';
|
||||
export * from './gather-string.js';
|
||||
export * from './inspect.js';
|
||||
export * from './pipe-from.js';
|
||||
export * from './push-readable.js';
|
||||
export * from './split-string.js';
|
||||
export * from './stream.js';
|
||||
export * from './struct-deserialize.js';
|
||||
export * from './struct-serialize.js';
|
||||
export * from './wrap-readable.js';
|
||||
export * from './wrap-writable.js';
|
||||
export * from "./buffered-transform.js";
|
||||
export * from "./buffered.js";
|
||||
export * from "./chunk.js";
|
||||
export * from "./decode-utf8.js";
|
||||
export * from "./duplex.js";
|
||||
export * from "./gather-string.js";
|
||||
export * from "./inspect.js";
|
||||
export * from "./pipe-from.js";
|
||||
export * from "./push-readable.js";
|
||||
export * from "./split-string.js";
|
||||
export * from "./stream.js";
|
||||
export * from "./struct-deserialize.js";
|
||||
export * from "./struct-serialize.js";
|
||||
export * from "./wrap-readable.js";
|
||||
export * from "./wrap-writable.js";
|
||||
|
|
|
@ -6,7 +6,7 @@ export class InspectStream<T> extends TransformStream<T, T> {
|
|||
transform(chunk, controller) {
|
||||
callback(chunk);
|
||||
controller.enqueue(chunk);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { TransformStream } from "./stream.js";
|
||||
|
||||
function* split(input: string, separator: string): Generator<string, void, void> {
|
||||
function* split(
|
||||
input: string,
|
||||
separator: string
|
||||
): Generator<string, void, void> {
|
||||
let start = 0;
|
||||
|
||||
while (true) {
|
||||
|
@ -23,7 +26,7 @@ export class SplitStringStream extends TransformStream<string, string> {
|
|||
for (const part of split(chunk, separator)) {
|
||||
controller.enqueue(part);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"build": "tsc -b tsconfig.build.json",
|
||||
"build:watch": "tsc -b tsconfig.build.json",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
||||
"lint": "eslint src/**/*.ts --fix",
|
||||
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -45,6 +45,7 @@
|
|||
"eslint": "^8.31.0",
|
||||
"jest": "^29.3.1",
|
||||
"ts-jest": "^29.0.4",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^4.9.4",
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export * from './definition.js';
|
||||
export * from './field-value.js';
|
||||
export * from './options.js';
|
||||
export * from './stream.js';
|
||||
export * from './struct-value.js';
|
||||
export * from "./definition.js";
|
||||
export * from "./field-value.js";
|
||||
export * from "./options.js";
|
||||
export * from "./stream.js";
|
||||
export * from "./struct-value.js";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { describe, expect, it } from '@jest/globals';
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
|
||||
import Struct from './index.js';
|
||||
import Struct from "./index.js";
|
||||
|
||||
describe('Struct', () => {
|
||||
describe("Struct", () => {
|
||||
describe("Index", () => {
|
||||
it('should export default Struct', () => {
|
||||
it("should export default Struct", () => {
|
||||
expect(Struct).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,8 +10,8 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
export * from './basic/index.js';
|
||||
export * from './struct.js';
|
||||
export { Struct as default } from './struct.js';
|
||||
export * from './types/index.js';
|
||||
export * from './utils.js';
|
||||
export * from "./basic/index.js";
|
||||
export * from "./struct.js";
|
||||
export { Struct as default } from "./struct.js";
|
||||
export * from "./types/index.js";
|
||||
export * from "./utils.js";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, expect, it } from '@jest/globals';
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
|
||||
import { Uint8ArrayBufferFieldSubType } from "./base.js";
|
||||
import { FixedLengthBufferLikeFieldDefinition } from "./fixed-length.js";
|
||||
|
@ -9,7 +9,7 @@ describe("Types", () => {
|
|||
it("should return size in its options", () => {
|
||||
const definition = new FixedLengthBufferLikeFieldDefinition(
|
||||
Uint8ArrayBufferFieldSubType.Instance,
|
||||
{ length: 10 },
|
||||
{ length: 10 }
|
||||
);
|
||||
expect(definition.getSize()).toBe(10);
|
||||
});
|
||||
|
|
|
@ -420,7 +420,9 @@ describe("Types", () => {
|
|||
const arrayBufferFieldDefinition =
|
||||
new VariableLengthBufferLikeFieldDefinition(
|
||||
arrayBufferFieldType,
|
||||
{ lengthField }
|
||||
{
|
||||
lengthField,
|
||||
}
|
||||
);
|
||||
|
||||
const value = new Uint8Array(100);
|
||||
|
@ -451,7 +453,9 @@ describe("Types", () => {
|
|||
const arrayBufferFieldDefinition =
|
||||
new VariableLengthBufferLikeFieldDefinition(
|
||||
arrayBufferFieldType,
|
||||
{ lengthField }
|
||||
{
|
||||
lengthField,
|
||||
}
|
||||
);
|
||||
|
||||
const value = new Uint8Array(100);
|
||||
|
@ -484,7 +488,9 @@ describe("Types", () => {
|
|||
const arrayBufferFieldDefinition =
|
||||
new VariableLengthBufferLikeFieldDefinition(
|
||||
arrayBufferFieldType,
|
||||
{ lengthField }
|
||||
{
|
||||
lengthField,
|
||||
}
|
||||
);
|
||||
|
||||
const value = new Uint8Array(100);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { describe, expect, it } from '@jest/globals';
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
|
||||
import { placeholder } from './utils.js';
|
||||
import { placeholder } from "./utils.js";
|
||||
|
||||
describe('placeholder', () => {
|
||||
it('should return `undefined`', () => {
|
||||
describe("placeholder", () => {
|
||||
it("should return `undefined`", () => {
|
||||
expect(placeholder()).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,5 +8,8 @@
|
|||
"eslint": "^8.31.0",
|
||||
"eslint-plugin-import": "^2.27.4",
|
||||
"typescript": "^4.9.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"name": "@yume-chan/tsconfig",
|
||||
"version": "1.0.0"
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"prettier": "^2.8.4"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue