diff --git a/.prettierrc b/.prettierrc index ade8e400..61482dd4 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,6 @@ { "trailingComma": "all", + "endOfLine": "lf", "tabWidth": 2, "printWidth": 100, "semi": true, diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..4c2e136e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "eslint.useFlatConfig": true, + "eslint.workingDirectories": [{ "mode": "auto" }], + "eslint.options": { + "overrideConfigFile": "./eslint.config.js" + } +} diff --git a/entries/types.ts b/entries/types.ts index f0f3868e..98c7f212 100644 --- a/entries/types.ts +++ b/entries/types.ts @@ -7,10 +7,9 @@ import type { SampleEntry } from './all'; import type * as BOXES from './all-boxes'; type AllBoxes = Partial & Partial; -export namespace MP4Box { - export interface BoxRegistry extends AllBoxes {} - export interface DescriptorRegistry extends Partial {} -} + +export type BoxRegistry = AllBoxes; +export type DescriptorRegistry = Partial; export type TypedArray = | Int8Array @@ -26,19 +25,19 @@ export type TypedArray = | BigUint64Array; export type ValueOf = T[keyof T]; -export type InstanceOf = T extends new (...args: Array) => infer R ? R : never; +export type InstanceOf = T extends new (...args: Array) => infer R ? R : never; export type KindOf = InstanceOf>; export type Extends = { [TKey in keyof TObject]: TObject[TKey] extends TExtends ? TObject[TKey] : undefined; }[keyof TObject]; -export type TupleOf = R['length'] extends N +export type TupleOf = []> = R['length'] extends N ? R : TupleOf; export type NumberTuple = TupleOf; -export type BoxKind = InstanceOf>; -export type SampleEntryKind = InstanceOf>; +export type BoxKind = InstanceOf>; +export type SampleEntryKind = InstanceOf>; export interface FragmentedTrack { id: number; @@ -99,7 +98,7 @@ export interface Track { created: Date; cts_shift: BOXES.cslgBox; duration: number; - edits?: Entry[]; + edits?: Array; id: number; kind: BOXES.kindBox | { schemeURI: ''; value: '' }; language: string; @@ -150,14 +149,14 @@ export interface Description { version: number; } -export type IncompleteBox = { +export interface IncompleteBox { box?: Box; code: number; hdr_size?: number; size?: number; start?: number; type?: string; -}; +} export interface Item { alreadyRead?: number; @@ -301,10 +300,11 @@ export type StringType = | EncodedLengthStringType | EndianStringType; -export type GetterSetterType = { +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export interface GetterSetterType { get(dataStream: DataStream, struct: Record): T; set?(dataStream: DataStream, value: T, struct?: Record): void; -}; +} export type TupleType = [ '[]', @@ -317,7 +317,7 @@ export type TupleType = [ ), ]; -export type FnType = (dataStream: DataStream, struct: T) => number; +export type FnType = (dataStream: DataStream, struct: T) => number; export type Type = | NumberType @@ -360,7 +360,7 @@ export type ValueFromType = TValue extends StringType : never; export type StructDataFromStructDefinition = { - [TKey in T[number][0]]: Extract[1] extends infer TValue + [TKey in T[number][0]]: Extract[1] extends infer TValue ? TValue extends Type ? ValueFromType : never diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..4e38cdba --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,33 @@ +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import eslintPlugin from 'eslint-plugin-prettier/recommended'; + +export default tseslint.config( + { ignores: ['dist', '**/*.{mjs,js}'] }, + eslint.configs.recommended, + + tseslint.configs.strict, + tseslint.configs.stylistic, + { + rules: { + // Override no-unused-vars to allow unused variables that start with an underscore + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, + ], + // Disable the base rule 'no-unused-vars' to avoid conflicts with TypeScript's rule + 'no-unused-vars': 'off', + // Disable @typescript-eslint/prefer-for-of we have too much for now + '@typescript-eslint/prefer-for-of': 'off', + // Prefer to use Array over T[] + '@typescript-eslint/array-type': ['error', { default: 'generic' }], + // Use interfaces for object type definitions + '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], + // Don't require curly braces for simple if statements + curly: ['error', 'multi-line'], + // Enforce strict equality checks + eqeqeq: 'error', + }, + }, + eslintPlugin, +); diff --git a/package-lock.json b/package-lock.json index d883b435..e578e9f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,11 +11,17 @@ "devDependencies": { "@commitlint/cli": "^19.8.1", "@commitlint/config-conventional": "^19.8.1", + "@eslint/js": "^9.27.0", "@types/node": "^22.15.21", "dpdm": "^3.14.0", + "eslint": "^9.27.0", + "eslint-config-prettier": "^10.1.5", + "eslint-plugin-prettier": "^5.4.0", "husky": "^9.1.7", + "prettier": "^3.5.3", "tsup": "^8.3.5", - "typescript": "^5.6.3" + "typescript": "^5.6.3", + "typescript-eslint": "^8.32.1" }, "engines": { "node": ">=20.8.1" @@ -781,6 +787,223 @@ "node": ">=18" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.20.0.tgz", + "integrity": "sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.2.2.tgz", + "integrity": "sha512-+GPzk8PlG0sPpzdU5ZvIRMPidzAnZDl/s9L+y13iodqvb8leL53bTannOrQ/Im7UkpsmFU5Ily5U60LWixnmLg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@eslint/js": { + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.27.0.tgz", + "integrity": "sha512-G5JD9Tu5HJEu4z2Uo4aHY2sLV64B7CDMXxFzqzjl3NKd6RVzSXNoE80jk7Y0lJkTTkjiIhBAqmlYwjuBY3tvpA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -937,6 +1160,44 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -948,6 +1209,19 @@ "node": ">=14" } }, + "node_modules/@pkgr/core": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.4.tgz", + "integrity": "sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/pkgr" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.41.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.41.1.tgz", @@ -1245,6 +1519,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.15.21", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.21.tgz", @@ -1255,127 +1536,366 @@ "undici-types": "~6.21.0" } }, - "node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.32.1.tgz", + "integrity": "sha512-6u6Plg9nP/J1GRpe/vcjjabo6Uc5YQPAMxsgQyGC/I0RuukiG1wIe3+Vtg3IrSCVJDmqK3j8adrtzXSENRtFgg==", "dev": true, "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.32.1", + "@typescript-eslint/type-utils": "8.32.1", + "@typescript-eslint/utils": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.4.tgz", + "integrity": "sha512-gJzzk+PQNznz8ysRrC0aOkBNVRBDtE1n53IqyqEf3PXrYwomFs5q4pGMizBMJF+ykh03insJ27hB8gSrD2Hn8A==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 4" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@typescript-eslint/parser": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.32.1.tgz", + "integrity": "sha512-LKMrmwCPoLhM45Z00O1ulb6jwyVr2kr3XJp+G+tSEZcbauNnScewcQwtJqXDhXeYPDEjZ8C1SjXm015CirEmGg==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "@typescript-eslint/scope-manager": "8.32.1", + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/typescript-estree": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1", + "debug": "^4.3.4" }, "engines": { - "node": ">=8" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true, - "license": "MIT" - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, - "node_modules/array-ify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", - "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", - "dev": true, - "license": "MIT" - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.32.1.tgz", + "integrity": "sha512-7IsIaIDeZn7kffk7qXC3o6Z4UblZJKV3UBpkvRNpr5NSyLji7tvTcvmnMNYuYLyh26mN8W723xpo3i4MlD33vA==", "dev": true, "license": "MIT", "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/@typescript-eslint/type-utils": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.32.1.tgz", + "integrity": "sha512-mv9YpQGA8iIsl5KyUPi+FGLm7+bA4fgXaeRcFKRDRwDMu4iwrSHeDPipwueNXhdIIZltwCJv+NkxftECbIZWfA==", "dev": true, "license": "MIT", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "@typescript-eslint/typescript-estree": "8.32.1", + "@typescript-eslint/utils": "8.32.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" }, "engines": { - "node": ">= 6" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/bl/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "node_modules/@typescript-eslint/types": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.32.1.tgz", + "integrity": "sha512-YmybwXUJcgGqgAp6bEsgpPXEg6dcCyPyCSr0CAAueacR/CCBi25G3V8gGQ2kRzQRBNol7VQknxMs9HvVa9Rvfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.32.1.tgz", + "integrity": "sha512-Y3AP9EIfYwBb4kWGb+simvPaqQoT5oJuzzj9m0i6FCY6SPvlomY2Ei4UEMm7+FXtlNJbor80ximyslzaQF6xhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.32.1.tgz", + "integrity": "sha512-DsSFNIgLSrc89gpq1LJB7Hm1YpuhK086DRDJSNrewcGvYloWW1vZLHBTIvarKZDcAORIy/uWNx8Gad+4oMpkSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.32.1", + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/typescript-estree": "8.32.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.32.1.tgz", + "integrity": "sha512-ar0tjQfObzhSaW3C3QNmTc5ofj0hDoNQ5XWrCy6zDyabdr0TWhCkClp+rywGNj/odAFBVzzJrK4tEq5M4Hmu4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.32.1", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true, + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bl/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { @@ -1403,6 +1923,30 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -1560,6 +2104,13 @@ "dot-prop": "^5.1.0" } }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, "node_modules/confbox": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", @@ -1711,6 +2262,31 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -1901,19 +2477,424 @@ "node": ">=6" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/fast-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", - "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", + "node_modules/eslint": { + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.27.0.tgz", + "integrity": "sha512-ixRawFQuMB9DZ7fjU3iGGganFDp3+45bPOdaRurcFHSXO1e/sYwUX/FtQZpLZJR6SjMoJH8hR2pPEAfDyCoU2Q==", "dev": true, - "funding": [ + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.20.0", + "@eslint/config-helpers": "^0.2.1", + "@eslint/core": "^0.14.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.27.0", + "@eslint/plugin-kit": "^0.3.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.3.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "10.1.5", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.5.tgz", + "integrity": "sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.0.tgz", + "integrity": "sha512-BvQOvUhkVQM1i63iMETK9Hjud9QhqBnbtT1Zc642p9ynzBuCe5pybkOnvqZIBypXmMlsGcnU4HZ8sCTPfpAexA==", + "dev": true, + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.11.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.3.0.tgz", + "integrity": "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/@eslint/core": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", + "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/eslint/node_modules/@eslint/plugin-kit": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz", + "integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.14.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/eslint/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", + "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", + "dev": true, + "funding": [ { "type": "github", "url": "https://github.com/sponsors/fastify" @@ -1925,6 +2906,42 @@ ], "license": "BSD-3-Clause" }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find-up": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", @@ -1955,6 +2972,27 @@ "rollup": "^4.34.8" } }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -2027,6 +3065,19 @@ "node": ">=16" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/global-directory": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", @@ -2049,6 +3100,13 @@ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "dev": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2095,6 +3153,16 @@ ], "license": "BSD-3-Clause" }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/import-fresh": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", @@ -2133,6 +3201,16 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2156,13 +3234,36 @@ "dev": true, "license": "MIT" }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { - "node": ">=8" + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" } }, "node_modules/is-interactive": { @@ -2175,6 +3276,16 @@ "node": ">=8" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -2273,6 +3384,13 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -2287,6 +3405,13 @@ "dev": true, "license": "MIT" }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -2326,6 +3451,30 @@ "node": "*" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lilconfig": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", @@ -2482,6 +3631,30 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -2492,6 +3665,19 @@ "node": ">=6" } }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", @@ -2525,18 +3711,12 @@ "ufo": "^1.5.4" } }, - "node_modules/mlly/node_modules/acorn": { - "version": "8.14.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", - "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } + "license": "MIT" }, "node_modules/mz": { "version": "2.7.0", @@ -2550,6 +3730,13 @@ "thenify-all": "^1.0.0" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -2575,6 +3762,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/ora": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", @@ -2728,6 +3933,19 @@ "dev": true, "license": "ISC" }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/pirates": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", @@ -2793,6 +4011,76 @@ } } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -2836,6 +4124,17 @@ "node": ">=8" } }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rollup": { "version": "4.41.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.41.1.tgz", @@ -2876,6 +4175,30 @@ "fsevents": "~2.3.2" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/semver": { "version": "7.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", @@ -2985,6 +4308,19 @@ "node": ">=8" } }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/sucrase": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", @@ -3077,6 +4413,22 @@ "node": ">=8" } }, + "node_modules/synckit": { + "version": "0.11.6", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.6.tgz", + "integrity": "sha512-2pR2ubZSV64f/vqm9eLPz/KOvR9Dm+Co/5ChLgeHl0yEDRc6h5hXHoxEQH8Y5Ljycozd3p1k5TTSVdzYGkPvLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.2.4" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/synckit" + } + }, "node_modules/text-extensions": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", @@ -3172,6 +4524,19 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/tr46": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", @@ -3182,16 +4547,6 @@ "punycode": "^2.1.0" } }, - "node_modules/tr46/node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -3202,6 +4557,19 @@ "tree-kill": "cli.js" } }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", @@ -3285,31 +4653,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/tsup/node_modules/debug": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", - "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/tsup/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/tsup/node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -3337,6 +4680,19 @@ "node": ">= 8" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/typescript": { "version": "5.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", @@ -3351,6 +4707,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.32.1.tgz", + "integrity": "sha512-D7el+eaDHAmXvrZBy1zpzSNIRqnCOrkwTgZxTu3MUqRWk8k0q9m9Ho4+vPf7iHtgUfrK/o8IZaEApsxPlHTFCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.32.1", + "@typescript-eslint/parser": "8.32.1", + "@typescript-eslint/utils": "8.32.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, "node_modules/ufo": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", @@ -3387,6 +4766,16 @@ "node": ">= 10.0.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -3422,6 +4811,16 @@ "webidl-conversions": "^4.0.2" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 807303a5..bb0b599e 100644 --- a/package.json +++ b/package.json @@ -54,16 +54,23 @@ "build": "tsup", "circular": "dpdm -T ./entries/all.ts", "types": "tsc --noEmit --project tsconfig.json", - "test": "npm run build && npm run types && npm run circular" + "test": "npm run lint && npm run build && npm run types && npm run circular", + "lint": "eslint" }, "devDependencies": { "@commitlint/cli": "^19.8.1", "@commitlint/config-conventional": "^19.8.1", + "@eslint/js": "^9.27.0", "@types/node": "^22.15.21", "dpdm": "^3.14.0", + "eslint": "^9.27.0", + "eslint-config-prettier": "^10.1.5", + "eslint-plugin-prettier": "^5.4.0", "husky": "^9.1.7", + "prettier": "^3.5.3", "tsup": "^8.3.5", - "typescript": "^5.6.3" + "typescript": "^5.6.3", + "typescript-eslint": "^8.32.1" }, "packageManager": "npm@11.4.1" } diff --git a/src/DataStream.ts b/src/DataStream.ts index d5ba1c90..19ffc4ed 100644 --- a/src/DataStream.ts +++ b/src/DataStream.ts @@ -32,7 +32,7 @@ type ReadTypeReturnValue = // TODO: check range/support for 64-bits numbers in JavaScript export class DataStream { - static DataStream: {}; + static DataStream: DataStream; _buffer?: MP4BoxBuffer; _byteOffset?: number; @@ -64,7 +64,7 @@ export class DataStream { this.buffer = new MP4BoxBuffer(arrayBuffer || 0); } this.position = 0; - this.endianness = endianness == null ? DataStream.LITTLE_ENDIAN : endianness; + this.endianness = endianness === null ? DataStream.LITTLE_ENDIAN : endianness; } getPosition() { @@ -108,7 +108,7 @@ export class DataStream { * growing the buffer with writes and not filling the extra space completely). */ _trimAlloc() { - if (this._byteLength == this._buffer.byteLength) { + if (this._byteLength === this._buffer.byteLength) { return; } const buf = new MP4BoxBuffer(this._byteLength); @@ -210,7 +210,7 @@ export class DataStream { return this.position >= this._byteLength; } - #isTupleType(type: any): type is TupleType { + #isTupleType(type: unknown): type is TupleType { return Array.isArray(type) && type.length === 3 && type[0] === '[]'; } @@ -238,7 +238,7 @@ export class DataStream { * @return The read Int32Array. */ readInt32Array(length: number | null, endianness?: boolean | null) { - length = length == null ? this.byteLength - this.position / 4 : length; + length = length === null ? this.byteLength - this.position / 4 : length; const arr = new Int32Array(length); DataStream.memcpy( arr.buffer, @@ -247,7 +247,7 @@ export class DataStream { this.byteOffset + this.position, length * arr.BYTES_PER_ELEMENT, ); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += arr.byteLength; return arr; } @@ -260,7 +260,7 @@ export class DataStream { * @return The read Int16Array. */ readInt16Array(length: number | null, endianness?: boolean | null) { - length = length == null ? this.byteLength - this.position / 2 : length; + length = length === null ? this.byteLength - this.position / 2 : length; const arr = new Int16Array(length); DataStream.memcpy( arr.buffer, @@ -269,7 +269,7 @@ export class DataStream { this.byteOffset + this.position, length * arr.BYTES_PER_ELEMENT, ); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += arr.byteLength; return arr; } @@ -282,7 +282,7 @@ export class DataStream { * @return The read Int8Array. */ readInt8Array(length: number | null) { - length = length == null ? this.byteLength - this.position : length; + length = length === null ? this.byteLength - this.position : length; const arr = new Int8Array(length); DataStream.memcpy( arr.buffer, @@ -303,7 +303,7 @@ export class DataStream { * @return The read Uint32Array. */ readUint32Array(length: number | null, endianness?: boolean | null) { - length = length == null ? this.byteLength - this.position / 4 : length; + length = length === null ? this.byteLength - this.position / 4 : length; const arr = new Uint32Array(length); DataStream.memcpy( arr.buffer, @@ -312,7 +312,7 @@ export class DataStream { this.byteOffset + this.position, length * arr.BYTES_PER_ELEMENT, ); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += arr.byteLength; return arr; } @@ -325,7 +325,7 @@ export class DataStream { * @return The read Uint16Array. */ readUint16Array(length: number | null, endianness?: boolean) { - length = length == null ? this.byteLength - this.position / 2 : length; + length = length === null ? this.byteLength - this.position / 2 : length; const arr = new Uint16Array(length); DataStream.memcpy( arr.buffer, @@ -334,7 +334,7 @@ export class DataStream { this.byteOffset + this.position, length * arr.BYTES_PER_ELEMENT, ); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += arr.byteLength; return arr; } @@ -347,7 +347,7 @@ export class DataStream { * @return The read Uint8Array. */ readUint8Array(length: number | null) { - length = length == null ? this.byteLength - this.position : length; + length = length === null ? this.byteLength - this.position : length; const arr = new Uint8Array(length); DataStream.memcpy( arr.buffer, @@ -368,7 +368,7 @@ export class DataStream { * @return The read Float64Array. */ readFloat64Array(length: number | null, endianness?: boolean) { - length = length == null ? this.byteLength - this.position / 8 : length; + length = length === null ? this.byteLength - this.position / 8 : length; const arr = new Float64Array(length); DataStream.memcpy( arr.buffer, @@ -377,7 +377,7 @@ export class DataStream { this.byteOffset + this.position, length * arr.BYTES_PER_ELEMENT, ); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += arr.byteLength; return arr; } @@ -390,7 +390,7 @@ export class DataStream { * @return The read Float32Array. */ readFloat32Array(length: number | null, endianness?: boolean) { - length = length == null ? this.byteLength - this.position / 4 : length; + length = length === null ? this.byteLength - this.position / 4 : length; const arr = new Float32Array(length); DataStream.memcpy( arr.buffer, @@ -399,7 +399,7 @@ export class DataStream { this.byteOffset + this.position, length * arr.BYTES_PER_ELEMENT, ); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += arr.byteLength; return arr; } @@ -413,7 +413,7 @@ export class DataStream { readInt32(endianness?: boolean | null) { const v = this._dataView.getInt32( this.position, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 4; return v; @@ -428,7 +428,7 @@ export class DataStream { readInt16(endianness?: boolean) { const v = this._dataView.getInt16( this.position, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 2; return v; @@ -454,7 +454,7 @@ export class DataStream { readUint32(endianness?: boolean | null) { const v = this._dataView.getUint32( this.position, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 4; return v; @@ -469,7 +469,7 @@ export class DataStream { readUint16(endianness?: boolean | null) { const v = this._dataView.getUint16( this.position, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 2; return v; @@ -495,7 +495,7 @@ export class DataStream { readFloat32(endianness?: boolean | null) { const value = this._dataView.getFloat32( this.position, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 4; return value; @@ -510,7 +510,7 @@ export class DataStream { readFloat64(endianness?: boolean | null) { const value = this._dataView.getFloat64( this.position, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 8; return value; @@ -554,7 +554,7 @@ export class DataStream { * @return The converted typed array. */ static arrayToNative(typedArray: TypedArray, endianness?: boolean) { - if (endianness == this.endianness) { + if (endianness === this.endianness) { return typedArray; } else { return this.flipArrayEndianness(typedArray); @@ -570,7 +570,7 @@ export class DataStream { * @return The converted typed array. */ static nativeToEndian(typedArray: TypedArray, littleEndian: boolean) { - if (this.endianness == littleEndian) { + if (this.endianness === littleEndian) { return typedArray; } else { return this.flipArrayEndianness(typedArray); @@ -612,9 +612,9 @@ export class DataStream { * @return The read string. */ readString(length: number, encoding?: Charset | null): string { - if (encoding == null || encoding == 'ASCII') { + if (encoding === null || encoding === 'ASCII') { return fromCharCodeUint8( - this.mapUint8Array(length == null ? this.byteLength - this.position : length), + this.mapUint8Array(length === null ? this.byteLength - this.position : length), ); } else { return new TextDecoder(encoding).decode(this.mapUint8Array(length)); @@ -633,14 +633,14 @@ export class DataStream { const blen = this.byteLength - this.position; const u8 = new Uint8Array(this._buffer, this._byteOffset + this.position); let len = blen; - if (length != null) { + if (length !== null) { len = Math.min(length, blen); } for (; i < len && u8[i] !== 0; i++); // find first zero byte const s = fromCharCodeUint8(this.mapUint8Array(i)); - if (length != null) { + if (length !== null) { this.position += len - i; - } else if (i != blen) { + } else if (i !== blen) { this.position += 1; // trailing zero if not at end of buffer } return s; @@ -956,7 +956,7 @@ export class DataStream { this._dataView.setBigInt64( this.position, BigInt(value), - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 8; } @@ -973,7 +973,7 @@ export class DataStream { this._dataView.setInt32( this.position, value, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 4; } @@ -990,7 +990,7 @@ export class DataStream { this._dataView.setInt16( this.position, value, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 2; } @@ -1019,7 +1019,7 @@ export class DataStream { this._dataView.setUint32( this.position, value, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 4; } @@ -1036,7 +1036,7 @@ export class DataStream { this._dataView.setUint16( this.position, value, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 2; } @@ -1065,7 +1065,7 @@ export class DataStream { this._dataView.setFloat32( this.position, value, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 4; } @@ -1082,7 +1082,7 @@ export class DataStream { this._dataView.setFloat64( this.position, value, - endianness == null ? this.endianness : endianness, + endianness === null ? this.endianness : endianness, ); this.position += 8; } @@ -1099,7 +1099,7 @@ export class DataStream { * @bundle DataStream-write.js */ writeUCS2String(value: string, endianness: boolean, lengthOverride?: number) { - if (lengthOverride == null) { + if (lengthOverride === null) { lengthOverride = value.length; } let i: number; @@ -1122,8 +1122,8 @@ export class DataStream { */ writeString(value: string, encoding?: string, length?: number) { let i = 0; - if (encoding == null || encoding == 'ASCII') { - if (length != null) { + if (encoding === null || encoding === 'ASCII') { + if (length !== null) { const len = Math.min(value.length, length); for (i = 0; i < len; i++) { this.writeUint8(value.charCodeAt(i)); @@ -1154,7 +1154,7 @@ export class DataStream { */ writeCString(value: string, length?: number) { let i = 0; - if (length != null) { + if (length !== null) { const len = Math.min(value.length, length); for (i = 0; i < len; i++) { this.writeUint8(value.charCodeAt(i)); @@ -1199,24 +1199,24 @@ export class DataStream { * @bundle DataStream-write.js */ writeType(type: T, value: ValueFromType, struct?: Record) { - if (typeof type == 'function') { + if (typeof type === 'function') { return type(this, value); - } else if (typeof type == 'object' && !(type instanceof Array)) { + } else if (typeof type === 'object' && !(type instanceof Array)) { return type.set(this, value, struct); } let lengthOverride: number | null = null; let charset: Charset = 'ASCII'; - let pos = this.position; + const pos = this.position; let parsedType = type as ParsedType; - if (typeof type == 'string' && /:/.test(type)) { + if (typeof type === 'string' && /:/.test(type)) { const tp = type.split(':'); parsedType = tp[0] as `cstring` | `string`; lengthOverride = parseInt(tp[1]); } - if (typeof parsedType == 'string' && /,/.test(parsedType)) { + if (typeof parsedType === 'string' && /,/.test(parsedType)) { const tp = parsedType.split(','); parsedType = tp[0] as `cstring` | `string`; // NOTE: this said `charset = parseInt(tp[1])` before; @@ -1311,7 +1311,7 @@ export class DataStream { break; } } - if (lengthOverride != null) { + if (lengthOverride !== null) { this.position = pos; this._realloc(lengthOverride); this.position = pos + lengthOverride; @@ -1425,7 +1425,7 @@ export class DataStream { for (let i = 0; i < structDefinition.length; i += 1) { const t = structDefinition[i][1]; const v = this.readType(t, struct); - if (v == null) { + if (v === null) { if (this.failurePosition === 0) { this.failurePosition = this.position; } @@ -1461,13 +1461,13 @@ export class DataStream { * @bundle DataStream-read-struct.js */ readType(type: T, struct: Record): ReadTypeReturnValue { - if (typeof type == 'function') { + if (typeof type === 'function') { return type(this, struct); } - if (typeof type == 'object' && !(type instanceof Array)) { + if (typeof type === 'object' && !(type instanceof Array)) { return type.get(this, struct); } - if (type instanceof Array && type.length != 3) { + if (type instanceof Array && type.length !== 3) { // NOTE: this said `return this.readStruct(type, struct);` before return this.readStruct(type); } @@ -1476,15 +1476,15 @@ export class DataStream { let lengthOverride: number | null = null; let charset: Charset = 'ASCII'; - let pos = this.position; + const pos = this.position; let parsedType = type as ParsedType; - if (typeof parsedType == 'string' && /:/.test(parsedType)) { + if (typeof parsedType === 'string' && /:/.test(parsedType)) { const tp = parsedType.split(':'); parsedType = tp[0] as ParsedType; lengthOverride = parseInt(tp[1]); } - if (typeof parsedType == 'string' && /,/.test(parsedType)) { + if (typeof parsedType === 'string' && /,/.test(parsedType)) { const tp = parsedType.split(','); parsedType = tp[0] as ParsedType; // NOTE: this was `charset = parseInt(tp[1]);` before @@ -1573,7 +1573,7 @@ export class DataStream { const length = typeof len === 'function' ? len(struct, this, parsedType) - : typeof len == 'string' && struct[len] != null + : typeof len === 'string' && struct[len] !== null ? // @ts-expect-error FIXME: Struct[string] is currently of type Type parseInt(struct[len]) : typeof len === 'number' @@ -1581,8 +1581,8 @@ export class DataStream { : len === '*' ? null : parseInt(len); - if (typeof ta == 'string') { - let tap = ta.replace(/(le|be)$/, ''); + if (typeof ta === 'string') { + const tap = ta.replace(/(le|be)$/, ''); let endianness: null | boolean = null; if (/le$/.test(ta)) { endianness = DataStream.LITTLE_ENDIAN; @@ -1620,8 +1620,8 @@ export class DataStream { if (length === null) { value = []; while (!this.isEof()) { - let u = this.readType(ta, struct); - if (u == null) break; + const u = this.readType(ta, struct); + if (u === null) break; value.push(u); } } else { @@ -1639,12 +1639,12 @@ export class DataStream { const pos = this.position; try { const type = this.readType(ta, struct); - if (type == null) { + if (type === null) { this.position = pos; break; } value.push(type); - } catch (e) { + } catch { this.position = pos; break; } @@ -1653,7 +1653,7 @@ export class DataStream { value = new Array(length); for (let i = 0; i < length; i++) { const type = this.readType(ta, struct); - if (type == null) return null; + if (type === null) return null; value[i] = type; } } @@ -1661,7 +1661,7 @@ export class DataStream { break; } } - if (lengthOverride != null) { + if (lengthOverride !== null) { this.position = pos + lengthOverride; } @@ -1684,7 +1684,7 @@ export class DataStream { mapInt32Array(length: number, endianness?: boolean) { this._realloc(length * 4); const arr = new Int32Array(this._buffer, this.byteOffset + this.position, length); - DataStream.arrayToNative(arr, endianness == null ? DataStream.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? DataStream.endianness : endianness); this.position += length * 4; return arr; } @@ -1705,7 +1705,7 @@ export class DataStream { mapInt16Array(length: number, endianness: boolean) { this._realloc(length * 2); const arr = new Int16Array(this._buffer, this.byteOffset + this.position, length); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += length * 2; return arr; } @@ -1720,7 +1720,7 @@ export class DataStream { * @return Int8Array to the DataStream backing buffer. * @bundle DataStream-map.js */ - mapInt8Array(length: number, endianness?: boolean) { + mapInt8Array(length: number, _endianness?: boolean) { this._realloc(length * 1); const arr = new Int8Array(this._buffer, this.byteOffset + this.position, length); this.position += length * 1; @@ -1743,7 +1743,7 @@ export class DataStream { mapUint32Array(length: number, endianness?: boolean) { this._realloc(length * 4); const arr = new Uint32Array(this._buffer, this.byteOffset + this.position, length); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += length * 4; return arr; } @@ -1764,7 +1764,7 @@ export class DataStream { mapUint16Array(length: number, endianness?: boolean) { this._realloc(length * 2); const arr = new Uint16Array(this._buffer, this.byteOffset + this.position, length); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += length * 2; return arr; } @@ -1785,7 +1785,7 @@ export class DataStream { mapFloat64Array(length: number, endianness?: boolean) { this._realloc(length * 8); const arr = new Float64Array(this._buffer, this.byteOffset + this.position, length); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += length * 8; return arr; } @@ -1806,7 +1806,7 @@ export class DataStream { mapFloat32Array(length: number, endianness?: boolean) { this._realloc(length * 4); const arr = new Float32Array(this._buffer, this.byteOffset + this.position, length); - DataStream.arrayToNative(arr, endianness == null ? this.endianness : endianness); + DataStream.arrayToNative(arr, endianness === null ? this.endianness : endianness); this.position += length * 4; return arr; } diff --git a/src/box-diff.ts b/src/box-diff.ts index 628d3648..950800ac 100644 --- a/src/box-diff.ts +++ b/src/box-diff.ts @@ -37,10 +37,8 @@ export function boxEqualFields(box_a: Box, box_b: Box) { if (box_a && !box_b) return false; let prop: string; for (prop in box_a) { - if (DIFF_BOXES_PROP_NAMES.indexOf(prop as any) > -1) { + if (DIFF_BOXES_PROP_NAMES.find(name => name === prop)) { continue; - // } else if (excluded_fields && excluded_fields.indexOf(prop) > -1) { - // continue; } else if (box_a[prop] instanceof Box || box_b[prop] instanceof Box) { continue; } else if (typeof box_a[prop] === 'undefined' || typeof box_b[prop] === 'undefined') { @@ -63,7 +61,7 @@ export function boxEqualFields(box_a: Box, box_b: Box) { prop === 'modification_time' ) { continue; - } else if (DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(prop as any) > -1) { + } else if (DIFF_PRIMITIVE_ARRAY_PROP_NAMES.find(name => name === prop)) { continue; } else { if (box_a[prop] !== box_b[prop]) { @@ -80,7 +78,7 @@ export function boxEqual(box_a: Box, box_b: Box) { return false; } for (let j = 0; j < DIFF_BOXES_PROP_NAMES.length; j++) { - let name = DIFF_BOXES_PROP_NAMES[j]; + const name = DIFF_BOXES_PROP_NAMES[j]; if (box_a[name] && box_b[name]) { if (!boxEqual(box_a[name], box_b[name])) { return false; diff --git a/src/box.ts b/src/box.ts index 2fbc58cd..21c15685 100644 --- a/src/box.ts +++ b/src/box.ts @@ -127,7 +127,7 @@ export class Box { /** @bundle box-parse.js */ parse(stream: MultiBufferStream) { - if (this.type != 'mdat') { + if (this.type !== 'mdat') { this.data = stream.readUint8Array(this.size - this.hdr_size); } else { if (this.size === 0) { @@ -209,7 +209,7 @@ export class FullBox extends Box { } export class ContainerBox extends Box { - subBoxNames?: readonly string[]; + subBoxNames?: ReadonlyArray; /** @bundle box-write.js */ write(stream: MultiBufferStream) { @@ -231,7 +231,7 @@ export class ContainerBox extends Box { this.printHeader(output); for (let i = 0; i < this.boxes.length; i++) { if (this.boxes[i]) { - let prev_indent = output.indent; + const prev_indent = output.indent; output.indent += ' '; this.boxes[i].print(output); output.indent = prev_indent; @@ -251,10 +251,10 @@ export class ContainerBox extends Box { } /* store the box in the 'boxes' array to preserve box order (for offset) but also store box in a property for more direct access */ this.boxes.push(box); - if (this.subBoxNames && this.subBoxNames.indexOf(box.type) != -1) { + if (this.subBoxNames && this.subBoxNames.indexOf(box.type) !== -1) { this[this.subBoxNames[this.subBoxNames.indexOf(box.type)] + 's'].push(box); } else { - let box_type = box.type !== 'uuid' ? box.type : box.uuid; + const box_type = box.type !== 'uuid' ? box.type : box.uuid; if (this[box_type]) { Log.warn( 'ContainerBox', @@ -394,7 +394,7 @@ export function parseUUID(stream: MultiBufferStream | MP4BoxStream) { export function parseHex16(stream: MultiBufferStream | MP4BoxStream) { let hex16 = ''; for (let i = 0; i < 16; i++) { - let hex = stream.readUint8().toString(16); + const hex = stream.readUint8().toString(16); hex16 += hex.length === 1 ? '0' + hex : hex; } return hex16; @@ -406,9 +406,8 @@ export function parseOneBox( parentSize?: number, ) { let box: Box; - let start = stream.getPosition(); + const start = stream.getPosition(); let hdr_size = 0; - let diff: string | number; let uuid: string; if (stream.getEndPosition() - start < 8) { Log.debug('BoxParser', 'Not enough data in stream to parse the type and size of the box'); @@ -426,7 +425,7 @@ export function parseOneBox( "Found box of type '" + type + "' and size " + size + ' at position ' + start, ); hdr_size = 8; - if (type == 'uuid') { + if (type === 'uuid') { if (stream.getEndPosition() - stream.getPosition() < 16 || parentSize - hdr_size < 16) { stream.seek(start); Log.debug('BoxParser', 'Not enough bytes left in the parent box to parse a UUID box'); @@ -436,7 +435,7 @@ export function parseOneBox( hdr_size += 16; box_type = uuid; } - if (size == 1) { + if (size === 1) { if ( stream.getEndPosition() - stream.getPosition() < 8 || (parentSize && parentSize - hdr_size < 8) @@ -544,7 +543,7 @@ export function parseOneBox( } // @ts-expect-error FIXME: figure out stream-types box.parse(stream); - diff = stream.getPosition() - (box.start + box.size); + const diff = stream.getPosition() - (box.start + box.size); if (diff < 0) { Log.warn( 'BoxParser', diff --git a/src/boxes/a1lx.ts b/src/boxes/a1lx.ts index ba70307e..005fef2c 100644 --- a/src/boxes/a1lx.ts +++ b/src/boxes/a1lx.ts @@ -12,7 +12,7 @@ export class a1lxBox extends Box { const FieldLength = ((large_size & 1) + 1) * 16; this.layer_size = []; for (let i = 0; i < 3; i++) { - if (FieldLength == 16) { + if (FieldLength === 16) { this.layer_size[i] = stream.readUint16(); } else { this.layer_size[i] = stream.readUint32(); diff --git a/src/boxes/ccst.ts b/src/boxes/ccst.ts index c2405c7b..f7d2559c 100644 --- a/src/boxes/ccst.ts +++ b/src/boxes/ccst.ts @@ -12,8 +12,8 @@ export class ccstBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); const flags = stream.readUint8(); - this.all_ref_pics_intra = (flags & 0x80) == 0x80; - this.intra_pred_used = (flags & 0x40) == 0x40; + this.all_ref_pics_intra = (flags & 0x80) === 0x80; + this.intra_pred_used = (flags & 0x40) === 0x40; this.max_ref_per_pic = (flags & 0x3f) >> 2; stream.readUint24(); } diff --git a/src/boxes/cmex.ts b/src/boxes/cmex.ts index 0bee2e49..05afcd5e 100644 --- a/src/boxes/cmex.ts +++ b/src/boxes/cmex.ts @@ -26,7 +26,7 @@ export class cmexBox extends Box { this.pos_z = stream.readInt32(); } if (this.flags & 0x8) { - if (this.version == 0) { + if (this.version === 0) { if (this.flags & 0x10) { this.quat_x = stream.readInt32(); this.quat_y = stream.readInt32(); @@ -36,7 +36,7 @@ export class cmexBox extends Box { this.quat_y = stream.readInt16(); this.quat_z = stream.readInt16(); } - } else if (this.version == 1) { + } else if (this.version === 1) { //ViewpointGlobalCoordinateSysRotationStruct rot; } } diff --git a/src/boxes/co64.ts b/src/boxes/co64.ts index 0888dff5..112e3843 100644 --- a/src/boxes/co64.ts +++ b/src/boxes/co64.ts @@ -9,7 +9,7 @@ export class co64Box extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - let entry_count = stream.readUint32(); + const entry_count = stream.readUint32(); this.chunk_offsets = []; if (this.version === 0) { for (let i = 0; i < entry_count; i++) { diff --git a/src/boxes/cslg.ts b/src/boxes/cslg.ts index d04eae20..41f4d0cc 100644 --- a/src/boxes/cslg.ts +++ b/src/boxes/cslg.ts @@ -33,11 +33,13 @@ export class cslgBox extends FullBox { /** @bundle writing/cslg.js */ write(stream: MultiBufferStream) { this.version = 0; - if ((this.compositionToDTSShift > INT32_MAX) || - (this.leastDecodeToDisplayDelta > INT32_MAX) || - (this.greatestDecodeToDisplayDelta > INT32_MAX) || - (this.compositionStartTime > INT32_MAX) || - (this.compositionEndTime > INT32_MAX)) { + if ( + this.compositionToDTSShift > INT32_MAX || + this.leastDecodeToDisplayDelta > INT32_MAX || + this.greatestDecodeToDisplayDelta > INT32_MAX || + this.compositionStartTime > INT32_MAX || + this.compositionEndTime > INT32_MAX + ) { this.version = 1; } this.flags = 0; diff --git a/src/boxes/ctts.ts b/src/boxes/ctts.ts index b8ada965..c1ade417 100644 --- a/src/boxes/ctts.ts +++ b/src/boxes/ctts.ts @@ -12,7 +12,7 @@ export class cttsBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - let entry_count = stream.readUint32(); + const entry_count = stream.readUint32(); this.sample_counts = []; this.sample_offsets = []; if (this.version === 0) { @@ -27,7 +27,7 @@ export class cttsBox extends FullBox { } this.sample_offsets.push(value); } - } else if (this.version == 1) { + } else if (this.version === 1) { for (let i = 0; i < entry_count; i++) { this.sample_counts.push(stream.readUint32()); this.sample_offsets.push(stream.readInt32()); /* signed */ diff --git a/src/boxes/dac3.ts b/src/boxes/dac3.ts index 2e7e15b9..3dfb55c3 100644 --- a/src/boxes/dac3.ts +++ b/src/boxes/dac3.ts @@ -13,9 +13,9 @@ export class dac3Box extends Box { bit_rate_code: number; parse(stream: MultiBufferStream) { - let tmp_byte1 = stream.readUint8(); - let tmp_byte2 = stream.readUint8(); - let tmp_byte3 = stream.readUint8(); + const tmp_byte1 = stream.readUint8(); + const tmp_byte2 = stream.readUint8(); + const tmp_byte3 = stream.readUint8(); this.fscod = tmp_byte1 >> 6; this.bsid = (tmp_byte1 >> 1) & 0x1f; this.bsmod = ((tmp_byte1 & 0x1) << 2) | ((tmp_byte2 >> 6) & 0x3); diff --git a/src/boxes/dec3.ts b/src/boxes/dec3.ts index c97b74cd..8c4c3388 100644 --- a/src/boxes/dec3.ts +++ b/src/boxes/dec3.ts @@ -20,15 +20,15 @@ export class dec3Box extends Box { ind_subs: Array; parse(stream: MultiBufferStream) { - let tmp_16 = stream.readUint16(); + const tmp_16 = stream.readUint16(); this.data_rate = tmp_16 >> 3; this.num_ind_sub = tmp_16 & 0x7; this.ind_subs = []; for (let i = 0; i < this.num_ind_sub + 1; i++) { - let tmp_byte1 = stream.readUint8(); - let tmp_byte2 = stream.readUint8(); - let tmp_byte3 = stream.readUint8(); - let ind_sub: IndSub = { + const tmp_byte1 = stream.readUint8(); + const tmp_byte2 = stream.readUint8(); + const tmp_byte3 = stream.readUint8(); + const ind_sub: IndSub = { fscod: tmp_byte1 >> 6, bsid: (tmp_byte1 >> 1) & 0x1f, bsmod: ((tmp_byte1 & 0x1) << 4) | ((tmp_byte2 >> 4) & 0xf), diff --git a/src/boxes/dfLa.ts b/src/boxes/dfLa.ts index 2164ecf6..a2c385a7 100644 --- a/src/boxes/dfLa.ts +++ b/src/boxes/dfLa.ts @@ -25,10 +25,9 @@ export class dfLaBox extends FullBox { 'RESERVED', ]; - // for (i=0; ; i++) { // to end of box + let flagAndType: number; do { - const flagAndType = stream.readUint8(); - + flagAndType = stream.readUint8(); const type = Math.min(flagAndType & BLOCKTYPE_MASK, knownBlockTypes.length - 1); // if this is a STREAMINFO block, read the true samplerate since this @@ -48,11 +47,7 @@ export class dfLaBox extends FullBox { } boxesFound.push(knownBlockTypes[type]); - - if (!!(flagAndType & LASTMETADATABLOCKFLAG_MASK)) { - break; - } - } while (true); + } while (flagAndType & LASTMETADATABLOCKFLAG_MASK); this.numMetadataBlocks = boxesFound.length + ' (' + boxesFound.join(', ') + ')'; } diff --git a/src/boxes/displays/naluArrays.ts b/src/boxes/displays/naluArrays.ts index d44b032d..fa6413bb 100644 --- a/src/boxes/displays/naluArrays.ts +++ b/src/boxes/displays/naluArrays.ts @@ -7,12 +7,12 @@ export class NALUArrays extends Array { str += ''; for (let i = 0; i < this.length; i++) { - let nalu_array = this[i]; + const nalu_array = this[i]; str += ''; str += "" + nalu_array.completeness + ''; str += "" + nalu_array.nalu_type + ''; for (let j = 0; j < nalu_array.length; j++) { - let nalu = nalu_array[j]; + const nalu = nalu_array[j]; if (j !== 0) str += ''; str += ''; str += nalu.data.reduce(function (str, byte) { diff --git a/src/boxes/displays/parameterSetArray.ts b/src/boxes/displays/parameterSetArray.ts index 871cc910..eaa4facd 100644 --- a/src/boxes/displays/parameterSetArray.ts +++ b/src/boxes/displays/parameterSetArray.ts @@ -7,7 +7,7 @@ export class ParameterSetArray extends Array { str += ''; for (let i = 0; i < this.length; i++) { - let nalu = this[i]; + const nalu = this[i]; str += ''; str += '' + nalu.length + ''; str += ''; diff --git a/src/boxes/displays/pixel.ts b/src/boxes/displays/pixel.ts index e36c9472..f564b13f 100644 --- a/src/boxes/displays/pixel.ts +++ b/src/boxes/displays/pixel.ts @@ -1,5 +1,3 @@ -import type { Nalu, NaluArray } from '@types'; - export class Pixel { constructor( public bad_pixel_row: number, diff --git a/src/boxes/dref.ts b/src/boxes/dref.ts index 14123879..c1191369 100644 --- a/src/boxes/dref.ts +++ b/src/boxes/dref.ts @@ -14,9 +14,9 @@ export class drefBox extends FullBox { this.entries = []; const entry_count = stream.readUint32(); for (let i = 0; i < entry_count; i++) { - let ret = parseOneBox(stream, false, this.size - (stream.getPosition() - this.start)); + const ret = parseOneBox(stream, false, this.size - (stream.getPosition() - this.start)); if (ret.code === OK) { - let box = ret.box; + const box = ret.box; this.entries.push(box); } else { return; diff --git a/src/boxes/elst.ts b/src/boxes/elst.ts index 97b4988b..7cc49e79 100644 --- a/src/boxes/elst.ts +++ b/src/boxes/elst.ts @@ -6,14 +6,14 @@ export class elstBox extends FullBox { type = 'elst' as const; box_name = 'EditListBox'; - entries: Entry[]; + entries: Array; parse(stream: MultiBufferStream) { this.parseFullHeader(stream); this.entries = []; const entry_count = stream.readUint32(); for (let i = 0; i < entry_count; i++) { - let entry: Entry = { + const entry: Entry = { segment_duration: this.version === 1 ? stream.readUint64() : stream.readUint32(), media_time: this.version === 1 ? stream.readInt64() : stream.readInt32(), media_rate_integer: stream.readInt16(), diff --git a/src/boxes/emsg.ts b/src/boxes/emsg.ts index 7c867201..71448fdc 100644 --- a/src/boxes/emsg.ts +++ b/src/boxes/emsg.ts @@ -16,7 +16,7 @@ export class emsgBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - if (this.version == 1) { + if (this.version === 1) { this.timescale = stream.readUint32(); this.presentation_time = stream.readUint64(); this.event_duration = stream.readUint32(); @@ -35,7 +35,7 @@ export class emsgBox extends FullBox { this.size - this.hdr_size - (4 * 4 + (this.scheme_id_uri.length + 1) + (this.value.length + 1)); - if (this.version == 1) { + if (this.version === 1) { message_size -= 4; } this.message_data = stream.readUint8Array(message_size); diff --git a/src/boxes/esds.ts b/src/boxes/esds.ts index 0b380577..be60e7f1 100644 --- a/src/boxes/esds.ts +++ b/src/boxes/esds.ts @@ -12,10 +12,10 @@ export class esdsBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - let esd_data = stream.readUint8Array(this.size - this.hdr_size); + const esd_data = stream.readUint8Array(this.size - this.hdr_size); // NOTE: This used to be `typeof MPEG4DescriptorParser !== 'undefined'` if ('MPEG4DescriptorParser' in DescriptorRegistry) { - let esd_parser = new DescriptorRegistry.MPEG4DescriptorParser(); + const esd_parser = new DescriptorRegistry.MPEG4DescriptorParser(); this.esd = esd_parser.parseOneDescriptor( new DataStream(esd_data.buffer, 0, DataStream.BIG_ENDIAN), ) as ES_Descriptor; diff --git a/src/boxes/iloc.ts b/src/boxes/iloc.ts index 549b7aa1..828dd9cd 100644 --- a/src/boxes/iloc.ts +++ b/src/boxes/iloc.ts @@ -20,7 +20,7 @@ export class ilocBox extends FullBox { construction_method: number; item_ID: number; data_reference_index: number; - extents: Extent[]; + extents: Array; }>; parse(stream: MultiBufferStream) { diff --git a/src/boxes/iref.ts b/src/boxes/iref.ts index 4706fc08..26949741 100644 --- a/src/boxes/iref.ts +++ b/src/boxes/iref.ts @@ -34,7 +34,7 @@ export class irefBox extends FullBox { type = 'iref' as const; box_name = 'ItemReferenceBox'; - references: { references: Array; from_item_ID: number; type: string }[]; + references: Array<{ references: Array; from_item_ID: number; type: string }>; version: number; parse(stream: MultiBufferStream) { diff --git a/src/boxes/lhvC.ts b/src/boxes/lhvC.ts index b567b250..5e8da890 100644 --- a/src/boxes/lhvC.ts +++ b/src/boxes/lhvC.ts @@ -28,7 +28,7 @@ export class lhvCBox extends Box { const numOfArrays = stream.readUint8(); for (let i = 0; i < numOfArrays; i++) { - let nalu_array = [] as NaluArray; + const nalu_array = [] as NaluArray; this.nalu_arrays.push(nalu_array); tmp_byte = stream.readUint8(); nalu_array.completeness = (tmp_byte & 0x80) >> 7; diff --git a/src/boxes/mdhd.ts b/src/boxes/mdhd.ts index d5c42048..e83ac8db 100644 --- a/src/boxes/mdhd.ts +++ b/src/boxes/mdhd.ts @@ -12,7 +12,7 @@ export class mdhdBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - if (this.version == 1) { + if (this.version === 1) { this.creation_time = stream.readUint64(); this.modification_time = stream.readUint64(); this.timescale = stream.readUint32(); diff --git a/src/boxes/mehd.ts b/src/boxes/mehd.ts index 2be8490c..fadb8540 100644 --- a/src/boxes/mehd.ts +++ b/src/boxes/mehd.ts @@ -14,7 +14,7 @@ export class mehdBox extends FullBox { Log.warn('BoxParser', 'mehd box incorrectly uses flags set to 1, converting version to 1'); this.version = 1; } - if (this.version == 1) { + if (this.version === 1) { this.fragment_duration = stream.readUint64(); } else { this.fragment_duration = stream.readUint32(); diff --git a/src/boxes/mvhd.ts b/src/boxes/mvhd.ts index f020dbbc..87f45c46 100644 --- a/src/boxes/mvhd.ts +++ b/src/boxes/mvhd.ts @@ -17,7 +17,7 @@ export class mvhdBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - if (this.version == 1) { + if (this.version === 1) { this.creation_time = stream.readUint64(); this.modification_time = stream.readUint64(); this.timescale = stream.readUint32(); diff --git a/src/boxes/sampleentries/sampleentry.ts b/src/boxes/sampleentries/sampleentry.ts index 30dd4f0a..3eaed865 100644 --- a/src/boxes/sampleentries/sampleentry.ts +++ b/src/boxes/sampleentries/sampleentry.ts @@ -124,7 +124,7 @@ class hvcCSampleEntryBase extends VisualSampleEntry { let reversed = 0; for (let i = 0; i < 32; i++) { reversed |= val & 1; - if (i == 31) break; + if (i === 31) break; reversed <<= 1; val >>= 1; } @@ -194,11 +194,9 @@ class vvcCSampleEntryBase extends VisualSampleEntry { if (this.vvcC.general_constraint_info) { const bytes = []; let byte = 0; - // @ts-ignore FIXME: shouldn't it be ptl_frame_only_constraint_flag? - byte |= this.vvcC.ptl_frame_only_constraint << 7; - // @ts-ignore FIXME: shouldn't it be ptl_multilayer_enabled_flag? - byte |= this.vvcC.ptl_multilayer_enabled << 6; - let last_nonzero; + byte |= this.vvcC.ptl_frame_only_constraint_flag << 7; + byte |= this.vvcC.ptl_multilayer_enabled_flag << 6; + let last_nonzero: number | undefined = undefined; for (let i = 0; i < this.vvcC.general_constraint_info.length; ++i) { byte |= (this.vvcC.general_constraint_info[i] >> 2) & 0x3f; bytes.push(byte); @@ -221,7 +219,7 @@ class vvcCSampleEntryBase extends VisualSampleEntry { num_held_bits += 8; while (num_held_bits >= 5) { - let val = (held_bits >> (num_held_bits - 5)) & 0x1f; + const val = (held_bits >> (num_held_bits - 5)) & 0x1f; constraint_string += base32_chars[val]; num_held_bits -= 5; @@ -260,13 +258,13 @@ class vpcCSampleEntryBase extends VisualSampleEntry { vpcC: vpcCBox; vpcCs: Array; getCodec() { - let baseCodec = super.getCodec(); + const baseCodec = super.getCodec(); let level: number | string = this.vpcC.level; - if (level == 0) { + if (level === 0) { level = '00'; } let bitDepth: number | string = this.vpcC.bitDepth; - if (bitDepth == 8) { + if (bitDepth === 8) { bitDepth = '08'; } return `${baseCodec}.0${this.vpcC.profile}.${level}.${bitDepth}`; diff --git a/src/boxes/samplegroups/dtrt.ts b/src/boxes/samplegroups/dtrt.ts index c57f440c..e344491b 100644 --- a/src/boxes/samplegroups/dtrt.ts +++ b/src/boxes/samplegroups/dtrt.ts @@ -3,7 +3,7 @@ import type { MultiBufferStream } from '#/buffer'; import { Log } from '#/log'; export class dtrtSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/samplegroups/mvif.ts b/src/boxes/samplegroups/mvif.ts index b332a033..1757bcea 100644 --- a/src/boxes/samplegroups/mvif.ts +++ b/src/boxes/samplegroups/mvif.ts @@ -3,7 +3,7 @@ import type { MultiBufferStream } from '#/buffer'; import { Log } from '#/log'; export class mvifSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/samplegroups/scif.ts b/src/boxes/samplegroups/scif.ts index 8afa0c86..780ff1f1 100644 --- a/src/boxes/samplegroups/scif.ts +++ b/src/boxes/samplegroups/scif.ts @@ -3,7 +3,7 @@ import type { MultiBufferStream } from '#/buffer'; import { Log } from '#/log'; export class scifSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/samplegroups/scnm.ts b/src/boxes/samplegroups/scnm.ts index a6514809..acb713d3 100644 --- a/src/boxes/samplegroups/scnm.ts +++ b/src/boxes/samplegroups/scnm.ts @@ -3,7 +3,7 @@ import type { MultiBufferStream } from '#/buffer'; import { Log } from '#/log'; export class scnmSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/samplegroups/stsa.ts b/src/boxes/samplegroups/stsa.ts index fef1f839..95c40a45 100644 --- a/src/boxes/samplegroups/stsa.ts +++ b/src/boxes/samplegroups/stsa.ts @@ -3,7 +3,7 @@ import { Log } from '#//log'; import type { MultiBufferStream } from '#/buffer'; export class stsaSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/samplegroups/tsas.ts b/src/boxes/samplegroups/tsas.ts index 913716c3..622233d1 100644 --- a/src/boxes/samplegroups/tsas.ts +++ b/src/boxes/samplegroups/tsas.ts @@ -3,7 +3,7 @@ import { Log } from '#//log'; import type { MultiBufferStream } from '#/buffer'; export class tsasSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/samplegroups/tscl.ts b/src/boxes/samplegroups/tscl.ts index 50c391a9..ae351ff5 100644 --- a/src/boxes/samplegroups/tscl.ts +++ b/src/boxes/samplegroups/tscl.ts @@ -3,7 +3,7 @@ import { Log } from '#//log'; import type { MultiBufferStream } from '#/buffer'; export class tsclSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/samplegroups/vipr.ts b/src/boxes/samplegroups/vipr.ts index 1d3b1fb5..46923e74 100644 --- a/src/boxes/samplegroups/vipr.ts +++ b/src/boxes/samplegroups/vipr.ts @@ -3,7 +3,7 @@ import { Log } from '#//log'; import type { MultiBufferStream } from '#/buffer'; export class viprSampleGroupEntry extends SampleGroupEntry { - parse(stream: MultiBufferStream) { + parse(_stream: MultiBufferStream) { Log.warn('BoxParser', 'Sample Group type: ' + this.grouping_type + ' not fully parsed'); } } diff --git a/src/boxes/sbgp.ts b/src/boxes/sbgp.ts index ad808b6c..7482b0a8 100644 --- a/src/boxes/sbgp.ts +++ b/src/boxes/sbgp.ts @@ -42,7 +42,7 @@ export class sbgpBox extends FullBox { stream.writeUint32(this.grouping_type_parameter); stream.writeUint32(this.entries.length); for (let i = 0; i < this.entries.length; i++) { - let entry = this.entries[i]; + const entry = this.entries[i]; stream.writeInt32(entry.sample_count); stream.writeInt32(entry.group_description_index); } diff --git a/src/boxes/sbpm.ts b/src/boxes/sbpm.ts index d652ab70..e6b1665f 100644 --- a/src/boxes/sbpm.ts +++ b/src/boxes/sbpm.ts @@ -14,7 +14,7 @@ export class sbpmBox extends FullBox { num_bad_pixels: number; bad_rows: Array; bad_columns: Array; - bad_pixels: Pixel[]; + bad_pixels: Array; parse(stream: MultiBufferStream) { this.parseFullHeader(stream); @@ -24,7 +24,7 @@ export class sbpmBox extends FullBox { this.component_index.push(stream.readUint16()); } const flags = stream.readUint8(); - this.correction_applied = 0x80 == (flags & 0x80); + this.correction_applied = 0x80 === (flags & 0x80); this.num_bad_rows = stream.readUint32(); this.num_bad_cols = stream.readUint32(); this.num_bad_pixels = stream.readUint32(); @@ -38,8 +38,8 @@ export class sbpmBox extends FullBox { this.bad_columns.push(stream.readUint32()); } for (let i = 0; i < this.num_bad_pixels; i++) { - let row = stream.readUint32(); - let col = stream.readUint32(); + const row = stream.readUint32(); + const col = stream.readUint32(); this.bad_pixels.push(new Pixel(row, col)); } } diff --git a/src/boxes/sgpd.ts b/src/boxes/sgpd.ts index 8ab4849d..91c111ba 100644 --- a/src/boxes/sgpd.ts +++ b/src/boxes/sgpd.ts @@ -31,7 +31,7 @@ export class sgpdBox extends FullBox { default_length: number; default_group_description_index: number; default_sample_description_index: number; - entries: SampleGroupEntry[]; + entries: Array; used: boolean; parse(stream: MultiBufferStream) { @@ -88,7 +88,7 @@ export class sgpdBox extends FullBox { this.flags = 0; this.size = 12; for (let i = 0; i < this.entries.length; i++) { - let entry = this.entries[i]; + const entry = this.entries[i]; if (this.version === 1) { if (this.default_length === 0) { this.size += 4; @@ -106,7 +106,7 @@ export class sgpdBox extends FullBox { } stream.writeUint32(this.entries.length); for (let i = 0; i < this.entries.length; i++) { - let entry = this.entries[i]; + const entry = this.entries[i]; if (this.version === 1) { if (this.default_length === 0) { stream.writeUint32(entry.description_length); diff --git a/src/boxes/sidx.ts b/src/boxes/sidx.ts index 0c12f0e4..08f7c151 100644 --- a/src/boxes/sidx.ts +++ b/src/boxes/sidx.ts @@ -18,7 +18,7 @@ export class sidxBox extends FullBox { timescale: number; earliest_presentation_time: number; first_offset: number; - references: Reference[]; + references: Array; parse(stream: MultiBufferStream) { this.parseFullHeader(stream); diff --git a/src/boxes/ssix.ts b/src/boxes/ssix.ts index 96e82ff5..ff4b8194 100644 --- a/src/boxes/ssix.ts +++ b/src/boxes/ssix.ts @@ -13,7 +13,7 @@ export class ssixBox extends FullBox { type = 'ssix' as const; box_name = 'CompressedSubsegmentIndexBox'; - subsegments: SubSegment[]; + subsegments: Array; parse(stream: MultiBufferStream) { this.parseFullHeader(stream); @@ -25,7 +25,7 @@ export class ssixBox extends FullBox { subsegment.ranges = []; const range_count = stream.readUint32(); for (let j = 0; j < range_count; j++) { - let range = {} as Range; + const range = {} as Range; subsegment.ranges.push(range); range.level = stream.readUint8(); range.range_size = stream.readUint24(); diff --git a/src/boxes/stco.ts b/src/boxes/stco.ts index c3fe4577..f048327a 100644 --- a/src/boxes/stco.ts +++ b/src/boxes/stco.ts @@ -23,16 +23,16 @@ export class stcoBox extends FullBox { write(stream: MultiBufferStream) { this.version = 0; this.flags = 0; - this.size = 4 + 4 * this.chunk_offsets!.length; + this.size = 4 + 4 * this.chunk_offsets.length; this.writeHeader(stream); - stream.writeUint32(this.chunk_offsets!.length); - stream.writeUint32Array(this.chunk_offsets!); + stream.writeUint32(this.chunk_offsets.length); + stream.writeUint32Array(this.chunk_offsets); } /** @bundle box-unpack.js */ unpack(samples: Array) { - for (let i = 0; i < this.chunk_offsets!.length; i++) { - samples[i].offset = this.chunk_offsets![i]; + for (let i = 0; i < this.chunk_offsets.length; i++) { + samples[i].offset = this.chunk_offsets[i]; } } } diff --git a/src/boxes/stdp.ts b/src/boxes/stdp.ts index 447cf394..7ef4d5cb 100644 --- a/src/boxes/stdp.ts +++ b/src/boxes/stdp.ts @@ -9,7 +9,7 @@ export class stdpBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - let count = (this.size - this.hdr_size) / 2; + const count = (this.size - this.hdr_size) / 2; this.priority = []; for (let i = 0; i < count; i++) { this.priority[i] = stream.readUint16(); diff --git a/src/boxes/stsd.ts b/src/boxes/stsd.ts index eb1726c9..33278155 100644 --- a/src/boxes/stsd.ts +++ b/src/boxes/stsd.ts @@ -18,7 +18,7 @@ export class stsdBox extends FullBox { const entryCount = stream.readUint32(); for (let i = 1; i <= entryCount; i++) { - let ret = parseOneBox(stream, true, this.size - (stream.getPosition() - this.start)); + const ret = parseOneBox(stream, true, this.size - (stream.getPosition() - this.start)); if (ret.code === OK) { let box: SampleEntry; diff --git a/src/boxes/stsh.ts b/src/boxes/stsh.ts index 4cb777d0..a7d4afe6 100644 --- a/src/boxes/stsh.ts +++ b/src/boxes/stsh.ts @@ -10,7 +10,7 @@ export class stshBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - let entry_count = stream.readUint32(); + const entry_count = stream.readUint32(); this.shadowed_sample_numbers = []; this.sync_sample_numbers = []; if (this.version === 0) { diff --git a/src/boxes/stss.ts b/src/boxes/stss.ts index 3c47fee3..4957f7d0 100644 --- a/src/boxes/stss.ts +++ b/src/boxes/stss.ts @@ -9,7 +9,7 @@ export class stssBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - let entry_count = stream.readUint32(); + const entry_count = stream.readUint32(); if (this.version === 0) { this.sample_numbers = []; for (let i = 0; i < entry_count; i++) { diff --git a/src/boxes/subs.ts b/src/boxes/subs.ts index 6fec7daa..16b91847 100644 --- a/src/boxes/subs.ts +++ b/src/boxes/subs.ts @@ -5,14 +5,14 @@ import type { SubSample } from '@types'; interface SampleInfo { size: number; sample_delta: number; - subsamples: SubSample[]; + subsamples: Array; } export class subsBox extends FullBox { type = 'subs' as const; box_name = 'SubSampleInformationBox'; - entries: SampleInfo[]; + entries: Array; parse(stream: MultiBufferStream) { this.parseFullHeader(stream); @@ -29,7 +29,7 @@ export class subsBox extends FullBox { for (let j = 0; j < subsample_count; j++) { const subsample = {} as SubSample; sampleInfo.subsamples.push(subsample); - if (this.version == 1) { + if (this.version === 1) { subsample.size = stream.readUint32(); } else { subsample.size = stream.readUint16(); diff --git a/src/boxes/taic.ts b/src/boxes/taic.ts index 7aa3e3f6..04a60981 100644 --- a/src/boxes/taic.ts +++ b/src/boxes/taic.ts @@ -14,7 +14,7 @@ export class taicBox extends FullBox { this.time_uncertainty = stream.readUint64(); this.clock_resolution = stream.readUint32(); this.clock_drift_rate = stream.readInt32(); - var reserved_byte = stream.readUint8(); + const reserved_byte = stream.readUint8(); this.clock_type = (reserved_byte & 0xc0) >> 6; } } diff --git a/src/boxes/tfdt.ts b/src/boxes/tfdt.ts index 4aabbb44..7a4faddc 100644 --- a/src/boxes/tfdt.ts +++ b/src/boxes/tfdt.ts @@ -9,7 +9,7 @@ export class tfdtBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - if (this.version == 1) { + if (this.version === 1) { this.baseMediaDecodeTime = stream.readUint64(); } else { this.baseMediaDecodeTime = stream.readUint32(); diff --git a/src/boxes/tkhd.ts b/src/boxes/tkhd.ts index 55d0e4d9..52d0f7d4 100644 --- a/src/boxes/tkhd.ts +++ b/src/boxes/tkhd.ts @@ -19,7 +19,7 @@ export class tkhdBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); - if (this.version == 1) { + if (this.version === 1) { this.creation_time = stream.readUint64(); this.modification_time = stream.readUint64(); this.track_id = stream.readUint32(); diff --git a/src/boxes/trep.ts b/src/boxes/trep.ts index ca8fc2b5..f115aa44 100644 --- a/src/boxes/trep.ts +++ b/src/boxes/trep.ts @@ -13,9 +13,9 @@ export class trepBox extends FullBox { this.track_ID = stream.readUint32(); this.boxes = []; while (stream.getPosition() < this.start + this.size) { - let ret = parseOneBox(stream, false, this.size - (stream.getPosition() - this.start)); + const ret = parseOneBox(stream, false, this.size - (stream.getPosition() - this.start)); if (ret.code === OK) { - let box = ret.box; + const box = ret.box; this.boxes.push(box); } else { return; diff --git a/src/boxes/uncC.ts b/src/boxes/uncC.ts index 604f12e9..31dbdf79 100644 --- a/src/boxes/uncC.ts +++ b/src/boxes/uncC.ts @@ -28,9 +28,9 @@ export class uncCBox extends FullBox { parse(stream: MultiBufferStream) { this.parseFullHeader(stream); this.profile = stream.readString(4); - if (this.version == 1) { + if (this.version === 1) { // Nothing - just the profile - } else if (this.version == 0) { + } else if (this.version === 0) { this.component_count = stream.readUint32(); this.component_index = []; this.component_bit_depth_minus_one = []; diff --git a/src/boxes/uuid/index.ts b/src/boxes/uuid/index.ts index f4146cfa..7b8f9f9d 100644 --- a/src/boxes/uuid/index.ts +++ b/src/boxes/uuid/index.ts @@ -64,7 +64,7 @@ export const UUID_BOXES = { uuid = 'd4807ef2ca3946958e5426cb9e46a79f' as const; fragment_count: number; - entries: { absolute_time: number; absolute_duration: number }[]; + entries: Array<{ absolute_time: number; absolute_duration: number }>; parse(stream: MultiBufferStream): void { this.parseFullHeader(stream); diff --git a/src/boxes/vmhd.ts b/src/boxes/vmhd.ts index cfa3002c..f15d43d8 100644 --- a/src/boxes/vmhd.ts +++ b/src/boxes/vmhd.ts @@ -20,7 +20,7 @@ export class vmhdBox extends FullBox { this.flags = 1; this.size = 8; this.writeHeader(stream); - stream.writeUint16(this.graphicsmode!); - stream.writeUint16Array(this.opcolor!); + stream.writeUint16(this.graphicsmode); + stream.writeUint16Array(this.opcolor); } } diff --git a/src/boxes/vvcC.ts b/src/boxes/vvcC.ts index 64836215..0cd530d5 100644 --- a/src/boxes/vvcC.ts +++ b/src/boxes/vvcC.ts @@ -147,7 +147,7 @@ export class vvcCBox extends FullBox { nalu_array.nalu_type = bitReader.extract_bits(5); let numNalus = 1; - if (nalu_array.nalu_type != VVC_NALU_DEC_PARAM && nalu_array.nalu_type != VVC_NALU_OPI) { + if (nalu_array.nalu_type !== VVC_NALU_DEC_PARAM && nalu_array.nalu_type !== VVC_NALU_OPI) { numNalus = stream.readUint16(); } diff --git a/src/buffer.ts b/src/buffer.ts index 5af855e3..dceda729 100644 --- a/src/buffer.ts +++ b/src/buffer.ts @@ -31,7 +31,6 @@ export class MultiBufferStream extends DataStream { bufferIndex: number; constructor(buffer?: MP4BoxBuffer) { - // @ts-ignore FIXME expects byteLength super(new ArrayBuffer(), 0, DataStream.BIG_ENDIAN); // List of ArrayBuffers, with a fileStart property, sorted in fileStart order and non-overlapping this.buffers = []; @@ -95,14 +94,14 @@ export class MultiBufferStream extends DataStream { let i = 0; /* TODO: improve insertion if many buffers */ for (; i < this.buffers.length; i++) { - const b = this.buffers[i]!; + const b = this.buffers[i]; if (ab.fileStart <= b.fileStart) { /* the insertion position is found */ if (ab.fileStart === b.fileStart) { /* The new buffer overlaps with an existing buffer */ if (ab.byteLength > b.byteLength) { /* the new buffer is bigger than the existing one - remove the existing buffer and try again to insert + remove the existing buffer and try again to insert the new buffer to check overlap with the next ones */ this.buffers.splice(i, 1); i--; @@ -136,7 +135,7 @@ export class MultiBufferStream extends DataStream { ')', ); this.buffers.splice(i, 0, ab); - /* if this new buffer is inserted in the first place in the list of the buffer, + /* if this new buffer is inserted in the first place in the list of the buffer, and the DataStream is initialized, make it the buffer used for parsing */ if (i === 0) { this.buffer = ab; @@ -165,7 +164,7 @@ export class MultiBufferStream extends DataStream { 'Appending new buffer (fileStart: ' + ab.fileStart + ' - Length: ' + ab.byteLength + ')', ); this.buffers.push(ab); - /* if this new buffer is inserted in the first place in the list of the buffer, + /* if this new buffer is inserted in the first place in the list of the buffer, and the DataStream is initialized, make it the buffer used for parsing */ if (i === 0) { this.buffer = ab; @@ -325,7 +324,7 @@ export class MultiBufferStream extends DataStream { * @return {Number} The largest file position found in the buffers */ findEndContiguousBuf(inputindex?: number) { - let index = inputindex !== undefined ? inputindex : this.bufferIndex; + const index = inputindex !== undefined ? inputindex : this.bufferIndex; let currentBuf = this.buffers[index]; /* find the end of the contiguous range of data */ if (this.buffers.length > index + 1) { diff --git a/src/descriptor.ts b/src/descriptor.ts index 95ed4acc..7a210265 100644 --- a/src/descriptor.ts +++ b/src/descriptor.ts @@ -27,7 +27,7 @@ export class Descriptor { findDescriptor(tag: number) { for (let i = 0; i < this.descs.length; i++) { - if (this.descs[i].tag == tag) { + if (this.descs[i].tag === tag) { return this.descs[i]; } } @@ -35,16 +35,12 @@ export class Descriptor { } parseOneDescriptor(stream: DataStream): DescriptorKinds { - let hdrSize = 0; let size = 0; const tag = stream.readUint8(); - hdrSize++; let byteRead = stream.readUint8(); - hdrSize++; while (byteRead & 0x80) { size = (size << 7) + (byteRead & 0x7f); byteRead = stream.readUint8(); - hdrSize++; } size = (size << 7) + (byteRead & 0x7f); Log.debug( @@ -66,10 +62,10 @@ export class Descriptor { } parseRemainingDescriptors(stream: DataStream) { - let start = stream.position; + const start = stream.position; while (stream.position < start + this.size) { console.log('this.parseOneDescriptor', this, this.parseOneDescriptor); - let desc = this.parseOneDescriptor?.(stream); + const desc = this.parseOneDescriptor?.(stream); this.descs.push(desc); } } @@ -195,8 +191,6 @@ const descTagToName = { }; export class MPEG4DescriptorParser { - constructor() {} - getDescriptorName(tag: number) { return descTagToName[tag]; } diff --git a/src/isofile.ts b/src/isofile.ts index 156c6e29..46ed768d 100644 --- a/src/isofile.ts +++ b/src/isofile.ts @@ -143,7 +143,7 @@ export interface IsoFileOptions { default_sample_flags?: number; } -export class ISOFile { +export class ISOFile { /** MutiBufferStream object used to parse boxes */ stream: MultiBufferStream; /** Array of all boxes (in order) found in the file */ @@ -256,7 +256,7 @@ export class ISOFile { let index = -1; for (let i = 0; i < this.fragmentedTracks.length; i++) { const fragTrack = this.fragmentedTracks[i]; - if (fragTrack.id == id) { + if (fragTrack.id === id) { index = i; } } @@ -270,7 +270,7 @@ export class ISOFile { user?: TSampleUser, { nbSamples: nb_samples = 1000 }: { nbSamples?: number } = {}, ) { - let trak = this.getTrackById(id); + const trak = this.getTrackById(id); if (trak) { this.extractedTracks.push({ id, @@ -286,8 +286,8 @@ export class ISOFile { unsetExtractionOptions(id: number) { let index = -1; for (let i = 0; i < this.extractedTracks.length; i++) { - let extractTrack = this.extractedTracks[i]; - if (extractTrack.id == id) { + const extractTrack = this.extractedTracks[i]; + if (extractTrack.id === id) { index = i; } } @@ -297,7 +297,7 @@ export class ISOFile { } parse() { - let parseBoxHeadersOnly = false; + const parseBoxHeadersOnly = false; if (this.restoreParsePosition) { if (!this.restoreParsePosition()) { @@ -503,7 +503,7 @@ export class ISOFile { } const _1904 = new Date('1904-01-01T00:00:00Z').getTime(); - const isFragmented = this.moov.mvex != null; + const isFragmented = this.moov.mvex !== null; const movie: Movie = { hasMoov: true, @@ -513,7 +513,7 @@ export class ISOFile { fragment_duration: isFragmented && this.moov.mvex.mehd ? this.moov.mvex.mehd.fragment_duration : undefined, isProgressive: this.isProgressive, - hasIOD: this.moov.iods != null, + hasIOD: this.moov.iods !== null, brands: [this.ftyp.major_brand].concat(this.ftyp.compatible_brands), created: new Date(_1904 + this.moov.mvhd.creation_time * 1000), modified: new Date(_1904 + this.moov.mvhd.modification_time * 1000), @@ -756,7 +756,7 @@ export class ISOFile { } static _sweep(type: BoxKind['type'], result: Array, returnEarly: boolean) { - if (this.type && this.type == type) result.push(this); + if (this.type && this.type === type) result.push(this); for (const box in this.boxes) { if (result.length && returnEarly) return; ISOFile._sweep.call(this.boxes[box], type, result, returnEarly); @@ -824,7 +824,7 @@ export class ISOFile { seekTrack(time: number, useRap: boolean, trak: trakBox) { let rap_seek_sample_num = 0; let seek_sample_num = 0; - let timescale: number = null!; + let timescale: number = null; if (trak.samples.length === 0) { Log.info( @@ -961,7 +961,7 @@ export class ISOFile { createFragment(track_id: number, sampleNumber: number, _stream: DataStream) { const trak = this.getTrackById(track_id); const sample = this.getSample(trak, sampleNumber); - if (sample == null) { + if (sample === null) { this.setNextSeekPositionFromSample(trak.samples[sampleNumber]); return null; } @@ -1120,7 +1120,7 @@ export class ISOFile { } const stss = trak.mdia.minf.stbl.stss; const k = trak.mdia.minf.stbl.boxes.indexOf(stss); - if (k != -1) trak.mdia.minf.stbl.boxes[k] = null; + if (k !== -1) trak.mdia.minf.stbl.boxes[k] = null; } } @@ -1411,7 +1411,7 @@ export class ISOFile { sample.cts = sample.dts; } if (stss) { - if (j == stss.sample_numbers[last_stss_index] - 1) { + if (j === stss.sample_numbers[last_stss_index] - 1) { // sample numbers are 1-based sample.is_sync = true; last_stss_index++; @@ -1420,7 +1420,7 @@ export class ISOFile { sample.degradation_priority = 0; } if (subs) { - if (subs.entries[subs_entry_index].sample_delta + last_subs_sample_index == j + 1) { + if (subs.entries[subs_entry_index].sample_delta + last_subs_sample_index === j + 1) { sample.subsamples = subs.entries[subs_entry_index].subsamples; last_subs_sample_index += subs.entries[subs_entry_index].sample_delta; subs_entry_index++; @@ -1436,7 +1436,7 @@ export class ISOFile { sample.degradation_priority = 0; } if (subs) { - if (subs.entries[subs_entry_index].sample_delta + last_subs_sample_index == j) { + if (subs.entries[subs_entry_index].sample_delta + last_subs_sample_index === j) { sample.subsamples = subs.entries[subs_entry_index].subsamples; last_subs_sample_index += subs.entries[subs_entry_index].sample_delta; } @@ -1470,7 +1470,7 @@ export class ISOFile { while (this.lastMoofIndex < this.moofs.length) { const box = this.moofs[this.lastMoofIndex]; this.lastMoofIndex++; - if (box.type == 'moof') { + if (box.type === 'moof') { const moof = box; for (let i = 0; i < moof.trafs.length; i++) { const traf = moof.trafs[i]; @@ -1502,7 +1502,7 @@ export class ISOFile { ISOFile.initSampleGroups(trak, traf, traf.sbgps, trak.mdia.minf.stbl.sgpds, traf.sgpds); } for (let j = 0; j < traf.truns.length; j++) { - let trun = traf.truns[j]; + const trun = traf.truns[j]; for (let k = 0; k < trun.sample_count; k++) { const description_index = default_sample_description_index - 1; @@ -1663,17 +1663,17 @@ export class ISOFile { this.samplesDataSize + ')', ); - } else if (sample.alreadyRead == sample.size) { + } else if (sample.alreadyRead === sample.size) { /* Already fetched entirely */ return sample; } /* The sample has only been partially fetched, we need to check in all buffers */ while (true) { - let index = this.stream.findPosition(true, sample.offset + sample.alreadyRead, false); + const index = this.stream.findPosition(true, sample.offset + sample.alreadyRead, false); if (index > -1) { const buffer = this.stream.buffers[index]; - let lengthAfterStart = + const lengthAfterStart = buffer.byteLength - (sample.offset + sample.alreadyRead - buffer.fileStart); if (sample.size - sample.alreadyRead <= lengthAfterStart) { /* the (rest of the) sample is entirely contained in this buffer */ @@ -1799,7 +1799,7 @@ export class ISOFile { if (!this.moov || !this.moov.mvex) return null; for (let i = 0; i < this.moov.mvex.trexs.length; i++) { const trex = this.moov.mvex.trexs[i]; - if (trex.track_id == id) return trex; + if (trex.track_id === id) return trex; } return null; } @@ -1814,8 +1814,8 @@ export class ISOFile { return null; } for (let j = 0; j < this.moov.traks.length; j++) { - let trak = this.moov.traks[j]; - if (trak.tkhd.track_id == id) return trak; + const trak = this.moov.traks[j]; + if (trak.tkhd.track_id === id) return trak; } return null; } @@ -1881,7 +1881,7 @@ export class ISOFile { length: itemloc.extents[j].extent_length, alreadyRead: 0, }; - if (itemloc.construction_method == 1) { + if (itemloc.construction_method === 1) { item.extents[j].offset += meta.idat.start + meta.idat.hdr_size; } item.size += item.extents[j].length; @@ -1893,7 +1893,7 @@ export class ISOFile { } if (meta.iref) { for (let i = 0; i < meta.iref.references.length; i++) { - let ref = meta.iref.references[i]; + const ref = meta.iref.references[i]; for (let j = 0; j < ref.references.length; j++) { items[ref.from_item_ID].ref_to.push({ type: ref.type, id: ref.references[j] }); } @@ -1901,9 +1901,9 @@ export class ISOFile { } if (meta.iprp) { for (let k = 0; k < meta.iprp.ipmas.length; k++) { - let ipma = meta.iprp.ipmas[k]; + const ipma = meta.iprp.ipmas[k]; for (let i = 0; i < ipma.associations.length; i++) { - let association = ipma.associations[i]; + const association = ipma.associations[i]; const item = items[association.id] ?? entity_groups[association.id]; if (item) { if (item.properties === undefined) { @@ -1912,12 +1912,12 @@ export class ISOFile { }; } for (let j = 0; j < association.props.length; j++) { - let propEntry = association.props[j]; + const propEntry = association.props[j]; if ( propEntry.property_index > 0 && propEntry.property_index - 1 < meta.iprp.ipco.boxes.length ) { - let propbox = meta.iprp.ipco.boxes[propEntry.property_index - 1]; + const propbox = meta.iprp.ipco.boxes[propEntry.property_index - 1]; item.properties[propbox.type] = propbox; item.properties.boxes.push(propbox); } @@ -2078,7 +2078,7 @@ export class ISOFile { /** @bundle isofile-item-processing.js */ processItems(callback: (item: Item) => void) { - for (let i in this.items) { + for (const i in this.items) { const item = this.items[i]; this.getItem(item.id); if (callback && !item.sent) { @@ -2091,7 +2091,7 @@ export class ISOFile { /** @bundle isofile-item-processing.js */ hasItem(name: string) { - for (let i in this.items) { + for (const i in this.items) { const item = this.items[i]; if (item.name === name) { return item.id; @@ -2126,7 +2126,7 @@ export class ISOFile { } else { item = this.getPrimaryItem(); } - if (item == null) return null; + if (item === null) return null; const file = new ISOFile(); file.discardMdatData = false; @@ -2180,7 +2180,7 @@ export class ISOFile { if (ret.type === 'mdat') { /* we had enough bytes to get its type and size and it's an 'mdat' */ - /* special handling for mdat boxes, since we don't actually need to parse it linearly + /* special handling for mdat boxes, since we don't actually need to parse it linearly we create the box */ const box = new mdatBox(ret.size); this.parsingMdat = box; @@ -2193,7 +2193,7 @@ export class ISOFile { /* indicate that the parsing should start from the end of the box */ this.lastBoxStartPosition = box.start + box.size; /* let's see if we have the end of the box in the other buffers */ - let found = this.stream.seek(box.start + box.size, false, this.discardMdatData); + const found = this.stream.seek(box.start + box.size, false, this.discardMdatData); if (found) { /* found the end of the box */ this.parsingMdat = null; @@ -2203,12 +2203,12 @@ export class ISOFile { /* 'mdat' end not found in the existing buffers */ /* determine the next position in the file to start parsing from */ if (!this.moovStartFound) { - /* moov not find yet, - the file probably has 'mdat' at the beginning, and 'moov' at the end, + /* moov not find yet, + the file probably has 'mdat' at the beginning, and 'moov' at the end, indicate that the downloader should not try to download those bytes now */ this.nextParsePosition = box.start + box.size; } else { - /* we have the start of the moov box, + /* we have the start of the moov box, the next bytes should try to complete the current 'mdat' */ this.nextParsePosition = this.stream.findEndContiguousBuf(); } @@ -2226,12 +2226,12 @@ export class ISOFile { } /* either it's not an mdat box (and we need to parse it, we cannot skip it) (TODO: we could skip 'free' boxes ...) - or we did not have enough data to parse the type and size of the box, + or we did not have enough data to parse the type and size of the box, we try to concatenate the current buffer with the next buffer to restart parsing */ - let merged = this.stream.mergeNextBuffer ? this.stream.mergeNextBuffer() : false; + const merged = this.stream.mergeNextBuffer ? this.stream.mergeNextBuffer() : false; if (merged) { /* The next buffer was contiguous, the merging succeeded, - we can now continue parsing, + we can now continue parsing, the next best position to parse is at the end of this new buffer */ this.nextParsePosition = this.stream.getEndPosition(); return true; @@ -2244,7 +2244,7 @@ export class ISOFile { this.nextParsePosition = this.stream.getEndPosition(); } else { /* we had enough bytes to parse size and type of the incomplete box - if we haven't found yet the moov box, skip this one and try the next one + if we haven't found yet the moov box, skip this one and try the next one if we have found the moov box, let's continue linear parsing */ if (this.moovStartFound) { this.nextParsePosition = this.stream.getEndPosition(); @@ -2274,8 +2274,8 @@ export class ISOFile { /* we can parse more in this buffer */ return true; } else { - /* we don't have the end of this mdat yet, - indicate that the next byte to fetch is the end of the buffers we have so far, + /* we don't have the end of this mdat yet, + indicate that the next byte to fetch is the end of the buffers we have so far, return and wait for more buffer to come */ this.nextParsePosition = this.stream.findEndContiguousBuf(); return false; @@ -2295,7 +2295,7 @@ export class ISOFile { } /** @bundle isofile-advanced-parsing.js */ - updateUsedBytes(box: Box, ret: ReturnType) { + updateUsedBytes(box: Box, _ret: ReturnType) { if (this.stream.addUsedBytes) { if (box.type === 'mdat') { /* for an mdat box, only its header is considered used, other bytes will be used when sample data is requested */ @@ -2395,7 +2395,6 @@ export class ISOFile { vmhd.graphicsmode = 0; vmhd.opcolor = [0, 0, 0]; - sample_description_entry; (sample_description_entry as VisualSampleEntry).width = options.width; (sample_description_entry as VisualSampleEntry).height = options.height; (sample_description_entry as VisualSampleEntry).horizresolution = 0x48 << 16; @@ -2507,11 +2506,11 @@ export class ISOFile { is_depended_on?: number; has_redundancy?: number; degradation_priority?: number; - subsamples?: SubSample[]; + subsamples?: Array; offset?: number; } = {}, ) { - let trak = this.getTrackById(track_id); + const trak = this.getTrackById(track_id); if (trak === null) return; const descriptionIndex = sample_description_index ? sample_description_index - 1 : 0; diff --git a/src/log.ts b/src/log.ts index 33c51063..3807fab6 100644 --- a/src/log.ts +++ b/src/log.ts @@ -11,15 +11,15 @@ const LOG_LEVEL_DEBUG = 1; let log_level = LOG_LEVEL_ERROR; -export class Log { - static setLogLevel(level: { (module: string, msg?: string): void }) { - if (level == this.debug) log_level = LOG_LEVEL_DEBUG; - else if (level == this.info) log_level = LOG_LEVEL_INFO; - else if (level == this.warn) log_level = LOG_LEVEL_WARNING; - else if (level == this.error) log_level = LOG_LEVEL_ERROR; +export const Log = { + setLogLevel(level: (module: string, msg?: string) => void) { + if (level === this.debug) log_level = LOG_LEVEL_DEBUG; + else if (level === this.info) log_level = LOG_LEVEL_INFO; + else if (level === this.warn) log_level = LOG_LEVEL_WARNING; + else if (level === this.error) log_level = LOG_LEVEL_ERROR; else log_level = LOG_LEVEL_ERROR; - } - static debug(module: string, msg?: string) { + }, + debug(module: string, msg?: string) { if (console.debug === undefined) { console.debug = console.log; } @@ -30,11 +30,11 @@ export class Log { msg, ); } - } - static log(module: { msg: string }, msg?: string) { + }, + log(module: { msg: string }, _msg?: string) { this.debug(module.msg); - } - static info(module: string, msg?: string) { + }, + info(module: string, msg?: string) { if (LOG_LEVEL_INFO >= log_level) { console.info( '[' + Log.getDurationString(new Date().getTime() - start.getTime(), 1000) + ']', @@ -42,8 +42,8 @@ export class Log { msg, ); } - } - static warn(module: string, msg?: string) { + }, + warn(module: string, msg?: string) { if (LOG_LEVEL_WARNING >= log_level) { console.warn( '[' + Log.getDurationString(new Date().getTime() - start.getTime(), 1000) + ']', @@ -51,8 +51,8 @@ export class Log { msg, ); } - } - static error(module: string, msg?: string) { + }, + error(module: string, msg?: string) { if (LOG_LEVEL_ERROR >= log_level) { console.error( '[' + Log.getDurationString(new Date().getTime() - start.getTime(), 1000) + ']', @@ -60,9 +60,9 @@ export class Log { msg, ); } - } + }, /* Helper function to print a duration value in the form H:MM:SS.MS */ - static getDurationString(duration: number, _timescale?: number) { + getDurationString(duration: number, _timescale?: number) { let neg: boolean; /* Helper function to print a number on a fixed number of digits */ function pad(number: string | number, length: number) { @@ -99,12 +99,12 @@ export class Log { '.' + pad(msec, 3) ); - } + }, /* Helper function to stringify HTML5 TimeRanges objects */ - static printRanges(ranges: { + printRanges(ranges: { length: number; - start: (index: number) => any; - end: (index: number) => any; + start: (index: number) => number; + end: (index: number) => number; }) { const length = ranges.length; if (length > 0) { @@ -122,5 +122,5 @@ export class Log { } else { return '(empty)'; } - } -} + }, +}; diff --git a/src/registry.ts b/src/registry.ts index 8a17a43c..9ca976b7 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -1,4 +1,4 @@ -import type { MP4Box } from '@types'; +import type * as MP4Box from '@types'; export const BoxRegistry = {} as MP4Box.BoxRegistry; export function registerBoxes(registry: T) { diff --git a/src/text-mp4.ts b/src/text-mp4.ts index 98a4b2d9..fbcdac90 100644 --- a/src/text-mp4.ts +++ b/src/text-mp4.ts @@ -9,7 +9,7 @@ import type { Sample, TypedArray } from '@types'; */ export class VTTin4Parser { parseSample(data: TypedArray) { - const cues: Box[] = []; + const cues: Array = []; const stream = new MP4BoxStream(data.buffer); while (!stream.isEos()) { @@ -39,7 +39,7 @@ export class VTTin4Parser { const cues = this.parseSample(data); let string = ''; for (let i = 0; i < cues.length; i++) { - let cueIn4 = cues[i]; + const cueIn4 = cues[i]; string += secToTimestamp(startTime) + ' --> ' + secToTimestamp(endTime) + '\r\n'; // @ts-expect-error FIXME: which box should get a payl-property? string += cueIn4.payl.text; @@ -75,17 +75,15 @@ export class XMLSubtitlein4Parser { export class Textin4Parser { parseSample(sample: Sample) { - let textString: string; - let stream = new MP4BoxStream(sample.data.buffer); - textString = stream.readString(sample.data.length); + const stream = new MP4BoxStream(sample.data.buffer); + const textString = stream.readString(sample.data.length); return textString; } parseConfig(data: TypedArray) { - let textString: string; - let stream = new MP4BoxStream(data.buffer); + const stream = new MP4BoxStream(data.buffer); stream.readUint32(); // version & flags - textString = stream.readCString(); + const textString = stream.readCString(); return textString; } } diff --git a/tsup.config.ts b/tsup.config.ts index f6313419..8d870ede 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -30,7 +30,7 @@ const regularBuild = defineConfig({ dts: true, }); -let build: Array = []; +const build: Array = []; if (PUBLISH_TO_NPM) { build.push(regularBuild); } else {