mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-06 03:50:18 +02:00
feat: convert to Node.js compatible ES Module
This commit is contained in:
parent
730aac8da2
commit
d9212b4dac
94 changed files with 429 additions and 466 deletions
|
@ -48,7 +48,8 @@ Scrcpy server has no backward compatibility on options input format. Currently t
|
|||
| --------- | ------------------- |
|
||||
| 1.16~1.17 | `ScrcpyOptions1_16` |
|
||||
| 1.18~1.20 | `ScrcpyOptions1_18` |
|
||||
| 1.21~1.22 | `ScrcpyOptions1_21` |
|
||||
| 1.21 | `ScrcpyOptions1_21` |
|
||||
| 1.22 | `ScrcpyOptions1_22` |
|
||||
|
||||
You must use the correct type according to the server version.
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"fetch-scrcpy-server": "scripts/fetch-server.cjs"
|
||||
},
|
||||
"type": "module",
|
||||
"module": "esm/index.js",
|
||||
"main": "esm/index.js",
|
||||
"types": "esm/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "build-ts-package",
|
||||
|
@ -48,7 +48,7 @@
|
|||
"gh-release-fetch": "^2.0.4",
|
||||
"jest": "^26.6.3",
|
||||
"tinyh264": "^0.0.7",
|
||||
"typescript": "^4.6.2",
|
||||
"typescript": "next",
|
||||
"yuv-buffer": "^1.0.0",
|
||||
"yuv-canvas": "^1.2.7"
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Adb, AdbBufferedStream, AdbNoneSubprocessProtocol, AdbSocket, DecodeUtf8Stream, InspectStream, ReadableStream, TransformStream, WritableStreamDefaultWriter, type AdbSubprocessProtocol } from '@yume-chan/adb';
|
||||
import { EventEmitter } from '@yume-chan/event';
|
||||
import Struct from '@yume-chan/struct';
|
||||
import { AndroidMotionEventAction, ScrcpyControlMessageType, ScrcpyInjectKeyCodeControlMessage, ScrcpyInjectTextControlMessage, ScrcpyInjectTouchControlMessage, type AndroidKeyEventAction } from './message';
|
||||
import type { ScrcpyInjectScrollControlMessage1_22, ScrcpyOptions, VideoStreamPacket } from "./options";
|
||||
import { AndroidMotionEventAction, ScrcpyControlMessageType, ScrcpyInjectKeyCodeControlMessage, ScrcpyInjectTextControlMessage, ScrcpyInjectTouchControlMessage, type AndroidKeyEventAction } from './message.js';
|
||||
import type { ScrcpyInjectScrollControlMessage1_22, ScrcpyOptions, VideoStreamPacket } from "./options/index.js";
|
||||
|
||||
function* splitLines(text: string): Generator<string, void, void> {
|
||||
let start = 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Adb, AdbBufferedStream, AdbSocket } from "@yume-chan/adb";
|
||||
import type { Disposable } from "@yume-chan/event";
|
||||
import type { ValueOrPromise } from "@yume-chan/struct";
|
||||
import { delay } from "./utils";
|
||||
import { delay } from "./utils.js";
|
||||
|
||||
export interface ScrcpyClientConnectionOptions {
|
||||
control: boolean;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { WritableStream } from '@yume-chan/adb';
|
||||
import type { Disposable } from "@yume-chan/event";
|
||||
import type { AndroidCodecLevel, AndroidCodecProfile } from "../codec";
|
||||
import type { VideoStreamPacket } from "../options";
|
||||
import type { AndroidCodecLevel, AndroidCodecProfile } from "../codec.js";
|
||||
import type { VideoStreamPacket } from "../options/index.js";
|
||||
|
||||
export interface H264Configuration {
|
||||
profileIndex: number;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from './common';
|
||||
export * from './tinyh264';
|
||||
export * from './web-codecs';
|
||||
export * from './common.js';
|
||||
export * from './tinyh264/index.js';
|
||||
export * from './web-codecs/index.js';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { WritableStream } from "@yume-chan/adb";
|
||||
import { PromiseResolver } from "@yume-chan/async";
|
||||
import { AndroidCodecLevel, AndroidCodecProfile } from "../../codec";
|
||||
import type { VideoStreamPacket } from "../../options";
|
||||
import type { H264Configuration, H264Decoder } from '../common';
|
||||
import { createTinyH264Wrapper, type TinyH264Wrapper } from "./wrapper";
|
||||
import { AndroidCodecLevel, AndroidCodecProfile } from "../../codec.js";
|
||||
import type { VideoStreamPacket } from "../../options/index.js";
|
||||
import type { H264Configuration, H264Decoder } from "../common.js";
|
||||
import { createTinyH264Wrapper, type TinyH264Wrapper } from "./wrapper.js";
|
||||
|
||||
let cachedInitializePromise: Promise<{ YuvBuffer: typeof import('yuv-buffer'), YuvCanvas: typeof import('yuv-canvas').default; }> | undefined;
|
||||
function initialize() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { VideoStreamPacket } from "../../options";
|
||||
import type { H264Configuration, H264Decoder } from "../common";
|
||||
import type { VideoStreamPacket } from "../../options/index.js";
|
||||
import type { H264Configuration, H264Decoder } from "../common.js";
|
||||
|
||||
function toHex(value: number) {
|
||||
return value.toString(16).padStart(2, '0').toUpperCase();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
export * from './client';
|
||||
export * from './codec';
|
||||
export * from './connection';
|
||||
export * from './decoder';
|
||||
export * from './message';
|
||||
export * from './options';
|
||||
export * from './push-server';
|
||||
export * from './utils';
|
||||
export * from './client.js';
|
||||
export * from './codec.js';
|
||||
export * from './connection.js';
|
||||
export * from './decoder/index.js';
|
||||
export * from './message.js';
|
||||
export * from './options/index.js';
|
||||
export * from './push-server.js';
|
||||
export * from './utils.js';
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { BufferedStreamEndedError, ReadableStream, TransformStream, type Adb, type AdbBufferedStream } from "@yume-chan/adb";
|
||||
import Struct, { placeholder } from "@yume-chan/struct";
|
||||
import type { AndroidCodecLevel, AndroidCodecProfile } from "../../codec";
|
||||
import { ScrcpyClientConnection, ScrcpyClientForwardConnection, ScrcpyClientReverseConnection, type ScrcpyClientConnectionOptions } from "../../connection";
|
||||
import { AndroidKeyEventAction, ScrcpyControlMessageType } from "../../message";
|
||||
import type { ScrcpyBackOrScreenOnEvent1_18 } from "../1_18";
|
||||
import type { ScrcpyInjectScrollControlMessage1_22 } from "../1_22";
|
||||
import { toScrcpyOptionValue, type ScrcpyOptions, type ScrcpyOptionValue, type VideoStreamPacket } from "../common";
|
||||
import { parse_sequence_parameter_set } from "./sps";
|
||||
import type { AndroidCodecLevel, AndroidCodecProfile } from "../../codec.js";
|
||||
import { ScrcpyClientConnection, ScrcpyClientForwardConnection, ScrcpyClientReverseConnection, type ScrcpyClientConnectionOptions } from "../../connection.js";
|
||||
import { AndroidKeyEventAction, ScrcpyControlMessageType } from "../../message.js";
|
||||
import type { ScrcpyBackOrScreenOnEvent1_18 } from "../1_18.js";
|
||||
import type { ScrcpyInjectScrollControlMessage1_22 } from "../1_22.js";
|
||||
import { toScrcpyOptionValue, type ScrcpyOptions, type ScrcpyOptionValue, type VideoStreamPacket } from "../common.js";
|
||||
import { parse_sequence_parameter_set } from "./sps.js";
|
||||
|
||||
export enum ScrcpyLogLevel {
|
||||
Verbose = 'verbose',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Struct, { placeholder } from "@yume-chan/struct";
|
||||
import type { AndroidKeyEventAction } from "../message";
|
||||
import { ScrcpyBackOrScreenOnEvent1_16, ScrcpyOptions1_16, type ScrcpyOptionsInit1_16 } from "./1_16";
|
||||
import type { AndroidKeyEventAction } from "../message.js";
|
||||
import { ScrcpyBackOrScreenOnEvent1_16, ScrcpyOptions1_16, type ScrcpyOptionsInit1_16 } from "./1_16/index.js";
|
||||
|
||||
export interface ScrcpyOptionsInit1_18 extends ScrcpyOptionsInit1_16 {
|
||||
powerOffOnClose: boolean;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// cspell: ignore autosync
|
||||
|
||||
import { ScrcpyOptions1_18, type ScrcpyOptionsInit1_18 } from './1_18';
|
||||
import { toScrcpyOptionValue } from "./common";
|
||||
import { ScrcpyOptions1_18, type ScrcpyOptionsInit1_18 } from './1_18.js';
|
||||
import { toScrcpyOptionValue } from "./common.js";
|
||||
|
||||
export interface ScrcpyOptionsInit1_21 extends ScrcpyOptionsInit1_18 {
|
||||
clipboardAutosync?: boolean;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import Struct from "@yume-chan/struct";
|
||||
import { ScrcpyClientForwardConnection, ScrcpyClientReverseConnection, type ScrcpyClientConnection, type ScrcpyClientConnectionOptions } from "../connection";
|
||||
import { ScrcpyInjectScrollControlMessage1_16 } from "./1_16";
|
||||
import { ScrcpyOptions1_21, type ScrcpyOptionsInit1_21 } from "./1_21";
|
||||
import { ScrcpyClientForwardConnection, ScrcpyClientReverseConnection, type ScrcpyClientConnection, type ScrcpyClientConnectionOptions } from "../connection.js";
|
||||
import { ScrcpyInjectScrollControlMessage1_16 } from "./1_16/index.js";
|
||||
import { ScrcpyOptions1_21, type ScrcpyOptionsInit1_21 } from "./1_21.js";
|
||||
|
||||
export interface ScrcpyOptionsInit1_22 extends ScrcpyOptionsInit1_21 {
|
||||
downsizeOnError: boolean;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type { Adb, AdbBufferedStream, ReadableStream } from "@yume-chan/adb";
|
||||
import type { ScrcpyClientConnection } from "../connection";
|
||||
import type { H264Configuration } from "../decoder";
|
||||
import type { ScrcpyBackOrScreenOnEvent1_18 } from "./1_18";
|
||||
import type { ScrcpyInjectScrollControlMessage1_22 } from "./1_22";
|
||||
import type { ScrcpyClientConnection } from "../connection.js";
|
||||
import type { H264Configuration } from "../decoder/index.js";
|
||||
import type { ScrcpyBackOrScreenOnEvent1_18 } from "./1_18.js";
|
||||
import type { ScrcpyInjectScrollControlMessage1_22 } from "./1_22.js";
|
||||
|
||||
export const DEFAULT_SERVER_PATH = '/data/local/tmp/scrcpy-server.jar';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export * from './1_16';
|
||||
export * from './1_18';
|
||||
export * from './1_21';
|
||||
export * from './1_22';
|
||||
export * from './common';
|
||||
export * from './1_16/index.js';
|
||||
export * from './1_18.js';
|
||||
export * from './1_21.js';
|
||||
export * from './1_22.js';
|
||||
export * from './common.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Adb, AdbSync, WrapWritableStream, WritableStream } from "@yume-chan/adb";
|
||||
import { DEFAULT_SERVER_PATH } from "./options";
|
||||
import { DEFAULT_SERVER_PATH } from "./options/index.js";
|
||||
|
||||
export interface PushServerOptions {
|
||||
path?: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue