Replace typescript compiler with native tsgo compiler

This commit is contained in:
Jamie
2026-03-18 11:26:18 -07:00
committed by GitHub
parent 5e6af4708b
commit c90ca2b4e0
207 changed files with 1819 additions and 1270 deletions

View File

@@ -16,7 +16,9 @@ import {
*
* [0]: https://mimesniff.spec.whatwg.org/#matching-an-image-type-pattern
*/
export function sniffImageMimeType(bytes: Uint8Array): undefined | MIMEType {
export function sniffImageMimeType(
bytes: Uint8Array<ArrayBuffer>
): undefined | MIMEType {
for (const type of TYPES) {
if (matchesType(bytes, type)) {
return type.mimeType;
@@ -27,8 +29,8 @@ export function sniffImageMimeType(bytes: Uint8Array): undefined | MIMEType {
type Type = {
mimeType: MIMEType;
bytePattern: Uint8Array;
patternMask?: Uint8Array;
bytePattern: Uint8Array<ArrayBuffer>;
patternMask?: Uint8Array<ArrayBuffer>;
};
const TYPES: Array<Type> = [
{
@@ -76,7 +78,7 @@ const TYPES: Array<Type> = [
// This follows the [pattern matching algorithm in the spec][1].
// [1]: https://mimesniff.spec.whatwg.org/#pattern-matching-algorithm
function matchesType(input: Uint8Array, type: Type): boolean {
function matchesType(input: Uint8Array<ArrayBuffer>, type: Type): boolean {
if (input.byteLength < type.bytePattern.byteLength) {
return false;
}