mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
Remove __blob and __console namespaces (#4677)
This commit is contained in:
parent
491b8e1cea
commit
dd2d19b22d
1 changed files with 96 additions and 143 deletions
125
cli/js/lib.deno.shared_globals.d.ts
vendored
125
cli/js/lib.deno.shared_globals.d.ts
vendored
|
@ -15,8 +15,6 @@ declare interface WindowOrWorkerGlobalScope {
|
||||||
// methods
|
// methods
|
||||||
fetch: typeof __fetch.fetch;
|
fetch: typeof __fetch.fetch;
|
||||||
// properties
|
// properties
|
||||||
console: __console.Console;
|
|
||||||
Blob: typeof __blob.DenoBlob;
|
|
||||||
File: __domTypes.DomFileConstructor;
|
File: __domTypes.DomFileConstructor;
|
||||||
CustomEvent: typeof __customEvent.CustomEvent;
|
CustomEvent: typeof __customEvent.CustomEvent;
|
||||||
Event: typeof __event.Event;
|
Event: typeof __event.Event;
|
||||||
|
@ -27,18 +25,6 @@ declare interface WindowOrWorkerGlobalScope {
|
||||||
Request: __domTypes.RequestConstructor;
|
Request: __domTypes.RequestConstructor;
|
||||||
Response: typeof __fetch.Response;
|
Response: typeof __fetch.Response;
|
||||||
location: __domTypes.Location;
|
location: __domTypes.Location;
|
||||||
|
|
||||||
addEventListener: (
|
|
||||||
type: string,
|
|
||||||
callback: __domTypes.EventListenerOrEventListenerObject | null,
|
|
||||||
options?: boolean | __domTypes.AddEventListenerOptions | undefined
|
|
||||||
) => void;
|
|
||||||
dispatchEvent: (event: __domTypes.Event) => boolean;
|
|
||||||
removeEventListener: (
|
|
||||||
type: string,
|
|
||||||
callback: __domTypes.EventListenerOrEventListenerObject | null,
|
|
||||||
options?: boolean | __domTypes.EventListenerOptions | undefined
|
|
||||||
) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This follows the WebIDL at: https://webassembly.github.io/spec/js-api/
|
// This follows the WebIDL at: https://webassembly.github.io/spec/js-api/
|
||||||
|
@ -54,7 +40,7 @@ declare namespace WebAssembly {
|
||||||
* function is useful if it is necessary to a compile a module before it can
|
* function is useful if it is necessary to a compile a module before it can
|
||||||
* be instantiated (otherwise, the `WebAssembly.instantiate()` function
|
* be instantiated (otherwise, the `WebAssembly.instantiate()` function
|
||||||
* should be used). */
|
* should be used). */
|
||||||
function compile(bufferSource: __domTypes.BufferSource): Promise<Module>;
|
function compile(bufferSource: BufferSource): Promise<Module>;
|
||||||
|
|
||||||
/** Compiles a `WebAssembly.Module` directly from a streamed underlying
|
/** Compiles a `WebAssembly.Module` directly from a streamed underlying
|
||||||
* source. This function is useful if it is necessary to a compile a module
|
* source. This function is useful if it is necessary to a compile a module
|
||||||
|
@ -69,7 +55,7 @@ declare namespace WebAssembly {
|
||||||
* The returned `Promise` resolves to both a compiled `WebAssembly.Module` and
|
* The returned `Promise` resolves to both a compiled `WebAssembly.Module` and
|
||||||
* its first `WebAssembly.Instance`. */
|
* its first `WebAssembly.Instance`. */
|
||||||
function instantiate(
|
function instantiate(
|
||||||
bufferSource: __domTypes.BufferSource,
|
bufferSource: BufferSource,
|
||||||
importObject?: object
|
importObject?: object
|
||||||
): Promise<WebAssemblyInstantiatedSource>;
|
): Promise<WebAssemblyInstantiatedSource>;
|
||||||
|
|
||||||
|
@ -91,7 +77,7 @@ declare namespace WebAssembly {
|
||||||
|
|
||||||
/** Validates a given typed array of WebAssembly binary code, returning
|
/** Validates a given typed array of WebAssembly binary code, returning
|
||||||
* whether the bytes form a valid wasm module (`true`) or not (`false`). */
|
* whether the bytes form a valid wasm module (`true`) or not (`false`). */
|
||||||
function validate(bufferSource: __domTypes.BufferSource): boolean;
|
function validate(bufferSource: BufferSource): boolean;
|
||||||
|
|
||||||
type ImportExportKind = "function" | "table" | "memory" | "global";
|
type ImportExportKind = "function" | "table" | "memory" | "global";
|
||||||
|
|
||||||
|
@ -106,7 +92,7 @@ declare namespace WebAssembly {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Module {
|
class Module {
|
||||||
constructor(bufferSource: __domTypes.BufferSource);
|
constructor(bufferSource: BufferSource);
|
||||||
|
|
||||||
/** Given a `Module` and string, returns a copy of the contents of all
|
/** Given a `Module` and string, returns a copy of the contents of all
|
||||||
* custom sections in the module with the given string name. */
|
* custom sections in the module with the given string name. */
|
||||||
|
@ -231,8 +217,7 @@ declare function clearTimeout(id?: number): void;
|
||||||
declare function clearInterval(id?: number): void;
|
declare function clearInterval(id?: number): void;
|
||||||
declare function queueMicrotask(func: Function): void;
|
declare function queueMicrotask(func: Function): void;
|
||||||
|
|
||||||
declare const console: __console.Console;
|
declare const console: Console;
|
||||||
declare const Blob: typeof __blob.DenoBlob;
|
|
||||||
declare const File: __domTypes.DomFileConstructor;
|
declare const File: __domTypes.DomFileConstructor;
|
||||||
declare const CustomEventInit: typeof __customEvent.CustomEventInit;
|
declare const CustomEventInit: typeof __customEvent.CustomEventInit;
|
||||||
declare const CustomEvent: typeof __customEvent.CustomEvent;
|
declare const CustomEvent: typeof __customEvent.CustomEvent;
|
||||||
|
@ -247,19 +232,20 @@ declare const ReadableStream: __domTypes.ReadableStreamConstructor;
|
||||||
declare const Request: __domTypes.RequestConstructor;
|
declare const Request: __domTypes.RequestConstructor;
|
||||||
declare const Response: typeof __fetch.Response;
|
declare const Response: typeof __fetch.Response;
|
||||||
|
|
||||||
declare const addEventListener: (
|
declare function addEventListener(
|
||||||
type: string,
|
type: string,
|
||||||
callback: __domTypes.EventListenerOrEventListenerObject | null,
|
callback: __domTypes.EventListenerOrEventListenerObject | null,
|
||||||
options?: boolean | __domTypes.AddEventListenerOptions | undefined
|
options?: boolean | __domTypes.AddEventListenerOptions | undefined
|
||||||
) => void;
|
): void;
|
||||||
declare const dispatchEvent: (event: __domTypes.Event) => boolean;
|
|
||||||
declare const removeEventListener: (
|
declare function dispatchEvent(event: __domTypes.Event): boolean;
|
||||||
|
|
||||||
|
declare function removeEventListener(
|
||||||
type: string,
|
type: string,
|
||||||
callback: __domTypes.EventListenerOrEventListenerObject | null,
|
callback: __domTypes.EventListenerOrEventListenerObject | null,
|
||||||
options?: boolean | __domTypes.EventListenerOptions | undefined
|
options?: boolean | __domTypes.EventListenerOptions | undefined
|
||||||
) => void;
|
): void;
|
||||||
|
|
||||||
declare type Blob = __domTypes.Blob;
|
|
||||||
declare type Body = __domTypes.Body;
|
declare type Body = __domTypes.Body;
|
||||||
declare type File = __domTypes.DomFile;
|
declare type File = __domTypes.DomFile;
|
||||||
declare type CustomEventInit = __domTypes.CustomEventInit;
|
declare type CustomEventInit = __domTypes.CustomEventInit;
|
||||||
|
@ -280,7 +266,6 @@ declare interface ImportMeta {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace __domTypes {
|
declare namespace __domTypes {
|
||||||
export type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
||||||
export type HeadersInit =
|
export type HeadersInit =
|
||||||
| Headers
|
| Headers
|
||||||
| Array<[string, string]>
|
| Array<[string, string]>
|
||||||
|
@ -300,7 +285,6 @@ declare namespace __domTypes {
|
||||||
| "origin-only"
|
| "origin-only"
|
||||||
| "origin-when-cross-origin"
|
| "origin-when-cross-origin"
|
||||||
| "unsafe-url";
|
| "unsafe-url";
|
||||||
export type BlobPart = BufferSource | Blob | string;
|
|
||||||
export type FormDataEntryValue = DomFile | string;
|
export type FormDataEntryValue = DomFile | string;
|
||||||
export interface DomIterable<K, V> {
|
export interface DomIterable<K, V> {
|
||||||
keys(): IterableIterator<K>;
|
keys(): IterableIterator<K>;
|
||||||
|
@ -312,11 +296,6 @@ declare namespace __domTypes {
|
||||||
thisArg?: any
|
thisArg?: any
|
||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
type EndingType = "transparent" | "native";
|
|
||||||
export interface BlobPropertyBag {
|
|
||||||
type?: string;
|
|
||||||
ending?: EndingType;
|
|
||||||
}
|
|
||||||
interface AbortSignalEventMap {
|
interface AbortSignalEventMap {
|
||||||
abort: ProgressEvent;
|
abort: ProgressEvent;
|
||||||
}
|
}
|
||||||
|
@ -578,19 +557,6 @@ declare namespace __domTypes {
|
||||||
new (): FormData;
|
new (): FormData;
|
||||||
prototype: FormData;
|
prototype: FormData;
|
||||||
}
|
}
|
||||||
/** A blob object represents a file-like object of immutable, raw data. */
|
|
||||||
export interface Blob {
|
|
||||||
/** The size, in bytes, of the data contained in the `Blob` object. */
|
|
||||||
readonly size: number;
|
|
||||||
/** A string indicating the media type of the data contained in the `Blob`.
|
|
||||||
* If the type is unknown, this string is empty.
|
|
||||||
*/
|
|
||||||
readonly type: string;
|
|
||||||
/** Returns a new `Blob` object containing the data in the specified range of
|
|
||||||
* bytes of the source `Blob`.
|
|
||||||
*/
|
|
||||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
||||||
}
|
|
||||||
export interface Body {
|
export interface Body {
|
||||||
/** A simple getter used to expose a `ReadableStream` of the body contents. */
|
/** A simple getter used to expose a `ReadableStream` of the body contents. */
|
||||||
readonly body: ReadableStream<Uint8Array> | null;
|
readonly body: ReadableStream<Uint8Array> | null;
|
||||||
|
@ -894,35 +860,32 @@ declare namespace __domTypes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace __blob {
|
type BufferSource = ArrayBufferView | ArrayBuffer;
|
||||||
export class DenoBlob implements __domTypes.Blob {
|
type BlobPart = BufferSource | Blob | string;
|
||||||
readonly size: number;
|
|
||||||
readonly type: string;
|
interface BlobPropertyBag {
|
||||||
/** A blob object represents a file-like object of immutable, raw data. */
|
type?: string;
|
||||||
constructor(
|
ending?: "transparent" | "native";
|
||||||
blobParts?: __domTypes.BlobPart[],
|
|
||||||
options?: __domTypes.BlobPropertyBag
|
|
||||||
);
|
|
||||||
slice(start?: number, end?: number, contentType?: string): DenoBlob;
|
|
||||||
stream(): __domTypes.ReadableStream<Uint8Array>;
|
|
||||||
text(): Promise<string>;
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace __console {
|
/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
|
||||||
type InspectOptions = Partial<{
|
interface Blob {
|
||||||
showHidden: boolean;
|
readonly size: number;
|
||||||
depth: number;
|
readonly type: string;
|
||||||
colors: boolean;
|
arrayBuffer(): Promise<ArrayBuffer>;
|
||||||
indentLevel: number;
|
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||||
}>;
|
stream(): ReadableStream;
|
||||||
export class CSI {
|
text(): Promise<string>;
|
||||||
static kClear: string;
|
}
|
||||||
static kClearScreenDown: string;
|
|
||||||
}
|
declare const Blob: {
|
||||||
const isConsoleInstance: unique symbol;
|
prototype: Blob;
|
||||||
export class Console {
|
new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare const isConsoleInstance: unique symbol;
|
||||||
|
|
||||||
|
declare class Console {
|
||||||
indentLevel: number;
|
indentLevel: number;
|
||||||
[isConsoleInstance]: boolean;
|
[isConsoleInstance]: boolean;
|
||||||
/** Writes the arguments to stdout */
|
/** Writes the arguments to stdout */
|
||||||
|
@ -984,16 +947,6 @@ declare namespace __console {
|
||||||
clear: () => void;
|
clear: () => void;
|
||||||
trace: (...args: unknown[]) => void;
|
trace: (...args: unknown[]) => void;
|
||||||
static [Symbol.hasInstance](instance: Console): boolean;
|
static [Symbol.hasInstance](instance: Console): boolean;
|
||||||
}
|
|
||||||
/** A symbol which can be used as a key for a custom method which will be called
|
|
||||||
* when `Deno.inspect()` is called, or when the object is logged to the console.
|
|
||||||
*/
|
|
||||||
export const customInspect: unique symbol;
|
|
||||||
/**
|
|
||||||
* `inspect()` converts input into string that has the same format
|
|
||||||
* as printed by `console.log(...)`;
|
|
||||||
*/
|
|
||||||
export function inspect(value: unknown, options?: InspectOptions): string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace __event {
|
declare namespace __event {
|
||||||
|
@ -1153,7 +1106,7 @@ declare namespace __fetch {
|
||||||
readonly body: __domTypes.ReadableStream<Uint8Array>;
|
readonly body: __domTypes.ReadableStream<Uint8Array>;
|
||||||
constructor(rid: number, contentType: string);
|
constructor(rid: number, contentType: string);
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
arrayBuffer(): Promise<ArrayBuffer>;
|
||||||
blob(): Promise<__domTypes.Blob>;
|
blob(): Promise<Blob>;
|
||||||
formData(): Promise<__domTypes.FormData>;
|
formData(): Promise<__domTypes.FormData>;
|
||||||
json(): Promise<any>;
|
json(): Promise<any>;
|
||||||
text(): Promise<string>;
|
text(): Promise<string>;
|
||||||
|
@ -1187,7 +1140,7 @@ declare namespace __fetch {
|
||||||
body_?: null | Body
|
body_?: null | Body
|
||||||
);
|
);
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
arrayBuffer(): Promise<ArrayBuffer>;
|
||||||
blob(): Promise<__domTypes.Blob>;
|
blob(): Promise<Blob>;
|
||||||
formData(): Promise<__domTypes.FormData>;
|
formData(): Promise<__domTypes.FormData>;
|
||||||
json(): Promise<any>;
|
json(): Promise<any>;
|
||||||
text(): Promise<string>;
|
text(): Promise<string>;
|
||||||
|
@ -1219,7 +1172,7 @@ declare class TextDecoder {
|
||||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||||
);
|
);
|
||||||
/** Returns the result of running encoding's decoder. */
|
/** Returns the result of running encoding's decoder. */
|
||||||
decode(input?: __domTypes.BufferSource, options?: { stream?: false }): string;
|
decode(input?: BufferSource, options?: { stream?: false }): string;
|
||||||
readonly [Symbol.toStringTag]: string;
|
readonly [Symbol.toStringTag]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue