mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 17:59:50 +02:00
refactor: enable strict TypeScript options
This commit is contained in:
parent
594648d033
commit
55cd69d47b
15 changed files with 82 additions and 104 deletions
|
@ -207,7 +207,7 @@ function _Connect(): JSX.Element | null {
|
||||||
return {
|
return {
|
||||||
items,
|
items,
|
||||||
};
|
};
|
||||||
}, [addWsBackend, addTcpBackend]);
|
}, [addUsbBackend, addWsBackend, addTcpBackend]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@yume-chan/async": "^2.1.4",
|
"@yume-chan/async": "^2.1.4",
|
||||||
|
"@yume-chan/dataview-bigint-polyfill": "0.0.10",
|
||||||
"@yume-chan/event": "^0.0.10",
|
"@yume-chan/event": "^0.0.10",
|
||||||
"@yume-chan/struct": "^0.0.10",
|
"@yume-chan/struct": "^0.0.10",
|
||||||
"tslib": "^2.3.1"
|
"tslib": "^2.3.1"
|
||||||
|
|
|
@ -165,7 +165,7 @@ export class Adb {
|
||||||
|
|
||||||
const pieces = banner.split('::');
|
const pieces = banner.split('::');
|
||||||
if (pieces.length > 1) {
|
if (pieces.length > 1) {
|
||||||
const props = pieces[1];
|
const props = pieces[1]!;
|
||||||
for (const prop of props.split(';')) {
|
for (const prop of props.split(';')) {
|
||||||
if (!prop) {
|
if (!prop) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -188,7 +188,7 @@ export class Adb {
|
||||||
this._device = value;
|
this._device = value;
|
||||||
break;
|
break;
|
||||||
case AdbPropKey.Features:
|
case AdbPropKey.Features:
|
||||||
this._features = value.split(',') as AdbFeatures[];
|
this._features = value!.split(',') as AdbFeatures[];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ export class AdbReverseCommand extends AutoDisposable {
|
||||||
|
|
||||||
const response = await AdbReverseStringResponse.deserialize(stream);
|
const response = await AdbReverseStringResponse.deserialize(stream);
|
||||||
return response.content!.split('\n').map(line => {
|
return response.content!.split('\n').map(line => {
|
||||||
const [deviceSerial, localName, remoteName] = line.split(' ');
|
const [deviceSerial, localName, remoteName] = line.split(' ') as [string, string, string];
|
||||||
return { deviceSerial, localName, remoteName };
|
return { deviceSerial, localName, remoteName };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ export class AdbShellProtocol implements AdbShell {
|
||||||
this.stderrEvent.fire(packet.data);
|
this.stderrEvent.fire(packet.data);
|
||||||
break;
|
break;
|
||||||
case AdbShellProtocolId.Exit:
|
case AdbShellProtocolId.Exit:
|
||||||
this.exitEvent.fire(new Uint8Array(packet.data)[0]);
|
this.exitEvent.fire(new Uint8Array(packet.data)[0]!);
|
||||||
break;
|
break;
|
||||||
case AdbShellProtocolId.CloseStdin:
|
case AdbShellProtocolId.CloseStdin:
|
||||||
case AdbShellProtocolId.Stdin:
|
case AdbShellProtocolId.Stdin:
|
||||||
|
|
|
@ -51,7 +51,7 @@ export async function adbSyncReadResponse<T extends Record<string, StructLike<an
|
||||||
}
|
}
|
||||||
|
|
||||||
if (types[id]) {
|
if (types[id]) {
|
||||||
return types[id].deserialize(stream);
|
return types[id]!.deserialize(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error('Unexpected response id');
|
throw new Error('Unexpected response id');
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
import { getBigUint64, setBigUint64 } from '@yume-chan/dataview-bigint-polyfill/esm/fallback';
|
||||||
|
|
||||||
const BigInt0 = BigInt(0);
|
const BigInt0 = BigInt(0);
|
||||||
const BigInt1 = BigInt(1);
|
const BigInt1 = BigInt(1);
|
||||||
const BigInt2 = BigInt(2);
|
const BigInt2 = BigInt(2);
|
||||||
|
const BigInt64 = BigInt(64);
|
||||||
const BigInt2To64 = BigInt2 ** BigInt(64);
|
|
||||||
|
|
||||||
export function getBig(
|
export function getBig(
|
||||||
buffer: ArrayBuffer,
|
buffer: ArrayBuffer,
|
||||||
|
@ -17,8 +18,8 @@ export function getBig(
|
||||||
// Support for arbitrary length can be easily added
|
// Support for arbitrary length can be easily added
|
||||||
|
|
||||||
for (let i = offset; i < offset + length; i += 8) {
|
for (let i = offset; i < offset + length; i += 8) {
|
||||||
result *= BigInt2To64;
|
result <<= BigInt64;
|
||||||
const value = view.getBigUint64(i, false);
|
const value = getBigUint64(view, i, false);
|
||||||
result += value;
|
result += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,12 +30,12 @@ export function setBig(buffer: ArrayBuffer, value: bigint, offset: number = 0) {
|
||||||
const uint64Array: bigint[] = [];
|
const uint64Array: bigint[] = [];
|
||||||
while (value > BigInt0) {
|
while (value > BigInt0) {
|
||||||
uint64Array.push(BigInt.asUintN(64, value));
|
uint64Array.push(BigInt.asUintN(64, value));
|
||||||
value /= BigInt2To64;
|
value >>= BigInt64;
|
||||||
}
|
}
|
||||||
|
|
||||||
const view = new DataView(buffer);
|
const view = new DataView(buffer);
|
||||||
for (let i = uint64Array.length - 1; i >= 0; i -= 1) {
|
for (let i = uint64Array.length - 1; i >= 0; i -= 1) {
|
||||||
view.setBigUint64(offset, uint64Array[i], false);
|
setBigUint64(view, offset, uint64Array[i]!, false);
|
||||||
offset += 8;
|
offset += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +43,9 @@ export function setBig(buffer: ArrayBuffer, value: bigint, offset: number = 0) {
|
||||||
export function setBigLE(buffer: ArrayBuffer, value: bigint, offset = 0) {
|
export function setBigLE(buffer: ArrayBuffer, value: bigint, offset = 0) {
|
||||||
const view = new DataView(buffer);
|
const view = new DataView(buffer);
|
||||||
while (value > BigInt0) {
|
while (value > BigInt0) {
|
||||||
view.setBigUint64(offset, value, true);
|
setBigUint64(view, offset, value, true);
|
||||||
offset += 8;
|
offset += 8;
|
||||||
value /= BigInt2To64;
|
value >>= BigInt64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +109,7 @@ export function modInverse(a: number, m: number) {
|
||||||
let x = 1;
|
let x = 1;
|
||||||
let y = 0;
|
let y = 0;
|
||||||
for (let i = s.length - 2; i >= 0; --i) {
|
for (let i = s.length - 2; i >= 0; --i) {
|
||||||
[x, y] = [y, x - y * Math.floor(s[i].a / s[i].b)];
|
[x, y] = [y, x - y * Math.floor(s[i]!.a / s[i]!.b)];
|
||||||
}
|
}
|
||||||
return (y % m + m) % m;
|
return (y % m + m) % m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ const paddingChar = '='.charCodeAt(0);
|
||||||
function addRange(start: string, end: string) {
|
function addRange(start: string, end: string) {
|
||||||
const charCodeStart = start.charCodeAt(0);
|
const charCodeStart = start.charCodeAt(0);
|
||||||
const charCodeEnd = end.charCodeAt(0);
|
const charCodeEnd = end.charCodeAt(0);
|
||||||
const length = charCodeEnd - charCodeStart + 1;
|
|
||||||
|
|
||||||
for (let charCode = charCodeStart; charCode <= charCodeEnd; charCode += 1) {
|
for (let charCode = charCodeStart; charCode <= charCodeEnd; charCode += 1) {
|
||||||
charToIndex[String.fromCharCode(charCode)] = indexToChar.length;
|
charToIndex[String.fromCharCode(charCode)] = indexToChar.length;
|
||||||
|
@ -142,7 +141,7 @@ export function encodeBase64(
|
||||||
|
|
||||||
if (paddingLength === 2) {
|
if (paddingLength === 2) {
|
||||||
// aaaaaabb
|
// aaaaaabb
|
||||||
const x = input[inputIndex];
|
const x = input[inputIndex]!;
|
||||||
inputIndex -= 1;
|
inputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = paddingChar;
|
output[outputIndex] = paddingChar;
|
||||||
|
@ -151,56 +150,56 @@ export function encodeBase64(
|
||||||
output[outputIndex] = paddingChar;
|
output[outputIndex] = paddingChar;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[((x & 0b11) << 4)];
|
output[outputIndex] = indexToChar[((x & 0b11) << 4)]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[x >> 2];
|
output[outputIndex] = indexToChar[x >> 2]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
} else if (paddingLength === 1) {
|
} else if (paddingLength === 1) {
|
||||||
// bbbbcccc
|
// bbbbcccc
|
||||||
const y = input[inputIndex];
|
const y = input[inputIndex]!;
|
||||||
inputIndex -= 1;
|
inputIndex -= 1;
|
||||||
|
|
||||||
// aaaaaabb
|
// aaaaaabb
|
||||||
const x = input[inputIndex];
|
const x = input[inputIndex]!;
|
||||||
inputIndex -= 1;
|
inputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = paddingChar;
|
output[outputIndex] = paddingChar;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[((y & 0b1111) << 2)];
|
output[outputIndex] = indexToChar[((y & 0b1111) << 2)]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
|
output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[x >> 2];
|
output[outputIndex] = indexToChar[x >> 2]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (inputIndex >= inputOffset) {
|
while (inputIndex >= inputOffset) {
|
||||||
// ccdddddd
|
// ccdddddd
|
||||||
const z = input[inputIndex];
|
const z = input[inputIndex]!;
|
||||||
inputIndex -= 1;
|
inputIndex -= 1;
|
||||||
|
|
||||||
// bbbbcccc
|
// bbbbcccc
|
||||||
const y = input[inputIndex];
|
const y = input[inputIndex]!;
|
||||||
inputIndex -= 1;
|
inputIndex -= 1;
|
||||||
|
|
||||||
// aaaaaabb
|
// aaaaaabb
|
||||||
const x = input[inputIndex];
|
const x = input[inputIndex]!;
|
||||||
inputIndex -= 1;
|
inputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[z & 0b111111];
|
output[outputIndex] = indexToChar[z & 0b111111]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[((y & 0b1111) << 2) | (z >> 6)];
|
output[outputIndex] = indexToChar[((y & 0b1111) << 2) | (z >> 6)]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
|
output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
|
|
||||||
output[outputIndex] = indexToChar[x >> 2];
|
output[outputIndex] = indexToChar[x >> 2]!;
|
||||||
outputIndex -= 1;
|
outputIndex -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,16 +225,16 @@ export function decodeBase64(input: string): ArrayBuffer {
|
||||||
let dIndex = 0;
|
let dIndex = 0;
|
||||||
|
|
||||||
while (sIndex < input.length - (padding !== 0 ? 4 : 0)) {
|
while (sIndex < input.length - (padding !== 0 ? 4 : 0)) {
|
||||||
const a = charToIndex[input[sIndex]];
|
const a = charToIndex[input[sIndex]!]!;
|
||||||
sIndex += 1;
|
sIndex += 1;
|
||||||
|
|
||||||
const b = charToIndex[input[sIndex]];
|
const b = charToIndex[input[sIndex]!]!;
|
||||||
sIndex += 1;
|
sIndex += 1;
|
||||||
|
|
||||||
const c = charToIndex[input[sIndex]];
|
const c = charToIndex[input[sIndex]!]!;
|
||||||
sIndex += 1;
|
sIndex += 1;
|
||||||
|
|
||||||
const d = charToIndex[input[sIndex]];
|
const d = charToIndex[input[sIndex]!]!;
|
||||||
sIndex += 1;
|
sIndex += 1;
|
||||||
|
|
||||||
result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
|
result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
|
||||||
|
@ -249,23 +248,23 @@ export function decodeBase64(input: string): ArrayBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (padding === 1) {
|
if (padding === 1) {
|
||||||
const a = charToIndex[input[sIndex]];
|
const a = charToIndex[input[sIndex]!]!;
|
||||||
sIndex += 1;
|
sIndex += 1;
|
||||||
|
|
||||||
const b = charToIndex[input[sIndex]];
|
const b = charToIndex[input[sIndex]!]!;
|
||||||
sIndex += 1;
|
sIndex += 1;
|
||||||
|
|
||||||
const c = charToIndex[input[sIndex]];
|
const c = charToIndex[input[sIndex]!]!;
|
||||||
|
|
||||||
result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
|
result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
|
||||||
dIndex += 1;
|
dIndex += 1;
|
||||||
|
|
||||||
result[dIndex] = ((b & 0b1111) << 4) | ((c & 0b11_1100) >> 2);
|
result[dIndex] = ((b & 0b1111) << 4) | ((c & 0b11_1100) >> 2);
|
||||||
} else if (padding === 2) {
|
} else if (padding === 2) {
|
||||||
const a = charToIndex[input[sIndex]];
|
const a = charToIndex[input[sIndex]!]!;
|
||||||
sIndex += 1;
|
sIndex += 1;
|
||||||
|
|
||||||
const b = charToIndex[input[sIndex]];
|
const b = charToIndex[input[sIndex]!]!;
|
||||||
|
|
||||||
result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
|
result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ interface LinkedListItem<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LinkedList<T>{
|
class LinkedList<T>{
|
||||||
private head?: LinkedListItem<T>;
|
private head?: LinkedListItem<T> | undefined;
|
||||||
|
|
||||||
private tail?: LinkedListItem<T>;
|
private tail?: LinkedListItem<T> | undefined;
|
||||||
|
|
||||||
private _length = 0;
|
private _length = 0;
|
||||||
public get length() { return this._length; }
|
public get length() { return this._length; }
|
||||||
|
|
|
@ -4,27 +4,11 @@ import { EventEmitter } from '@yume-chan/event';
|
||||||
import Struct from '@yume-chan/struct';
|
import Struct from '@yume-chan/struct';
|
||||||
import { ScrcpyClientConnection } from "./connection";
|
import { ScrcpyClientConnection } from "./connection";
|
||||||
import { AndroidKeyEventAction, AndroidMotionEventAction, ScrcpyControlMessageType, ScrcpyInjectKeyCodeControlMessage, ScrcpyInjectScrollControlMessage, ScrcpyInjectTextControlMessage, ScrcpyInjectTouchControlMessage } from './message';
|
import { AndroidKeyEventAction, AndroidMotionEventAction, ScrcpyControlMessageType, ScrcpyInjectKeyCodeControlMessage, ScrcpyInjectScrollControlMessage, ScrcpyInjectTextControlMessage, ScrcpyInjectTouchControlMessage } from './message';
|
||||||
import { ScrcpyLogLevel, ScrcpyOptions } from "./options";
|
import { ScrcpyOptions } from "./options";
|
||||||
import { pushServer, PushServerOptions } from "./push-server";
|
import { pushServer, PushServerOptions } from "./push-server";
|
||||||
import { parse_sequence_parameter_set, SequenceParameterSet } from './sps';
|
import { parse_sequence_parameter_set, SequenceParameterSet } from './sps';
|
||||||
import { decodeUtf8 } from "./utils";
|
import { decodeUtf8 } from "./utils";
|
||||||
|
|
||||||
interface ScrcpyError {
|
|
||||||
type: string;
|
|
||||||
|
|
||||||
message: string;
|
|
||||||
|
|
||||||
stackTrace: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ScrcpyOutput {
|
|
||||||
level: ScrcpyLogLevel;
|
|
||||||
|
|
||||||
message: string;
|
|
||||||
|
|
||||||
error?: ScrcpyError;
|
|
||||||
}
|
|
||||||
|
|
||||||
function* splitLines(text: string): Generator<string, void, void> {
|
function* splitLines(text: string): Generator<string, void, void> {
|
||||||
let start = 0;
|
let start = 0;
|
||||||
|
|
||||||
|
@ -100,7 +84,7 @@ export class ScrcpyClient {
|
||||||
client.onOutput((line) => {
|
client.onOutput((line) => {
|
||||||
const match = line.match(encoderNameRegex);
|
const match = line.match(encoderNameRegex);
|
||||||
if (match) {
|
if (match) {
|
||||||
encoders.push(match[1]);
|
encoders.push(match[1]!);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class BitReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public next(): number {
|
public next(): number {
|
||||||
const value = (this.buffer[this.bytePosition] >> (7 - this.bitPosition)) & 1;
|
const value = (this.buffer[this.bytePosition]! >> (7 - this.bitPosition)) & 1;
|
||||||
this.bitPosition += 1;
|
this.bitPosition += 1;
|
||||||
if (this.bitPosition === 8) {
|
if (this.bitPosition === 8) {
|
||||||
this.bytePosition += 1;
|
this.bytePosition += 1;
|
||||||
|
@ -179,13 +179,17 @@ export function parse_sequence_parameter_set(buffer: ArrayBuffer) {
|
||||||
profile_idc === 134) {
|
profile_idc === 134) {
|
||||||
const chroma_format_idc = reader.decodeExponentialGolombNumber();
|
const chroma_format_idc = reader.decodeExponentialGolombNumber();
|
||||||
if (chroma_format_idc === 3) {
|
if (chroma_format_idc === 3) {
|
||||||
const separate_colour_plane_flag = !!reader.next();
|
// separate_colour_plane_flag
|
||||||
|
reader.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bit_depth_luma_minus8 = reader.decodeExponentialGolombNumber();
|
// bit_depth_luma_minus8
|
||||||
const bit_depth_chroma_minus8 = reader.decodeExponentialGolombNumber();
|
reader.decodeExponentialGolombNumber();
|
||||||
|
// bit_depth_chroma_minus8
|
||||||
|
reader.decodeExponentialGolombNumber();
|
||||||
|
|
||||||
const qpprime_y_zero_transform_bypass_flag = !!reader.next();
|
// qpprime_y_zero_transform_bypass_flag
|
||||||
|
reader.next();
|
||||||
|
|
||||||
const seq_scaling_matrix_present_flag = !!reader.next();
|
const seq_scaling_matrix_present_flag = !!reader.next();
|
||||||
if (seq_scaling_matrix_present_flag) {
|
if (seq_scaling_matrix_present_flag) {
|
||||||
|
@ -206,14 +210,19 @@ export function parse_sequence_parameter_set(buffer: ArrayBuffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const log2_max_frame_num_minus4 = reader.decodeExponentialGolombNumber();
|
// log2_max_frame_num_minus4
|
||||||
|
reader.decodeExponentialGolombNumber();
|
||||||
const pic_order_cnt_type = reader.decodeExponentialGolombNumber();
|
const pic_order_cnt_type = reader.decodeExponentialGolombNumber();
|
||||||
if (pic_order_cnt_type === 0) {
|
if (pic_order_cnt_type === 0) {
|
||||||
const log2_max_pic_order_cnt_lsb_minus4 = reader.decodeExponentialGolombNumber();
|
// log2_max_pic_order_cnt_lsb_minus4
|
||||||
|
reader.decodeExponentialGolombNumber();
|
||||||
} else if (pic_order_cnt_type === 1) {
|
} else if (pic_order_cnt_type === 1) {
|
||||||
const delta_pic_order_always_zero_flag = reader.next();
|
// delta_pic_order_always_zero_flag
|
||||||
const offset_for_non_ref_pic = reader.decodeExponentialGolombNumber();
|
reader.next();
|
||||||
const offset_for_top_to_bottom_field = reader.decodeExponentialGolombNumber();
|
// offset_for_non_ref_pic
|
||||||
|
reader.decodeExponentialGolombNumber();
|
||||||
|
// offset_for_top_to_bottom_field
|
||||||
|
reader.decodeExponentialGolombNumber();
|
||||||
const num_ref_frames_in_pic_order_cnt_cycle = reader.decodeExponentialGolombNumber();
|
const num_ref_frames_in_pic_order_cnt_cycle = reader.decodeExponentialGolombNumber();
|
||||||
const offset_for_ref_frame: number[] = [];
|
const offset_for_ref_frame: number[] = [];
|
||||||
for (let i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
|
for (let i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
|
||||||
|
@ -221,17 +230,21 @@ export function parse_sequence_parameter_set(buffer: ArrayBuffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const max_num_ref_frames = reader.decodeExponentialGolombNumber();
|
// max_num_ref_frames
|
||||||
const gaps_in_frame_num_value_allowed_flag = reader.next();
|
reader.decodeExponentialGolombNumber();
|
||||||
|
// gaps_in_frame_num_value_allowed_flag
|
||||||
|
reader.next();
|
||||||
const pic_width_in_mbs_minus1 = reader.decodeExponentialGolombNumber();
|
const pic_width_in_mbs_minus1 = reader.decodeExponentialGolombNumber();
|
||||||
const pic_height_in_map_units_minus1 = reader.decodeExponentialGolombNumber();
|
const pic_height_in_map_units_minus1 = reader.decodeExponentialGolombNumber();
|
||||||
|
|
||||||
const frame_mbs_only_flag = reader.next();
|
const frame_mbs_only_flag = reader.next();
|
||||||
if (!frame_mbs_only_flag) {
|
if (!frame_mbs_only_flag) {
|
||||||
const mb_adaptive_frame_field_flag = !!reader.next();
|
// mb_adaptive_frame_field_flag
|
||||||
|
reader.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
const direct_8x8_inference_flag = reader.next();
|
// direct_8x8_inference_flag
|
||||||
|
reader.next();
|
||||||
|
|
||||||
const frame_cropping_flag = !!reader.next();
|
const frame_cropping_flag = !!reader.next();
|
||||||
let frame_crop_left_offset: number;
|
let frame_crop_left_offset: number;
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
"prepublishOnly": "npm run build"
|
"prepublishOnly": "npm run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@yume-chan/dataview-bigint-polyfill": "0.0.10",
|
||||||
"bluebird": "^3.7.2",
|
"bluebird": "^3.7.2",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1"
|
||||||
"@yume-chan/dataview-bigint-polyfill": "0.0.10"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { getBigInt64, getBigUint64, setBigInt64, setBigUint64 } from '@yume-chan/dataview-bigint-polyfill/esm/fallback';
|
import { getBigInt64, getBigUint64, setBigInt64, setBigUint64 } from '@yume-chan/dataview-bigint-polyfill/esm/fallback';
|
||||||
import { StructAsyncDeserializeStream, StructDeserializeStream, StructFieldDefinition, StructFieldValue, StructOptions, StructValue } from "../basic";
|
import { StructAsyncDeserializeStream, StructDeserializeStream, StructFieldDefinition, StructFieldValue, StructOptions, StructValue } from "../basic";
|
||||||
import { Syncbird } from "../syncbird";
|
import { Syncbird } from "../syncbird";
|
||||||
|
|
|
@ -8,35 +8,12 @@ const temp = path.resolve(__dirname, '..', 'temp', process.pid.toString());
|
||||||
fs.mkdirSync(temp, { recursive: true });
|
fs.mkdirSync(temp, { recursive: true });
|
||||||
|
|
||||||
if (process.argv[2] !== '--incremental') {
|
if (process.argv[2] !== '--incremental') {
|
||||||
fs.rmSync(path.resolve(cwd, 'cjs'), { force: true, recursive: true });
|
|
||||||
fs.rmSync(path.resolve(cwd, 'esm'), { force: true, recursive: true });
|
fs.rmSync(path.resolve(cwd, 'esm'), { force: true, recursive: true });
|
||||||
fs.rmSync(path.resolve(cwd, 'dts'), { force: true, recursive: true });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const tsconfigPath = path.resolve(cwd, 'tsconfig.json');
|
const tsconfigPath = path.resolve(cwd, 'tsconfig.json');
|
||||||
const tsconfigValue = JSON5.parse(fs.readFileSync(tsconfigPath), 'utf8');
|
const tsconfigValue = JSON5.parse(fs.readFileSync(tsconfigPath), 'utf8');
|
||||||
|
|
||||||
// const cjsTsconfigPath = path.resolve(temp, 'tsconfig.cjs.json');
|
|
||||||
// const cjsTsconfigValue = {
|
|
||||||
// ...tsconfigValue,
|
|
||||||
// extends: tsconfigPath,
|
|
||||||
// compilerOptions: {
|
|
||||||
// composite: false,
|
|
||||||
// outDir: path.resolve(cwd, 'cjs'),
|
|
||||||
// module: 'CommonJS',
|
|
||||||
// declaration: false,
|
|
||||||
// declarationDir: null,
|
|
||||||
// declarationMap: false,
|
|
||||||
// typeRoots: [
|
|
||||||
// ...(tsconfigValue.compilerOptions?.typeRoots || []),
|
|
||||||
// path.resolve(cwd, 'node_modules', '@types'),
|
|
||||||
// path.resolve(__dirname, '..', 'node_modules', '@types'),
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
// references: [],
|
|
||||||
// };
|
|
||||||
// fs.writeFileSync(cjsTsconfigPath, JSON.stringify(cjsTsconfigValue, undefined, 4));
|
|
||||||
|
|
||||||
const esmTsconfigPath = path.resolve(temp, 'tsconfig.esm.json');
|
const esmTsconfigPath = path.resolve(temp, 'tsconfig.esm.json');
|
||||||
const testTypes = tsconfigValue.testTypes || ['jest'];
|
const testTypes = tsconfigValue.testTypes || ['jest'];
|
||||||
const esmTsconfigValue = {
|
const esmTsconfigValue = {
|
||||||
|
@ -64,7 +41,6 @@ fs.writeFileSync(esmTsconfigPath, JSON.stringify(esmTsconfigValue, undefined, 4)
|
||||||
const tsc = path.resolve(cwd, 'node_modules', '.bin', 'tsc');
|
const tsc = path.resolve(cwd, 'node_modules', '.bin', 'tsc');
|
||||||
const tscResult = childProcess.spawnSync(tsc, [
|
const tscResult = childProcess.spawnSync(tsc, [
|
||||||
'--build',
|
'--build',
|
||||||
// cjsTsconfigPath,
|
|
||||||
esmTsconfigPath,
|
esmTsconfigPath,
|
||||||
], {
|
], {
|
||||||
cwd,
|
cwd,
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"rootDir": "../../../src",
|
"rootDir": "../../../src",
|
||||||
"outDir": "../../../cjs",
|
"outDir": "../../../esm",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "../../../dts",
|
"declarationDir": "../../../esm",
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
|
@ -23,12 +23,17 @@
|
||||||
/* Strict Type-Checking Options */
|
/* Strict Type-Checking Options */
|
||||||
"strict": true, // /* Enable all strict type-checking options. */
|
"strict": true, // /* Enable all strict type-checking options. */
|
||||||
/* Additional Checks */
|
/* Additional Checks */
|
||||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
"noUnusedLocals": true, // /* Report errors on unused locals. */
|
||||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noImplicitReturns": true, // /* Report error when not all code paths in function return a value. */
|
"noImplicitReturns": true, // /* Report error when not all code paths in function return a value. */
|
||||||
"noFallthroughCasesInSwitch": true, // /* Report errors for fallthrough cases in switch statement. */
|
"noFallthroughCasesInSwitch": true, // /* Report errors for fallthrough cases in switch statement. */
|
||||||
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
|
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
|
||||||
|
"exactOptionalPropertyTypes": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noUncheckedIndexedAccess": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
/* Module Resolution Options */
|
/* Module Resolution Options */
|
||||||
"moduleResolution": "node", // /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
"moduleResolution": "node", // /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue