Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit c1dc8023 authored by Simon Chan's avatar Simon Chan
Browse files

refactor(struct): improve tree-shaking

parent 70b0d3e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ export type AdbShellProtocolId =
// This packet format is used in both directions.
export const AdbShellProtocolPacket = struct(
    {
        id: u8.as<AdbShellProtocolId>(),
        id: u8<AdbShellProtocolId>(),
        data: buffer(u32),
    },
    { littleEndian: true },
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ export interface AdbSyncPushV2Options extends AdbSyncPushV1Options {
}

export const AdbSyncSendV2Request = struct(
    { id: u32, mode: u32, flags: u32.as<AdbSyncSendV2Flags>() },
    { id: u32, mode: u32, flags: u32<AdbSyncSendV2Flags>() },
    { littleEndian: true },
);

+3 −4
Original line number Diff line number Diff line
@@ -77,18 +77,17 @@ export const AdbSyncStatErrorCode = {
export type AdbSyncStatErrorCode =
    (typeof AdbSyncStatErrorCode)[keyof typeof AdbSyncStatErrorCode];

const AdbSyncStatErrorName =
    /* #__PURE__ */
const AdbSyncStatErrorName = /* #__PURE__ */ (() =>
    Object.fromEntries(
        Object.entries(AdbSyncStatErrorCode).map(([key, value]) => [
            value,
            key,
        ]),
    );
    ))();

export const AdbSyncStatResponse = struct(
    {
        error: u32.as<AdbSyncStatErrorCode>(),
        error: u32<AdbSyncStatErrorCode>(),
        dev: u64,
        ino: u64,
        mode: u32,
+3 −3
Original line number Diff line number Diff line
@@ -209,10 +209,10 @@ export enum AndroidKeyCode {
export const ScrcpyInjectKeyCodeControlMessage = struct(
    {
        type: u8,
        action: u8.as<AndroidKeyEventAction>(),
        keyCode: u32.as<AndroidKeyCode>(),
        action: u8<AndroidKeyEventAction>(),
        keyCode: u32<AndroidKeyCode>(),
        repeat: u32,
        metaState: u32.as<AndroidKeyEventMeta>(),
        metaState: u32<AndroidKeyEventMeta>(),
    },
    { littleEndian: false },
);
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ export type AndroidScreenPowerMode =
    (typeof AndroidScreenPowerMode)[keyof typeof AndroidScreenPowerMode];

export const ScrcpySetScreenPowerModeControlMessage = struct(
    { type: u8, mode: u8.as<AndroidScreenPowerMode>() },
    { type: u8, mode: u8<AndroidScreenPowerMode>() },
    { littleEndian: false },
);

Loading