mirror of
https://github.com/denoland/deno.git
synced 2024-11-27 16:10:57 -05:00
c73ef5fa14
This commit removes all JS based text encoding / text decoding. Instead encoding now happens in Rust via encoding_rs (already in tree). This implementation retains stream support, but adds the last missing encodings. We are incredibly close to 100% WPT on text encoding now. This should reduce our baseline heap by quite a bit.
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
/// <reference no-default-lib="true" />
|
|
/// <reference lib="esnext" />
|
|
|
|
declare namespace globalThis {
|
|
declare var TextEncoder: typeof TextEncoder;
|
|
declare var TextDecoder: typeof TextDecoder;
|
|
|
|
declare namespace __bootstrap {
|
|
declare var infra: {
|
|
collectSequenceOfCodepoints(
|
|
input: string,
|
|
position: number,
|
|
condition: (char: string) => boolean,
|
|
): {
|
|
result: string;
|
|
position: number;
|
|
};
|
|
ASCII_DIGIT: string[];
|
|
ASCII_UPPER_ALPHA: string[];
|
|
ASCII_LOWER_ALPHA: string[];
|
|
ASCII_ALPHA: string[];
|
|
ASCII_ALPHANUMERIC: string[];
|
|
HTTP_TAB_OR_SPACE: string[];
|
|
HTTP_WHITESPACE: string[];
|
|
HTTP_TOKEN_CODE_POINT: string[];
|
|
HTTP_TOKEN_CODE_POINT_RE: RegExp;
|
|
HTTP_QUOTED_STRING_TOKEN_POINT: string[];
|
|
HTTP_QUOTED_STRING_TOKEN_POINT_RE: RegExp;
|
|
HTTP_TAB_OR_SPACE_PREFIX_RE: RegExp;
|
|
HTTP_TAB_OR_SPACE_SUFFIX_RE: RegExp;
|
|
HTTP_WHITESPACE_PREFIX_RE: RegExp;
|
|
HTTP_WHITESPACE_SUFFIX_RE: RegExp;
|
|
regexMatcher(chars: string[]): string;
|
|
byteUpperCase(s: string): string;
|
|
byteLowerCase(s: string): string;
|
|
collectHttpQuotedString(
|
|
input: string,
|
|
position: number,
|
|
extractValue: boolean,
|
|
): {
|
|
result: string;
|
|
position: number;
|
|
};
|
|
forgivingBase64Encode(data: Uint8Array): string;
|
|
forgivingBase64Decode(data: string): Uint8Array;
|
|
};
|
|
|
|
declare namespace mimesniff {
|
|
declare interface MimeType {
|
|
type: string;
|
|
subtype: string;
|
|
parameters: Map<string, string>;
|
|
}
|
|
declare function parseMimeType(input: string): MimeType | null;
|
|
declare function essence(mimeType: MimeType): string;
|
|
declare function serializeMimeType(mimeType: MimeType): string;
|
|
}
|
|
|
|
declare var eventTarget: {
|
|
EventTarget: typeof EventTarget;
|
|
};
|
|
|
|
declare var location: {
|
|
getLocationHref(): string | undefined;
|
|
};
|
|
|
|
declare var base64: {
|
|
atob(data: string): string;
|
|
btoa(data: string): string;
|
|
};
|
|
}
|
|
}
|