Fix small code smalls, update Biome to 2.3.11
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
|
||||
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
|
||||
"assist": { "actions": { "source": { "organizeImports": "off" } } },
|
||||
"formatter": {
|
||||
"enabled": false
|
||||
|
||||
@@ -45,8 +45,6 @@ export type IElementListener = {
|
||||
*/
|
||||
export class EbmlIterator {
|
||||
|
||||
private padding = 0;
|
||||
|
||||
private parserMap = new Map<DataType, (e: IHeader) => Promise<ValueType>>();
|
||||
|
||||
private ebmlMaxIDLength = 4;
|
||||
@@ -138,12 +136,10 @@ export class EbmlIterator {
|
||||
} else {
|
||||
switch (element.id) {
|
||||
case 0xec: // void
|
||||
this.padding += element.len;
|
||||
await this.tokenizer.ignore(element.len);
|
||||
break;
|
||||
default:
|
||||
debug(`parseEbml: parent=${getElementPath(dtdElement)}, unknown child: id=${element.id.toString(16)} at position=${elementPosition}`);
|
||||
this.padding += element.len;
|
||||
await this.tokenizer.ignore(element.len);
|
||||
}
|
||||
}
|
||||
@@ -241,7 +237,7 @@ function linkParents(element: IElementType): ILinkedElementType {
|
||||
Object.keys(element.container)
|
||||
.map(id => {
|
||||
const child = (element.container as { [id: string]: ILinkedElementType; })[id];
|
||||
child.id = Number.parseInt(id);
|
||||
child.id = Number.parseInt(id, 10);
|
||||
return child;
|
||||
}).forEach(child => {
|
||||
child.parent = element as ILinkedElementType;
|
||||
|
||||
@@ -19,8 +19,6 @@ export class FlacParser extends AbstractID3Parser {
|
||||
|
||||
private vorbisParser = new VorbisStream(this.metadata, this.options);
|
||||
|
||||
private padding = 0;
|
||||
|
||||
public async postId3v2Parse(): Promise<void> {
|
||||
|
||||
const fourCC = await this.tokenizer.readToken<string>(FourCcToken);
|
||||
@@ -49,8 +47,7 @@ export class FlacParser extends AbstractID3Parser {
|
||||
case Flac.BlockType.STREAMINFO:
|
||||
return this.readBlockStreamInfo(blockHeader.length);
|
||||
case Flac.BlockType.PADDING:
|
||||
this.padding += blockHeader.length;
|
||||
break;
|
||||
break;
|
||||
case Flac.BlockType.APPLICATION:
|
||||
break;
|
||||
case Flac.BlockType.SEEKTABLE:
|
||||
|
||||
@@ -328,18 +328,18 @@ export class FrameParser {
|
||||
|
||||
case 'GEOB': { // General encapsulated object
|
||||
// [encoding] <MIME> 0x00 <filename> 0x00/0x00 0x00 <description> 0x00/0x00 0x00 <data>
|
||||
const {encoding: geobEncoding, bom: geobBom} = TextEncodingToken.get(uint8Array, 0);
|
||||
const encoding = TextEncodingToken.get(uint8Array, 0);
|
||||
uint8Array = uint8Array.subarray(1);
|
||||
|
||||
const mimeTypeStr = FrameParser.readNullTerminatedString(uint8Array, urlEnc);
|
||||
const mimeType = mimeTypeStr.text;
|
||||
uint8Array = uint8Array.subarray(mimeTypeStr.len);
|
||||
|
||||
const filenameStr = FrameParser.readNullTerminatedString(uint8Array, {encoding: geobEncoding, bom: geobBom});
|
||||
const filenameStr = FrameParser.readNullTerminatedString(uint8Array, encoding);
|
||||
const filename = filenameStr.text;
|
||||
uint8Array = uint8Array.subarray(filenameStr.len);
|
||||
|
||||
const descriptionStr = FrameParser.readNullTerminatedString(uint8Array, {encoding: geobEncoding, bom: geobBom});
|
||||
const descriptionStr = FrameParser.readNullTerminatedString(uint8Array, encoding);
|
||||
const description = descriptionStr.text;
|
||||
uint8Array = uint8Array.subarray(descriptionStr.len);
|
||||
|
||||
@@ -368,10 +368,10 @@ export class FrameParser {
|
||||
|
||||
case 'WXXX': {
|
||||
// [encoding] <description> 0x00/0x00 0x00 <url>
|
||||
const {encoding: wxxxEncoding, bom: wxxxBom} = TextEncodingToken.get(uint8Array, 0);
|
||||
const encoding = TextEncodingToken.get(uint8Array, 0);
|
||||
uint8Array = uint8Array.subarray(1);
|
||||
|
||||
const descriptionStr = FrameParser.readNullTerminatedString(uint8Array, {encoding: wxxxEncoding, bom: wxxxBom});
|
||||
const descriptionStr = FrameParser.readNullTerminatedString(uint8Array, encoding);
|
||||
const description = descriptionStr.text;
|
||||
uint8Array = uint8Array.subarray(descriptionStr.len);
|
||||
|
||||
@@ -382,9 +382,9 @@ export class FrameParser {
|
||||
|
||||
case 'WFD':
|
||||
case 'WFED': {
|
||||
const {encoding: wfdEncoding, bom: wfdBom} = TextEncodingToken.get(uint8Array, 0);
|
||||
const encoding = TextEncodingToken.get(uint8Array, 0);
|
||||
uint8Array = uint8Array.subarray(1);
|
||||
output = FrameParser.readNullTerminatedString(uint8Array, {encoding: wfdEncoding, bom: wfdBom}).text;
|
||||
output = FrameParser.readNullTerminatedString(uint8Array, encoding).text;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ export async function parseFile(filePath: string, options: IOptions = {}): Promi
|
||||
|
||||
try {
|
||||
return await parserFactory.parse(fileTokenizer, parserLoader, options);
|
||||
} catch(error: any) {
|
||||
} catch(error: unknown) {
|
||||
if (error instanceof CouldNotDetermineFileTypeError || error instanceof UnsupportedFileTypeError) {
|
||||
error.message += `: ${filePath}`;
|
||||
}
|
||||
|
||||
@@ -287,14 +287,12 @@ export class MpegParser extends AbstractID3Parser {
|
||||
|
||||
private frameCount = 0;
|
||||
private syncFrameCount = -1;
|
||||
private countSkipFrameData = 0;
|
||||
private totalDataLength = 0;
|
||||
|
||||
private audioFrameHeader? : MpegFrameHeader;
|
||||
private bitrates: number[] = [];
|
||||
private offset = 0;
|
||||
private frame_size = 0;
|
||||
private crc: number | null = null;
|
||||
|
||||
private calculateEofDuration = false;
|
||||
private samplesPerFrame: number | null = null;
|
||||
@@ -548,8 +546,8 @@ export class MpegParser extends AbstractID3Parser {
|
||||
}
|
||||
|
||||
private async parseCrc(): Promise<void> {
|
||||
this.crc = await this.tokenizer.readNumber(Token.INT16_BE);
|
||||
this.offset += 2;
|
||||
await this.tokenizer.ignore(Token.INT16_BE.len); // Ignore CRC
|
||||
this.offset += Token.INT16_BE.len;
|
||||
return this.skipSideInformation();
|
||||
}
|
||||
|
||||
@@ -657,7 +655,6 @@ export class MpegParser extends AbstractID3Parser {
|
||||
private async skipFrameData(frameDataLeft: number): Promise<void> {
|
||||
if (frameDataLeft < 0) throw new MpegContentError('frame-data-left cannot be negative');
|
||||
await this.tokenizer.ignore(frameDataLeft);
|
||||
this.countSkipFrameData += frameDataLeft;
|
||||
}
|
||||
|
||||
private areAllSame(array: unknown[]) {
|
||||
|
||||
@@ -99,7 +99,7 @@ export class VorbisStream implements IPageConsumer {
|
||||
await this.metadata.addTag('vorbis', id, value);
|
||||
}
|
||||
|
||||
public calculateDuration(enfOfStream: boolean) {
|
||||
public calculateDuration(_enfOfStream: boolean) {
|
||||
if (this.lastPageHeader && this.metadata.format.sampleRate && this.lastPageHeader.absoluteGranulePosition >= 0) {
|
||||
// Calculate duration
|
||||
this.metadata.setFormat('numberOfSamples', this.lastPageHeader.absoluteGranulePosition);
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@
|
||||
"uint8array-extras": "^1.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.3.10",
|
||||
"@biomejs/biome": "2.3.11",
|
||||
"@types/chai": "^5.2.3",
|
||||
"@types/chai-as-promised": "^8.0.2",
|
||||
"@types/content-type": "^1.1.9",
|
||||
|
||||
@@ -30,18 +30,18 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/biome@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/biome@npm:2.3.10"
|
||||
"@biomejs/biome@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/biome@npm:2.3.11"
|
||||
dependencies:
|
||||
"@biomejs/cli-darwin-arm64": "npm:2.3.10"
|
||||
"@biomejs/cli-darwin-x64": "npm:2.3.10"
|
||||
"@biomejs/cli-linux-arm64": "npm:2.3.10"
|
||||
"@biomejs/cli-linux-arm64-musl": "npm:2.3.10"
|
||||
"@biomejs/cli-linux-x64": "npm:2.3.10"
|
||||
"@biomejs/cli-linux-x64-musl": "npm:2.3.10"
|
||||
"@biomejs/cli-win32-arm64": "npm:2.3.10"
|
||||
"@biomejs/cli-win32-x64": "npm:2.3.10"
|
||||
"@biomejs/cli-darwin-arm64": "npm:2.3.11"
|
||||
"@biomejs/cli-darwin-x64": "npm:2.3.11"
|
||||
"@biomejs/cli-linux-arm64": "npm:2.3.11"
|
||||
"@biomejs/cli-linux-arm64-musl": "npm:2.3.11"
|
||||
"@biomejs/cli-linux-x64": "npm:2.3.11"
|
||||
"@biomejs/cli-linux-x64-musl": "npm:2.3.11"
|
||||
"@biomejs/cli-win32-arm64": "npm:2.3.11"
|
||||
"@biomejs/cli-win32-x64": "npm:2.3.11"
|
||||
dependenciesMeta:
|
||||
"@biomejs/cli-darwin-arm64":
|
||||
optional: true
|
||||
@@ -61,62 +61,62 @@ __metadata:
|
||||
optional: true
|
||||
bin:
|
||||
biome: bin/biome
|
||||
checksum: 10c0/317bf8f8051f4030dc52855159bbd058db5cf2c9d5e7b212271f3d91842e0fc5bbc05495e47943676481325d4081cd41cf25dfa18a437d2b6e27f72dacfd41b4
|
||||
checksum: 10c0/b9764070c3d1583466a8861d37dc480c18103f7bb52115db0f265a38e6343d69792c9beea094e0b3db0905cb365b9a82ad2a0f3f05b7f04873a8f9b444263140
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-darwin-arm64@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-darwin-arm64@npm:2.3.10"
|
||||
"@biomejs/cli-darwin-arm64@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-darwin-arm64@npm:2.3.11"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-darwin-x64@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-darwin-x64@npm:2.3.10"
|
||||
"@biomejs/cli-darwin-x64@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-darwin-x64@npm:2.3.11"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-linux-arm64-musl@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-linux-arm64-musl@npm:2.3.10"
|
||||
"@biomejs/cli-linux-arm64-musl@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-linux-arm64-musl@npm:2.3.11"
|
||||
conditions: os=linux & cpu=arm64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-linux-arm64@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-linux-arm64@npm:2.3.10"
|
||||
"@biomejs/cli-linux-arm64@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-linux-arm64@npm:2.3.11"
|
||||
conditions: os=linux & cpu=arm64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-linux-x64-musl@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-linux-x64-musl@npm:2.3.10"
|
||||
"@biomejs/cli-linux-x64-musl@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-linux-x64-musl@npm:2.3.11"
|
||||
conditions: os=linux & cpu=x64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-linux-x64@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-linux-x64@npm:2.3.10"
|
||||
"@biomejs/cli-linux-x64@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-linux-x64@npm:2.3.11"
|
||||
conditions: os=linux & cpu=x64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-win32-arm64@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-win32-arm64@npm:2.3.10"
|
||||
"@biomejs/cli-win32-arm64@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-win32-arm64@npm:2.3.11"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@biomejs/cli-win32-x64@npm:2.3.10":
|
||||
version: 2.3.10
|
||||
resolution: "@biomejs/cli-win32-x64@npm:2.3.10"
|
||||
"@biomejs/cli-win32-x64@npm:2.3.11":
|
||||
version: 2.3.11
|
||||
resolution: "@biomejs/cli-win32-x64@npm:2.3.11"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
@@ -2205,7 +2205,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "music-metadata@workspace:."
|
||||
dependencies:
|
||||
"@biomejs/biome": "npm:2.3.10"
|
||||
"@biomejs/biome": "npm:2.3.11"
|
||||
"@borewit/text-codec": "npm:^0.2.1"
|
||||
"@tokenizer/token": "npm:^0.3.0"
|
||||
"@types/chai": "npm:^5.2.3"
|
||||
|
||||
Reference in New Issue
Block a user