mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
fix(dts): make globals available on globalThis (#19438)
This PR changes Web IDL interfaces to be declared with `var` instead of `class`, so that accessing them via `globalThis` does not raise type errors. Closes #13390.
This commit is contained in:
parent
e8a866ca8a
commit
d632cce129
15 changed files with 735 additions and 393 deletions
|
@ -4788,7 +4788,7 @@ fn lsp_completions_auto_import() {
|
||||||
"source": "./b.ts",
|
"source": "./b.ts",
|
||||||
"data": {
|
"data": {
|
||||||
"exportName": "foo",
|
"exportName": "foo",
|
||||||
"exportMapKey": "foo|6820|file:///a/b",
|
"exportMapKey": "foo|6893|file:///a/b",
|
||||||
"moduleSpecifier": "./b.ts",
|
"moduleSpecifier": "./b.ts",
|
||||||
"fileName": "file:///a/b.ts"
|
"fileName": "file:///a/b.ts"
|
||||||
},
|
},
|
||||||
|
|
|
@ -97,7 +97,6 @@ Deno.test(async function cacheApi() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(function cacheIllegalConstructor() {
|
Deno.test(function cacheIllegalConstructor() {
|
||||||
// @ts-expect-error illegal constructor
|
|
||||||
assertThrows(() => new Cache(), TypeError, "Illegal constructor");
|
assertThrows(() => new Cache(), TypeError, "Illegal constructor");
|
||||||
// @ts-expect-error illegal constructor
|
// @ts-expect-error illegal constructor
|
||||||
assertThrows(() => new Cache("foo", "bar"), TypeError, "Illegal constructor");
|
assertThrows(() => new Cache("foo", "bar"), TypeError, "Illegal constructor");
|
||||||
|
|
120
cli/tsc/dts/lib.deno.shared_globals.d.ts
vendored
120
cli/tsc/dts/lib.deno.shared_globals.d.ts
vendored
|
@ -410,7 +410,7 @@ declare function clearInterval(id?: number): void;
|
||||||
declare function clearTimeout(id?: number): void;
|
declare function clearTimeout(id?: number): void;
|
||||||
|
|
||||||
/** @category Scheduling */
|
/** @category Scheduling */
|
||||||
interface VoidFunction {
|
declare interface VoidFunction {
|
||||||
(): void;
|
(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ declare function queueMicrotask(func: VoidFunction): void;
|
||||||
declare function dispatchEvent(event: Event): boolean;
|
declare function dispatchEvent(event: Event): boolean;
|
||||||
|
|
||||||
/** @category DOM APIs */
|
/** @category DOM APIs */
|
||||||
interface DOMStringList {
|
declare interface DOMStringList {
|
||||||
/** Returns the number of strings in strings. */
|
/** Returns the number of strings in strings. */
|
||||||
readonly length: number;
|
readonly length: number;
|
||||||
/** Returns true if strings contains string, and false otherwise. */
|
/** Returns true if strings contains string, and false otherwise. */
|
||||||
|
@ -453,13 +453,13 @@ interface DOMStringList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Typed Arrays */
|
/** @category Typed Arrays */
|
||||||
type BufferSource = ArrayBufferView | ArrayBuffer;
|
declare type BufferSource = ArrayBufferView | ArrayBuffer;
|
||||||
|
|
||||||
/** @category Console and Debugging */
|
/** @category Console and Debugging */
|
||||||
declare var console: Console;
|
declare var console: Console;
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
interface ErrorEventInit extends EventInit {
|
declare interface ErrorEventInit extends EventInit {
|
||||||
message?: string;
|
message?: string;
|
||||||
filename?: string;
|
filename?: string;
|
||||||
lineno?: number;
|
lineno?: number;
|
||||||
|
@ -468,54 +468,63 @@ interface ErrorEventInit extends EventInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
declare class ErrorEvent extends Event {
|
declare interface ErrorEvent extends Event {
|
||||||
readonly message: string;
|
readonly message: string;
|
||||||
readonly filename: string;
|
readonly filename: string;
|
||||||
readonly lineno: number;
|
readonly lineno: number;
|
||||||
readonly colno: number;
|
readonly colno: number;
|
||||||
readonly error: any;
|
readonly error: any;
|
||||||
constructor(type: string, eventInitDict?: ErrorEventInit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category DOM Events */
|
||||||
|
declare var ErrorEvent: {
|
||||||
|
readonly prototype: ErrorEvent;
|
||||||
|
new (type: string, eventInitDict?: ErrorEventInit): ErrorEvent;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Observability */
|
/** @category Observability */
|
||||||
interface PromiseRejectionEventInit extends EventInit {
|
declare interface PromiseRejectionEventInit extends EventInit {
|
||||||
promise: Promise<any>;
|
promise: Promise<any>;
|
||||||
reason?: any;
|
reason?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Observability */
|
/** @category Observability */
|
||||||
declare class PromiseRejectionEvent extends Event {
|
declare interface PromiseRejectionEvent extends Event {
|
||||||
readonly promise: Promise<any>;
|
readonly promise: Promise<any>;
|
||||||
readonly reason: any;
|
readonly reason: any;
|
||||||
constructor(type: string, eventInitDict?: PromiseRejectionEventInit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Observability */
|
||||||
|
declare var PromiseRejectionEvent: {
|
||||||
|
readonly prototype: PromiseRejectionEvent;
|
||||||
|
new (
|
||||||
|
type: string,
|
||||||
|
eventInitDict?: PromiseRejectionEventInit,
|
||||||
|
): PromiseRejectionEvent;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
interface AbstractWorkerEventMap {
|
declare interface AbstractWorkerEventMap {
|
||||||
"error": ErrorEvent;
|
"error": ErrorEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
interface WorkerEventMap extends AbstractWorkerEventMap {
|
declare interface WorkerEventMap extends AbstractWorkerEventMap {
|
||||||
"message": MessageEvent;
|
"message": MessageEvent;
|
||||||
"messageerror": MessageEvent;
|
"messageerror": MessageEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
interface WorkerOptions {
|
declare interface WorkerOptions {
|
||||||
type?: "classic" | "module";
|
type?: "classic" | "module";
|
||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
declare class Worker extends EventTarget {
|
declare interface Worker extends EventTarget {
|
||||||
onerror?: (e: ErrorEvent) => void;
|
onerror?: (e: ErrorEvent) => void;
|
||||||
onmessage?: (e: MessageEvent) => void;
|
onmessage?: (e: MessageEvent) => void;
|
||||||
onmessageerror?: (e: MessageEvent) => void;
|
onmessageerror?: (e: MessageEvent) => void;
|
||||||
constructor(
|
|
||||||
specifier: string | URL,
|
|
||||||
options?: WorkerOptions,
|
|
||||||
);
|
|
||||||
postMessage(message: any, transfer: Transferable[]): void;
|
postMessage(message: any, transfer: Transferable[]): void;
|
||||||
postMessage(message: any, options?: StructuredSerializeOptions): void;
|
postMessage(message: any, options?: StructuredSerializeOptions): void;
|
||||||
addEventListener<K extends keyof WorkerEventMap>(
|
addEventListener<K extends keyof WorkerEventMap>(
|
||||||
|
@ -541,14 +550,19 @@ declare class Worker extends EventTarget {
|
||||||
terminate(): void;
|
terminate(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web Workers */
|
||||||
|
declare var Worker: {
|
||||||
|
readonly prototype: Worker;
|
||||||
|
new (specifier: string | URL, options?: WorkerOptions): Worker;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Performance */
|
/** @category Performance */
|
||||||
declare type PerformanceEntryList = PerformanceEntry[];
|
declare type PerformanceEntryList = PerformanceEntry[];
|
||||||
|
|
||||||
/** @category Performance */
|
/** @category Performance */
|
||||||
declare class Performance extends EventTarget {
|
declare interface Performance extends EventTarget {
|
||||||
/** Returns a timestamp representing the start of the performance measurement. */
|
/** Returns a timestamp representing the start of the performance measurement. */
|
||||||
readonly timeOrigin: number;
|
readonly timeOrigin: number;
|
||||||
constructor();
|
|
||||||
|
|
||||||
/** Removes the stored timestamp with the associated name. */
|
/** Removes the stored timestamp with the associated name. */
|
||||||
clearMarks(markName?: string): void;
|
clearMarks(markName?: string): void;
|
||||||
|
@ -594,6 +608,12 @@ declare class Performance extends EventTarget {
|
||||||
toJSON(): any;
|
toJSON(): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Performance */
|
||||||
|
declare var Performance: {
|
||||||
|
readonly prototype: Performance;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Performance */
|
/** @category Performance */
|
||||||
declare var performance: Performance;
|
declare var performance: Performance;
|
||||||
|
|
||||||
|
@ -628,7 +648,7 @@ declare interface PerformanceMeasureOptions {
|
||||||
*
|
*
|
||||||
* @category Performance
|
* @category Performance
|
||||||
*/
|
*/
|
||||||
declare class PerformanceEntry {
|
declare interface PerformanceEntry {
|
||||||
readonly duration: number;
|
readonly duration: number;
|
||||||
readonly entryType: string;
|
readonly entryType: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
@ -636,6 +656,30 @@ declare class PerformanceEntry {
|
||||||
toJSON(): any;
|
toJSON(): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Encapsulates a single performance metric that is part of the performance
|
||||||
|
* timeline. A performance entry can be directly created by making a performance
|
||||||
|
* mark or measure (for example by calling the `.mark()` method) at an explicit
|
||||||
|
* point in an application.
|
||||||
|
*
|
||||||
|
* @category Performance
|
||||||
|
*/
|
||||||
|
declare var PerformanceEntry: {
|
||||||
|
readonly prototype: PerformanceEntry;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects
|
||||||
|
* with an entryType of `"mark"`. Entries of this type are created by calling
|
||||||
|
* `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the
|
||||||
|
* performance timeline.
|
||||||
|
*
|
||||||
|
* @category Performance
|
||||||
|
*/
|
||||||
|
declare interface PerformanceMark extends PerformanceEntry {
|
||||||
|
readonly detail: any;
|
||||||
|
readonly entryType: "mark";
|
||||||
|
}
|
||||||
|
|
||||||
/** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects
|
/** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects
|
||||||
* with an entryType of `"mark"`. Entries of this type are created by calling
|
* with an entryType of `"mark"`. Entries of this type are created by calling
|
||||||
* `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the
|
* `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the
|
||||||
|
@ -643,10 +687,21 @@ declare class PerformanceEntry {
|
||||||
*
|
*
|
||||||
* @category Performance
|
* @category Performance
|
||||||
*/
|
*/
|
||||||
declare class PerformanceMark extends PerformanceEntry {
|
declare var PerformanceMark: {
|
||||||
|
readonly prototype: PerformanceMark;
|
||||||
|
new (name: string, options?: PerformanceMarkOptions): PerformanceMark;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects
|
||||||
|
* with an entryType of `"measure"`. Entries of this type are created by calling
|
||||||
|
* `performance.measure()` to add a named `DOMHighResTimeStamp` (the measure)
|
||||||
|
* between two marks to the performance timeline.
|
||||||
|
*
|
||||||
|
* @category Performance
|
||||||
|
*/
|
||||||
|
declare interface PerformanceMeasure extends PerformanceEntry {
|
||||||
readonly detail: any;
|
readonly detail: any;
|
||||||
readonly entryType: "mark";
|
readonly entryType: "measure";
|
||||||
constructor(name: string, options?: PerformanceMarkOptions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects
|
/** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects
|
||||||
|
@ -656,10 +711,10 @@ declare class PerformanceMark extends PerformanceEntry {
|
||||||
*
|
*
|
||||||
* @category Performance
|
* @category Performance
|
||||||
*/
|
*/
|
||||||
declare class PerformanceMeasure extends PerformanceEntry {
|
declare var PerformanceMeasure: {
|
||||||
readonly detail: any;
|
readonly prototype: PerformanceMeasure;
|
||||||
readonly entryType: "measure";
|
new (): never;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
declare interface CustomEventInit<T = any> extends EventInit {
|
declare interface CustomEventInit<T = any> extends EventInit {
|
||||||
|
@ -667,15 +722,20 @@ declare interface CustomEventInit<T = any> extends EventInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
declare class CustomEvent<T = any> extends Event {
|
declare interface CustomEvent<T = any> extends Event {
|
||||||
constructor(typeArg: string, eventInitDict?: CustomEventInit<T>);
|
|
||||||
/** Returns any custom data event was created with. Typically used for
|
/** Returns any custom data event was created with. Typically used for
|
||||||
* synthetic events. */
|
* synthetic events. */
|
||||||
readonly detail: T;
|
readonly detail: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category DOM Events */
|
||||||
|
declare var CustomEvent: {
|
||||||
|
readonly prototype: CustomEvent;
|
||||||
|
new <T>(typeArg: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category DOM APIs */
|
/** @category DOM APIs */
|
||||||
interface ErrorConstructor {
|
declare interface ErrorConstructor {
|
||||||
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
|
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
|
||||||
captureStackTrace(error: Object, constructor?: Function): void;
|
captureStackTrace(error: Object, constructor?: Function): void;
|
||||||
// TODO(nayeemrmn): Support `Error.prepareStackTrace()`. We currently use this
|
// TODO(nayeemrmn): Support `Error.prepareStackTrace()`. We currently use this
|
||||||
|
|
13
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
13
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
|
@ -2268,10 +2268,19 @@ declare interface WebSocketCloseInfo {
|
||||||
* @tags allow-net
|
* @tags allow-net
|
||||||
* @category Web Sockets
|
* @category Web Sockets
|
||||||
*/
|
*/
|
||||||
declare class WebSocketStream {
|
declare interface WebSocketStream {
|
||||||
constructor(url: string, options?: WebSocketStreamOptions);
|
|
||||||
url: string;
|
url: string;
|
||||||
connection: Promise<WebSocketConnection>;
|
connection: Promise<WebSocketConnection>;
|
||||||
closed: Promise<WebSocketCloseInfo>;
|
closed: Promise<WebSocketCloseInfo>;
|
||||||
close(closeInfo?: WebSocketCloseInfo): void;
|
close(closeInfo?: WebSocketCloseInfo): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** **UNSTABLE**: New API, yet to be vetted.
|
||||||
|
*
|
||||||
|
* @tags allow-net
|
||||||
|
* @category Web Sockets
|
||||||
|
*/
|
||||||
|
declare var WebSocketStream: {
|
||||||
|
readonly prototype: WebSocketStream;
|
||||||
|
new (url: string, options?: WebSocketStreamOptions): WebSocketStream;
|
||||||
|
};
|
||||||
|
|
40
cli/tsc/dts/lib.deno.window.d.ts
vendored
40
cli/tsc/dts/lib.deno.window.d.ts
vendored
|
@ -8,14 +8,13 @@
|
||||||
/// <reference lib="deno.cache" />
|
/// <reference lib="deno.cache" />
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
interface WindowEventMap {
|
declare interface WindowEventMap {
|
||||||
"error": ErrorEvent;
|
"error": ErrorEvent;
|
||||||
"unhandledrejection": PromiseRejectionEvent;
|
"unhandledrejection": PromiseRejectionEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare class Window extends EventTarget {
|
declare interface Window extends EventTarget {
|
||||||
new(): Window;
|
|
||||||
readonly window: Window & typeof globalThis;
|
readonly window: Window & typeof globalThis;
|
||||||
readonly self: Window & typeof globalThis;
|
readonly self: Window & typeof globalThis;
|
||||||
onerror: ((this: Window, ev: ErrorEvent) => any) | null;
|
onerror: ((this: Window, ev: ErrorEvent) => any) | null;
|
||||||
|
@ -67,10 +66,20 @@ declare class Window extends EventTarget {
|
||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare var Window: {
|
||||||
|
readonly prototype: Window;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare var window: Window & typeof globalThis;
|
declare var window: Window & typeof globalThis;
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare var self: Window & typeof globalThis;
|
declare var self: Window & typeof globalThis;
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare var closed: boolean;
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare function close(): void;
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null;
|
declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null;
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
|
@ -91,14 +100,19 @@ declare var sessionStorage: Storage;
|
||||||
declare var caches: CacheStorage;
|
declare var caches: CacheStorage;
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare class Navigator {
|
declare interface Navigator {
|
||||||
constructor();
|
|
||||||
readonly hardwareConcurrency: number;
|
readonly hardwareConcurrency: number;
|
||||||
readonly userAgent: string;
|
readonly userAgent: string;
|
||||||
readonly language: string;
|
readonly language: string;
|
||||||
readonly languages: string[];
|
readonly languages: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare var Navigator: {
|
||||||
|
readonly prototype: Navigator;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare var navigator: Navigator;
|
declare var navigator: Navigator;
|
||||||
|
|
||||||
|
@ -199,8 +213,7 @@ declare function removeEventListener(
|
||||||
*
|
*
|
||||||
* @category Web APIs
|
* @category Web APIs
|
||||||
*/
|
*/
|
||||||
declare class Location {
|
declare interface Location {
|
||||||
constructor();
|
|
||||||
/** Returns a DOMStringList object listing the origins of the ancestor
|
/** Returns a DOMStringList object listing the origins of the ancestor
|
||||||
* browsing contexts, from the parent browsing context to the top-level
|
* browsing contexts, from the parent browsing context to the top-level
|
||||||
* browsing context.
|
* browsing context.
|
||||||
|
@ -262,6 +275,19 @@ declare class Location {
|
||||||
replace(url: string): void;
|
replace(url: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
|
||||||
|
// The types there must first be split into window, worker and global types.
|
||||||
|
/** The location (URL) of the object it is linked to. Changes done on it are
|
||||||
|
* reflected on the object it relates to. Accessible via
|
||||||
|
* `globalThis.location`.
|
||||||
|
*
|
||||||
|
* @category Web APIs
|
||||||
|
*/
|
||||||
|
declare var Location: {
|
||||||
|
readonly prototype: Location;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
|
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
|
||||||
// The types there must first be split into window, worker and global types.
|
// The types there must first be split into window, worker and global types.
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
|
|
46
cli/tsc/dts/lib.deno.worker.d.ts
vendored
46
cli/tsc/dts/lib.deno.worker.d.ts
vendored
|
@ -7,13 +7,13 @@
|
||||||
/// <reference lib="deno.cache" />
|
/// <reference lib="deno.cache" />
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
interface WorkerGlobalScopeEventMap {
|
declare interface WorkerGlobalScopeEventMap {
|
||||||
"error": ErrorEvent;
|
"error": ErrorEvent;
|
||||||
"unhandledrejection": PromiseRejectionEvent;
|
"unhandledrejection": PromiseRejectionEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
declare class WorkerGlobalScope extends EventTarget {
|
declare interface WorkerGlobalScope extends EventTarget {
|
||||||
readonly location: WorkerLocation;
|
readonly location: WorkerLocation;
|
||||||
readonly navigator: WorkerNavigator;
|
readonly navigator: WorkerNavigator;
|
||||||
onerror: ((this: WorkerGlobalScope, ev: ErrorEvent) => any) | null;
|
onerror: ((this: WorkerGlobalScope, ev: ErrorEvent) => any) | null;
|
||||||
|
@ -54,26 +54,38 @@ declare class WorkerGlobalScope extends EventTarget {
|
||||||
caches: CacheStorage;
|
caches: CacheStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web Workers */
|
||||||
|
declare var WorkerGlobalScope: {
|
||||||
|
readonly prototype: WorkerGlobalScope;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare class WorkerNavigator {
|
declare interface WorkerNavigator {
|
||||||
constructor();
|
|
||||||
readonly hardwareConcurrency: number;
|
readonly hardwareConcurrency: number;
|
||||||
readonly userAgent: string;
|
readonly userAgent: string;
|
||||||
readonly language: string;
|
readonly language: string;
|
||||||
readonly languages: string[];
|
readonly languages: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare var WorkerNavigator: {
|
||||||
|
readonly prototype: WorkerNavigator;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare var navigator: WorkerNavigator;
|
declare var navigator: WorkerNavigator;
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
interface DedicatedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
|
declare interface DedicatedWorkerGlobalScopeEventMap
|
||||||
|
extends WorkerGlobalScopeEventMap {
|
||||||
"message": MessageEvent;
|
"message": MessageEvent;
|
||||||
"messageerror": MessageEvent;
|
"messageerror": MessageEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
|
declare interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
onmessage:
|
onmessage:
|
||||||
| ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any)
|
| ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any)
|
||||||
|
@ -112,6 +124,12 @@ declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
|
||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare var DedicatedWorkerGlobalScope: {
|
||||||
|
readonly prototype: DedicatedWorkerGlobalScope;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
declare var name: string;
|
declare var name: string;
|
||||||
/** @category Web Workers */
|
/** @category Web Workers */
|
||||||
|
@ -186,8 +204,7 @@ declare function removeEventListener(
|
||||||
*
|
*
|
||||||
* @category Web APIs
|
* @category Web APIs
|
||||||
*/
|
*/
|
||||||
declare class WorkerLocation {
|
declare interface WorkerLocation {
|
||||||
constructor();
|
|
||||||
readonly hash: string;
|
readonly hash: string;
|
||||||
readonly host: string;
|
readonly host: string;
|
||||||
readonly hostname: string;
|
readonly hostname: string;
|
||||||
|
@ -200,6 +217,19 @@ declare class WorkerLocation {
|
||||||
readonly search: string;
|
readonly search: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
|
||||||
|
// The types there must first be split into window, worker and global types.
|
||||||
|
/** The absolute location of the script executed by the Worker. Such an object
|
||||||
|
* is initialized for each worker and is available via the
|
||||||
|
* WorkerGlobalScope.location property obtained by calling self.location.
|
||||||
|
*
|
||||||
|
* @category Web APIs
|
||||||
|
*/
|
||||||
|
declare var WorkerLocation: {
|
||||||
|
readonly prototype: WorkerLocation;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
|
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
|
||||||
// The types there must first be split into window, worker and global types.
|
// The types there must first be split into window, worker and global types.
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
|
|
59
cli/tsc/dts/lib.dom.extras.d.ts
vendored
59
cli/tsc/dts/lib.dom.extras.d.ts
vendored
|
@ -59,7 +59,7 @@ declare interface URLPatternResult {
|
||||||
* ```ts
|
* ```ts
|
||||||
* // Specify the pattern as structured data.
|
* // Specify the pattern as structured data.
|
||||||
* const pattern = new URLPattern({ pathname: "/users/:user" });
|
* const pattern = new URLPattern({ pathname: "/users/:user" });
|
||||||
* const match = pattern.exec("/users/joe");
|
* const match = pattern.exec("https://blog.example.com/users/joe");
|
||||||
* console.log(match.pathname.groups.user); // joe
|
* console.log(match.pathname.groups.user); // joe
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
|
@ -72,24 +72,23 @@ declare interface URLPatternResult {
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* // Specify a relative string pattern with a base URL.
|
* // Specify a relative string pattern with a base URL.
|
||||||
* const pattern = new URLPattern("/:article", "https://blog.example.com");
|
* const pattern = new URLPattern("/article/:id", "https://blog.example.com");
|
||||||
* console.log(pattern.test("https://blog.example.com/article")); // true
|
* console.log(pattern.test("https://blog.example.com/article")); // false
|
||||||
* console.log(pattern.test("https://blog.example.com/article/123")); // false
|
* console.log(pattern.test("https://blog.example.com/article/123")); // true
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
declare class URLPattern {
|
interface URLPattern {
|
||||||
constructor(input: URLPatternInput, baseURL?: string);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the given input matches the stored pattern.
|
* Test if the given input matches the stored pattern.
|
||||||
*
|
*
|
||||||
* The input can either be provided as a url string (with an optional base),
|
* The input can either be provided as an absolute URL string with an optional base,
|
||||||
* or as individual components in the form of an object.
|
* relative URL string with a required base, or as individual components
|
||||||
|
* in the form of an `URLPatternInit` object.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const pattern = new URLPattern("https://example.com/books/:id");
|
* const pattern = new URLPattern("https://example.com/books/:id");
|
||||||
*
|
*
|
||||||
* // Test a url string.
|
* // Test an absolute url string.
|
||||||
* console.log(pattern.test("https://example.com/books/123")); // true
|
* console.log(pattern.test("https://example.com/books/123")); // true
|
||||||
*
|
*
|
||||||
* // Test a relative url with a base.
|
* // Test a relative url with a base.
|
||||||
|
@ -104,13 +103,14 @@ declare class URLPattern {
|
||||||
/**
|
/**
|
||||||
* Match the given input against the stored pattern.
|
* Match the given input against the stored pattern.
|
||||||
*
|
*
|
||||||
* The input can either be provided as a url string (with an optional base),
|
* The input can either be provided as an absolute URL string with an optional base,
|
||||||
* or as individual components in the form of an object.
|
* relative URL string with a required base, or as individual components
|
||||||
|
* in the form of an `URLPatternInit` object.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const pattern = new URLPattern("https://example.com/books/:id");
|
* const pattern = new URLPattern("https://example.com/books/:id");
|
||||||
*
|
*
|
||||||
* // Match a url string.
|
* // Match an absolute url string.
|
||||||
* let match = pattern.exec("https://example.com/books/123");
|
* let match = pattern.exec("https://example.com/books/123");
|
||||||
* console.log(match.pathname.groups.id); // 123
|
* console.log(match.pathname.groups.id); // 123
|
||||||
*
|
*
|
||||||
|
@ -143,6 +143,39 @@ declare class URLPattern {
|
||||||
readonly hash: string;
|
readonly hash: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URLPattern API provides a web platform primitive for matching URLs based
|
||||||
|
* on a convenient pattern syntax.
|
||||||
|
*
|
||||||
|
* The syntax is based on path-to-regexp. Wildcards, named capture groups,
|
||||||
|
* regular groups, and group modifiers are all supported.
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* // Specify the pattern as structured data.
|
||||||
|
* const pattern = new URLPattern({ pathname: "/users/:user" });
|
||||||
|
* const match = pattern.exec("https://blog.example.com/users/joe");
|
||||||
|
* console.log(match.pathname.groups.user); // joe
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* // Specify a fully qualified string pattern.
|
||||||
|
* const pattern = new URLPattern("https://example.com/books/:id");
|
||||||
|
* console.log(pattern.test("https://example.com/books/123")); // true
|
||||||
|
* console.log(pattern.test("https://deno.land/books/123")); // false
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* // Specify a relative string pattern with a base URL.
|
||||||
|
* const pattern = new URLPattern("/article/:id", "https://blog.example.com");
|
||||||
|
* console.log(pattern.test("https://blog.example.com/article")); // false
|
||||||
|
* console.log(pattern.test("https://blog.example.com/article/123")); // true
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
declare var URLPattern: {
|
||||||
|
readonly prototype: URLPattern;
|
||||||
|
new (input: URLPatternInput, baseURL?: string): URLPattern;
|
||||||
|
};
|
||||||
|
|
||||||
interface ErrorConstructor {
|
interface ErrorConstructor {
|
||||||
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
|
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
|
||||||
captureStackTrace(error: Object, constructor?: Function): void;
|
captureStackTrace(error: Object, constructor?: Function): void;
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
/** @category Broadcast Channel */
|
/** @category Broadcast Channel */
|
||||||
interface BroadcastChannelEventMap {
|
declare interface BroadcastChannelEventMap {
|
||||||
"message": MessageEvent;
|
"message": MessageEvent;
|
||||||
"messageerror": MessageEvent;
|
"messageerror": MessageEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Broadcast Channel */
|
/** @category Broadcast Channel */
|
||||||
interface BroadcastChannel extends EventTarget {
|
declare interface BroadcastChannel extends EventTarget {
|
||||||
/**
|
/**
|
||||||
* Returns the channel name (as passed to the constructor).
|
* Returns the channel name (as passed to the constructor).
|
||||||
*/
|
*/
|
||||||
|
@ -53,6 +53,6 @@ interface BroadcastChannel extends EventTarget {
|
||||||
|
|
||||||
/** @category Broadcast Channel */
|
/** @category Broadcast Channel */
|
||||||
declare var BroadcastChannel: {
|
declare var BroadcastChannel: {
|
||||||
prototype: BroadcastChannel;
|
readonly prototype: BroadcastChannel;
|
||||||
new (name: string): BroadcastChannel;
|
new (name: string): BroadcastChannel;
|
||||||
};
|
};
|
||||||
|
|
10
ext/cache/lib.deno_cache.d.ts
vendored
10
ext/cache/lib.deno_cache.d.ts
vendored
|
@ -54,18 +54,18 @@ declare interface Cache {
|
||||||
|
|
||||||
/** @category Cache API */
|
/** @category Cache API */
|
||||||
declare var Cache: {
|
declare var Cache: {
|
||||||
prototype: Cache;
|
readonly prototype: Cache;
|
||||||
new (name: string): Cache;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Cache API */
|
/** @category Cache API */
|
||||||
declare var CacheStorage: {
|
declare var CacheStorage: {
|
||||||
prototype: CacheStorage;
|
readonly prototype: CacheStorage;
|
||||||
new (): CacheStorage;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Cache API */
|
/** @category Cache API */
|
||||||
interface CacheQueryOptions {
|
declare interface CacheQueryOptions {
|
||||||
ignoreMethod?: boolean;
|
ignoreMethod?: boolean;
|
||||||
ignoreSearch?: boolean;
|
ignoreSearch?: boolean;
|
||||||
ignoreVary?: boolean;
|
ignoreVary?: boolean;
|
||||||
|
|
93
ext/crypto/lib.deno_crypto.d.ts
vendored
93
ext/crypto/lib.deno_crypto.d.ts
vendored
|
@ -9,23 +9,23 @@
|
||||||
declare var crypto: Crypto;
|
declare var crypto: Crypto;
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface Algorithm {
|
declare interface Algorithm {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface KeyAlgorithm {
|
declare interface KeyAlgorithm {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
type AlgorithmIdentifier = string | Algorithm;
|
declare type AlgorithmIdentifier = string | Algorithm;
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
declare type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
type KeyType = "private" | "public" | "secret";
|
declare type KeyType = "private" | "public" | "secret";
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
type KeyUsage =
|
declare type KeyUsage =
|
||||||
| "decrypt"
|
| "decrypt"
|
||||||
| "deriveBits"
|
| "deriveBits"
|
||||||
| "deriveKey"
|
| "deriveKey"
|
||||||
|
@ -35,19 +35,19 @@ type KeyUsage =
|
||||||
| "verify"
|
| "verify"
|
||||||
| "wrapKey";
|
| "wrapKey";
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
declare type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
type NamedCurve = string;
|
declare type NamedCurve = string;
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaOtherPrimesInfo {
|
declare interface RsaOtherPrimesInfo {
|
||||||
d?: string;
|
d?: string;
|
||||||
r?: string;
|
r?: string;
|
||||||
t?: string;
|
t?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface JsonWebKey {
|
declare interface JsonWebKey {
|
||||||
alg?: string;
|
alg?: string;
|
||||||
crv?: string;
|
crv?: string;
|
||||||
d?: string;
|
d?: string;
|
||||||
|
@ -56,7 +56,6 @@ interface JsonWebKey {
|
||||||
e?: string;
|
e?: string;
|
||||||
ext?: boolean;
|
ext?: boolean;
|
||||||
k?: string;
|
k?: string;
|
||||||
// deno-lint-ignore camelcase
|
|
||||||
key_ops?: string[];
|
key_ops?: string[];
|
||||||
kty?: string;
|
kty?: string;
|
||||||
n?: string;
|
n?: string;
|
||||||
|
@ -70,129 +69,129 @@ interface JsonWebKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface AesCbcParams extends Algorithm {
|
declare interface AesCbcParams extends Algorithm {
|
||||||
iv: BufferSource;
|
iv: BufferSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface AesGcmParams extends Algorithm {
|
declare interface AesGcmParams extends Algorithm {
|
||||||
iv: BufferSource;
|
iv: BufferSource;
|
||||||
additionalData?: BufferSource;
|
additionalData?: BufferSource;
|
||||||
tagLength?: number;
|
tagLength?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface AesCtrParams extends Algorithm {
|
declare interface AesCtrParams extends Algorithm {
|
||||||
counter: BufferSource;
|
counter: BufferSource;
|
||||||
length: number;
|
length: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface HmacKeyGenParams extends Algorithm {
|
declare interface HmacKeyGenParams extends Algorithm {
|
||||||
hash: HashAlgorithmIdentifier;
|
hash: HashAlgorithmIdentifier;
|
||||||
length?: number;
|
length?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface EcKeyGenParams extends Algorithm {
|
declare interface EcKeyGenParams extends Algorithm {
|
||||||
namedCurve: NamedCurve;
|
namedCurve: NamedCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface EcKeyImportParams extends Algorithm {
|
declare interface EcKeyImportParams extends Algorithm {
|
||||||
namedCurve: NamedCurve;
|
namedCurve: NamedCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface EcdsaParams extends Algorithm {
|
declare interface EcdsaParams extends Algorithm {
|
||||||
hash: HashAlgorithmIdentifier;
|
hash: HashAlgorithmIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaHashedImportParams extends Algorithm {
|
declare interface RsaHashedImportParams extends Algorithm {
|
||||||
hash: HashAlgorithmIdentifier;
|
hash: HashAlgorithmIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaHashedKeyGenParams extends RsaKeyGenParams {
|
declare interface RsaHashedKeyGenParams extends RsaKeyGenParams {
|
||||||
hash: HashAlgorithmIdentifier;
|
hash: HashAlgorithmIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaKeyGenParams extends Algorithm {
|
declare interface RsaKeyGenParams extends Algorithm {
|
||||||
modulusLength: number;
|
modulusLength: number;
|
||||||
publicExponent: Uint8Array;
|
publicExponent: Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaPssParams extends Algorithm {
|
declare interface RsaPssParams extends Algorithm {
|
||||||
saltLength: number;
|
saltLength: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaOaepParams extends Algorithm {
|
declare interface RsaOaepParams extends Algorithm {
|
||||||
label?: Uint8Array;
|
label?: Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface HmacImportParams extends Algorithm {
|
declare interface HmacImportParams extends Algorithm {
|
||||||
hash: HashAlgorithmIdentifier;
|
hash: HashAlgorithmIdentifier;
|
||||||
length?: number;
|
length?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface EcKeyAlgorithm extends KeyAlgorithm {
|
declare interface EcKeyAlgorithm extends KeyAlgorithm {
|
||||||
namedCurve: NamedCurve;
|
namedCurve: NamedCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface HmacKeyAlgorithm extends KeyAlgorithm {
|
declare interface HmacKeyAlgorithm extends KeyAlgorithm {
|
||||||
hash: KeyAlgorithm;
|
hash: KeyAlgorithm;
|
||||||
length: number;
|
length: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
|
declare interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
|
||||||
hash: KeyAlgorithm;
|
hash: KeyAlgorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface RsaKeyAlgorithm extends KeyAlgorithm {
|
declare interface RsaKeyAlgorithm extends KeyAlgorithm {
|
||||||
modulusLength: number;
|
modulusLength: number;
|
||||||
publicExponent: Uint8Array;
|
publicExponent: Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface HkdfParams extends Algorithm {
|
declare interface HkdfParams extends Algorithm {
|
||||||
hash: HashAlgorithmIdentifier;
|
hash: HashAlgorithmIdentifier;
|
||||||
info: BufferSource;
|
info: BufferSource;
|
||||||
salt: BufferSource;
|
salt: BufferSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface Pbkdf2Params extends Algorithm {
|
declare interface Pbkdf2Params extends Algorithm {
|
||||||
hash: HashAlgorithmIdentifier;
|
hash: HashAlgorithmIdentifier;
|
||||||
iterations: number;
|
iterations: number;
|
||||||
salt: BufferSource;
|
salt: BufferSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface AesDerivedKeyParams extends Algorithm {
|
declare interface AesDerivedKeyParams extends Algorithm {
|
||||||
length: number;
|
length: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface EcdhKeyDeriveParams extends Algorithm {
|
declare interface EcdhKeyDeriveParams extends Algorithm {
|
||||||
public: CryptoKey;
|
public: CryptoKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface AesKeyGenParams extends Algorithm {
|
declare interface AesKeyGenParams extends Algorithm {
|
||||||
length: number;
|
length: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
interface AesKeyAlgorithm extends KeyAlgorithm {
|
declare interface AesKeyAlgorithm extends KeyAlgorithm {
|
||||||
length: number;
|
length: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +200,7 @@ interface AesKeyAlgorithm extends KeyAlgorithm {
|
||||||
*
|
*
|
||||||
* @category Web Crypto API
|
* @category Web Crypto API
|
||||||
*/
|
*/
|
||||||
interface CryptoKey {
|
declare interface CryptoKey {
|
||||||
readonly algorithm: KeyAlgorithm;
|
readonly algorithm: KeyAlgorithm;
|
||||||
readonly extractable: boolean;
|
readonly extractable: boolean;
|
||||||
readonly type: KeyType;
|
readonly type: KeyType;
|
||||||
|
@ -210,8 +209,8 @@ interface CryptoKey {
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
declare var CryptoKey: {
|
declare var CryptoKey: {
|
||||||
prototype: CryptoKey;
|
readonly prototype: CryptoKey;
|
||||||
new (): CryptoKey;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The CryptoKeyPair dictionary of the Web Crypto API represents a key pair for
|
/** The CryptoKeyPair dictionary of the Web Crypto API represents a key pair for
|
||||||
|
@ -219,15 +218,15 @@ declare var CryptoKey: {
|
||||||
*
|
*
|
||||||
* @category Web Crypto API
|
* @category Web Crypto API
|
||||||
*/
|
*/
|
||||||
interface CryptoKeyPair {
|
declare interface CryptoKeyPair {
|
||||||
privateKey: CryptoKey;
|
privateKey: CryptoKey;
|
||||||
publicKey: CryptoKey;
|
publicKey: CryptoKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
declare var CryptoKeyPair: {
|
declare var CryptoKeyPair: {
|
||||||
prototype: CryptoKeyPair;
|
readonly prototype: CryptoKeyPair;
|
||||||
new (): CryptoKeyPair;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** This Web Crypto API interface provides a number of low-level cryptographic
|
/** This Web Crypto API interface provides a number of low-level cryptographic
|
||||||
|
@ -236,7 +235,7 @@ declare var CryptoKeyPair: {
|
||||||
*
|
*
|
||||||
* @category Web Crypto API
|
* @category Web Crypto API
|
||||||
*/
|
*/
|
||||||
interface SubtleCrypto {
|
declare interface SubtleCrypto {
|
||||||
generateKey(
|
generateKey(
|
||||||
algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
|
algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
|
||||||
extractable: boolean,
|
extractable: boolean,
|
||||||
|
@ -368,6 +367,12 @@ interface SubtleCrypto {
|
||||||
): Promise<CryptoKey>;
|
): Promise<CryptoKey>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web Crypto API */
|
||||||
|
declare var SubtleCrypto: {
|
||||||
|
readonly prototype: SubtleCrypto;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
declare interface Crypto {
|
declare interface Crypto {
|
||||||
readonly subtle: SubtleCrypto;
|
readonly subtle: SubtleCrypto;
|
||||||
|
@ -389,7 +394,7 @@ declare interface Crypto {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Crypto API */
|
/** @category Web Crypto API */
|
||||||
declare var SubtleCrypto: {
|
declare var Crypto: {
|
||||||
prototype: SubtleCrypto;
|
readonly prototype: Crypto;
|
||||||
new (): SubtleCrypto;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
183
ext/fetch/lib.deno_fetch.d.ts
vendored
183
ext/fetch/lib.deno_fetch.d.ts
vendored
|
@ -6,7 +6,7 @@
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
/** @category DOM APIs */
|
/** @category DOM APIs */
|
||||||
interface DomIterable<K, V> {
|
declare interface DomIterable<K, V> {
|
||||||
keys(): IterableIterator<K>;
|
keys(): IterableIterator<K>;
|
||||||
values(): IterableIterator<V>;
|
values(): IterableIterator<V>;
|
||||||
entries(): IterableIterator<[K, V]>;
|
entries(): IterableIterator<[K, V]>;
|
||||||
|
@ -18,7 +18,7 @@ interface DomIterable<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type FormDataEntryValue = File | string;
|
declare type FormDataEntryValue = File | string;
|
||||||
|
|
||||||
/** Provides a way to easily construct a set of key/value pairs representing
|
/** Provides a way to easily construct a set of key/value pairs representing
|
||||||
* form fields and their values, which can then be easily sent using the
|
* form fields and their values, which can then be easily sent using the
|
||||||
|
@ -27,31 +27,23 @@ type FormDataEntryValue = File | string;
|
||||||
*
|
*
|
||||||
* @category Fetch API
|
* @category Fetch API
|
||||||
*/
|
*/
|
||||||
interface FormData {
|
declare interface FormData extends DomIterable<string, FormDataEntryValue> {
|
||||||
append(name: string, value: string | Blob, fileName?: string): void;
|
append(name: string, value: string | Blob, fileName?: string): void;
|
||||||
delete(name: string): void;
|
delete(name: string): void;
|
||||||
get(name: string): FormDataEntryValue | null;
|
get(name: string): FormDataEntryValue | null;
|
||||||
getAll(name: string): FormDataEntryValue[];
|
getAll(name: string): FormDataEntryValue[];
|
||||||
has(name: string): boolean;
|
has(name: string): boolean;
|
||||||
set(name: string, value: string | Blob, fileName?: string): void;
|
set(name: string, value: string | Blob, fileName?: string): void;
|
||||||
keys(): IterableIterator<string>;
|
|
||||||
values(): IterableIterator<string>;
|
|
||||||
entries(): IterableIterator<[string, FormDataEntryValue]>;
|
|
||||||
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
|
|
||||||
forEach(
|
|
||||||
callback: (value: FormDataEntryValue, key: string, parent: this) => void,
|
|
||||||
thisArg?: any,
|
|
||||||
): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
declare var FormData: {
|
declare var FormData: {
|
||||||
prototype: FormData;
|
readonly prototype: FormData;
|
||||||
new (): FormData;
|
new (): FormData;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
interface Body {
|
declare 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;
|
||||||
/** Stores a `Boolean` that declares whether the body has been used in a
|
/** Stores a `Boolean` that declares whether the body has been used in a
|
||||||
|
@ -81,7 +73,7 @@ interface Body {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type HeadersInit = Headers | string[][] | Record<string, string>;
|
declare type HeadersInit = Iterable<string[]> | Record<string, string>;
|
||||||
|
|
||||||
/** This Fetch API interface allows you to perform various actions on HTTP
|
/** This Fetch API interface allows you to perform various actions on HTTP
|
||||||
* request and response headers. These actions include retrieving, setting,
|
* request and response headers. These actions include retrieving, setting,
|
||||||
|
@ -93,33 +85,13 @@ type HeadersInit = Headers | string[][] | Record<string, string>;
|
||||||
*
|
*
|
||||||
* @category Fetch API
|
* @category Fetch API
|
||||||
*/
|
*/
|
||||||
interface Headers {
|
declare interface Headers extends DomIterable<string, string> {
|
||||||
append(name: string, value: string): void;
|
|
||||||
delete(name: string): void;
|
|
||||||
get(name: string): string | null;
|
|
||||||
has(name: string): boolean;
|
|
||||||
set(name: string, value: string): void;
|
|
||||||
forEach(
|
|
||||||
callbackfn: (value: string, key: string, parent: Headers) => void,
|
|
||||||
thisArg?: any,
|
|
||||||
): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @category Fetch API */
|
|
||||||
declare class Headers implements DomIterable<string, string> {
|
|
||||||
constructor(init?: HeadersInit);
|
|
||||||
|
|
||||||
/** Appends a new value onto an existing header inside a `Headers` object, or
|
/** Appends a new value onto an existing header inside a `Headers` object, or
|
||||||
* adds the header if it does not already exist.
|
* adds the header if it does not already exist.
|
||||||
*/
|
*/
|
||||||
append(name: string, value: string): void;
|
append(name: string, value: string): void;
|
||||||
/** Deletes a header from a `Headers` object. */
|
/** Deletes a header from a `Headers` object. */
|
||||||
delete(name: string): void;
|
delete(name: string): void;
|
||||||
/** Returns an iterator allowing to go through all key/value pairs
|
|
||||||
* contained in this Headers object. The both the key and value of each pairs
|
|
||||||
* are ByteString objects.
|
|
||||||
*/
|
|
||||||
entries(): IterableIterator<[string, string]>;
|
|
||||||
/** Returns a `ByteString` sequence of all the values of a header within a
|
/** Returns a `ByteString` sequence of all the values of a header within a
|
||||||
* `Headers` object with a given name.
|
* `Headers` object with a given name.
|
||||||
*/
|
*/
|
||||||
|
@ -128,32 +100,35 @@ declare class Headers implements DomIterable<string, string> {
|
||||||
* header.
|
* header.
|
||||||
*/
|
*/
|
||||||
has(name: string): boolean;
|
has(name: string): boolean;
|
||||||
/** Returns an iterator allowing to go through all keys contained in
|
|
||||||
* this Headers object. The keys are ByteString objects.
|
|
||||||
*/
|
|
||||||
keys(): IterableIterator<string>;
|
|
||||||
/** Sets a new value for an existing header inside a Headers object, or adds
|
/** Sets a new value for an existing header inside a Headers object, or adds
|
||||||
* the header if it does not already exist.
|
* the header if it does not already exist.
|
||||||
*/
|
*/
|
||||||
set(name: string, value: string): void;
|
set(name: string, value: string): void;
|
||||||
/** Returns an iterator allowing to go through all values contained in
|
/** Returns an array containing the values of all `Set-Cookie` headers
|
||||||
* this Headers object. The values are ByteString objects.
|
* associated with a response.
|
||||||
*/
|
*/
|
||||||
values(): IterableIterator<string>;
|
getSetCookie(): string[];
|
||||||
forEach(
|
|
||||||
callbackfn: (value: string, key: string, parent: this) => void,
|
|
||||||
thisArg?: any,
|
|
||||||
): void;
|
|
||||||
/** The Symbol.iterator well-known symbol specifies the default
|
|
||||||
* iterator for this Headers object
|
|
||||||
*/
|
|
||||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This Fetch API interface allows you to perform various actions on HTTP
|
||||||
|
* request and response headers. These actions include retrieving, setting,
|
||||||
|
* adding to, and removing. A Headers object has an associated header list,
|
||||||
|
* which is initially empty and consists of zero or more name and value pairs.
|
||||||
|
* You can add to this using methods like append() (see Examples). In all
|
||||||
|
* methods of this interface, header names are matched by case-insensitive byte
|
||||||
|
* sequence.
|
||||||
|
*
|
||||||
|
* @category Fetch API
|
||||||
|
*/
|
||||||
|
declare var Headers: {
|
||||||
|
readonly prototype: Headers;
|
||||||
|
new (init?: HeadersInit): Headers;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type RequestInfo = Request | string;
|
declare type RequestInfo = Request | string;
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type RequestCache =
|
declare type RequestCache =
|
||||||
| "default"
|
| "default"
|
||||||
| "force-cache"
|
| "force-cache"
|
||||||
| "no-cache"
|
| "no-cache"
|
||||||
|
@ -161,13 +136,13 @@ type RequestCache =
|
||||||
| "only-if-cached"
|
| "only-if-cached"
|
||||||
| "reload";
|
| "reload";
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type RequestCredentials = "include" | "omit" | "same-origin";
|
declare type RequestCredentials = "include" | "omit" | "same-origin";
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin";
|
declare type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin";
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type RequestRedirect = "error" | "follow" | "manual";
|
declare type RequestRedirect = "error" | "follow" | "manual";
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type ReferrerPolicy =
|
declare type ReferrerPolicy =
|
||||||
| ""
|
| ""
|
||||||
| "no-referrer"
|
| "no-referrer"
|
||||||
| "no-referrer-when-downgrade"
|
| "no-referrer-when-downgrade"
|
||||||
|
@ -178,7 +153,7 @@ type ReferrerPolicy =
|
||||||
| "strict-origin-when-cross-origin"
|
| "strict-origin-when-cross-origin"
|
||||||
| "unsafe-url";
|
| "unsafe-url";
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type BodyInit =
|
declare type BodyInit =
|
||||||
| Blob
|
| Blob
|
||||||
| BufferSource
|
| BufferSource
|
||||||
| FormData
|
| FormData
|
||||||
|
@ -186,7 +161,7 @@ type BodyInit =
|
||||||
| ReadableStream<Uint8Array>
|
| ReadableStream<Uint8Array>
|
||||||
| string;
|
| string;
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type RequestDestination =
|
declare type RequestDestination =
|
||||||
| ""
|
| ""
|
||||||
| "audio"
|
| "audio"
|
||||||
| "audioworklet"
|
| "audioworklet"
|
||||||
|
@ -207,7 +182,7 @@ type RequestDestination =
|
||||||
| "xslt";
|
| "xslt";
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
interface RequestInit {
|
declare interface RequestInit {
|
||||||
/**
|
/**
|
||||||
* A BodyInit object or null to set request's body.
|
* A BodyInit object or null to set request's body.
|
||||||
*/
|
*/
|
||||||
|
@ -275,9 +250,7 @@ interface RequestInit {
|
||||||
*
|
*
|
||||||
* @category Fetch API
|
* @category Fetch API
|
||||||
*/
|
*/
|
||||||
declare class Request implements Body {
|
declare interface Request extends Body {
|
||||||
constructor(input: RequestInfo | URL, init?: RequestInit);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the cache mode associated with request, which is a string
|
* Returns the cache mode associated with request, which is a string
|
||||||
* indicating how the request will interact with the browser's cache when
|
* indicating how the request will interact with the browser's cache when
|
||||||
|
@ -361,44 +334,26 @@ declare class Request implements Body {
|
||||||
*/
|
*/
|
||||||
readonly url: string;
|
readonly url: string;
|
||||||
clone(): Request;
|
clone(): Request;
|
||||||
|
|
||||||
/** A simple getter used to expose a `ReadableStream` of the body contents. */
|
|
||||||
readonly body: ReadableStream<Uint8Array> | null;
|
|
||||||
/** Stores a `Boolean` that declares whether the body has been used in a
|
|
||||||
* request yet.
|
|
||||||
*/
|
|
||||||
readonly bodyUsed: boolean;
|
|
||||||
/** Takes a `Request` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with an `ArrayBuffer`.
|
|
||||||
*/
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
/** Takes a `Request` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with a `Blob`.
|
|
||||||
*/
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
/** Takes a `Request` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with a `FormData` object.
|
|
||||||
*/
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
/** Takes a `Request` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with the result of parsing the body text as JSON.
|
|
||||||
*/
|
|
||||||
json(): Promise<any>;
|
|
||||||
/** Takes a `Request` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with a `USVString` (text).
|
|
||||||
*/
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This Fetch API interface represents a resource request.
|
||||||
|
*
|
||||||
|
* @category Fetch API
|
||||||
|
*/
|
||||||
|
declare var Request: {
|
||||||
|
readonly prototype: Request;
|
||||||
|
new (input: RequestInfo | URL, init?: RequestInit): Request;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
interface ResponseInit {
|
declare interface ResponseInit {
|
||||||
headers?: HeadersInit;
|
headers?: HeadersInit;
|
||||||
status?: number;
|
status?: number;
|
||||||
statusText?: string;
|
statusText?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Fetch API */
|
/** @category Fetch API */
|
||||||
type ResponseType =
|
declare type ResponseType =
|
||||||
| "basic"
|
| "basic"
|
||||||
| "cors"
|
| "cors"
|
||||||
| "default"
|
| "default"
|
||||||
|
@ -410,12 +365,7 @@ type ResponseType =
|
||||||
*
|
*
|
||||||
* @category Fetch API
|
* @category Fetch API
|
||||||
*/
|
*/
|
||||||
declare class Response implements Body {
|
declare interface Response extends Body {
|
||||||
constructor(body?: BodyInit | null, init?: ResponseInit);
|
|
||||||
static json(data: unknown, init?: ResponseInit): Response;
|
|
||||||
static error(): Response;
|
|
||||||
static redirect(url: string | URL, status?: number): Response;
|
|
||||||
|
|
||||||
readonly headers: Headers;
|
readonly headers: Headers;
|
||||||
readonly ok: boolean;
|
readonly ok: boolean;
|
||||||
readonly redirected: boolean;
|
readonly redirected: boolean;
|
||||||
|
@ -424,35 +374,20 @@ declare class Response implements Body {
|
||||||
readonly type: ResponseType;
|
readonly type: ResponseType;
|
||||||
readonly url: string;
|
readonly url: string;
|
||||||
clone(): Response;
|
clone(): Response;
|
||||||
|
|
||||||
/** A simple getter used to expose a `ReadableStream` of the body contents. */
|
|
||||||
readonly body: ReadableStream<Uint8Array> | null;
|
|
||||||
/** Stores a `Boolean` that declares whether the body has been used in a
|
|
||||||
* response yet.
|
|
||||||
*/
|
|
||||||
readonly bodyUsed: boolean;
|
|
||||||
/** Takes a `Response` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with an `ArrayBuffer`.
|
|
||||||
*/
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
/** Takes a `Response` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with a `Blob`.
|
|
||||||
*/
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
/** Takes a `Response` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with a `FormData` object.
|
|
||||||
*/
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
/** Takes a `Response` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with the result of parsing the body text as JSON.
|
|
||||||
*/
|
|
||||||
json(): Promise<any>;
|
|
||||||
/** Takes a `Response` stream and reads it to completion. It returns a promise
|
|
||||||
* that resolves with a `USVString` (text).
|
|
||||||
*/
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This Fetch API interface represents the response to a request.
|
||||||
|
*
|
||||||
|
* @category Fetch API
|
||||||
|
*/
|
||||||
|
declare var Response: {
|
||||||
|
readonly prototype: Response;
|
||||||
|
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
||||||
|
json(data: unknown, init?: ResponseInit): Response;
|
||||||
|
error(): Response;
|
||||||
|
redirect(url: string | URL, status?: number): Response;
|
||||||
|
};
|
||||||
|
|
||||||
/** Fetch a resource from the network. It returns a `Promise` that resolves to the
|
/** Fetch a resource from the network. It returns a `Promise` that resolves to the
|
||||||
* `Response` to that `Request`, whether it is successful or not.
|
* `Response` to that `Request`, whether it is successful or not.
|
||||||
*
|
*
|
||||||
|
|
88
ext/url/lib.deno_url.d.ts
vendored
88
ext/url/lib.deno_url.d.ts
vendored
|
@ -1,17 +1,12 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
// deno-lint-ignore-file no-explicit-any
|
// deno-lint-ignore-file no-explicit-any no-var
|
||||||
|
|
||||||
/// <reference no-default-lib="true" />
|
/// <reference no-default-lib="true" />
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare class URLSearchParams {
|
declare interface URLSearchParams {
|
||||||
constructor(
|
|
||||||
init?: string[][] | Record<string, string> | string | URLSearchParams,
|
|
||||||
);
|
|
||||||
static toString(): string;
|
|
||||||
|
|
||||||
/** Appends a specified key/value pair as a new search parameter.
|
/** Appends a specified key/value pair as a new search parameter.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
|
@ -22,15 +17,16 @@ declare class URLSearchParams {
|
||||||
*/
|
*/
|
||||||
append(name: string, value: string): void;
|
append(name: string, value: string): void;
|
||||||
|
|
||||||
/** Deletes the given search parameter and its associated value,
|
/** Deletes search parameters that match a name, and optional value,
|
||||||
* from the list of all search parameters.
|
* from the list of all search parameters.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* let searchParams = new URLSearchParams([['name', 'value']]);
|
* let searchParams = new URLSearchParams([['name', 'value']]);
|
||||||
* searchParams.delete('name');
|
* searchParams.delete('name');
|
||||||
|
* searchParams.delete('name', 'value');
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
delete(name: string): void;
|
delete(name: string, value?: string): void;
|
||||||
|
|
||||||
/** Returns all the values associated with a given search parameter
|
/** Returns all the values associated with a given search parameter
|
||||||
* as an array.
|
* as an array.
|
||||||
|
@ -49,14 +45,15 @@ declare class URLSearchParams {
|
||||||
*/
|
*/
|
||||||
get(name: string): string | null;
|
get(name: string): string | null;
|
||||||
|
|
||||||
/** Returns a Boolean that indicates whether a parameter with the
|
/** Returns a boolean value indicating if a given parameter,
|
||||||
* specified name exists.
|
* or parameter and value pair, exists.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* searchParams.has('name');
|
* searchParams.has('name');
|
||||||
|
* searchParams.has('name', 'value');
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
has(name: string): boolean;
|
has(name: string, value?: string): boolean;
|
||||||
|
|
||||||
/** Sets the value associated with a given search parameter to the
|
/** Sets the value associated with a given search parameter to the
|
||||||
* given value. If there were several matching values, this method
|
* given value. If there were several matching values, this method
|
||||||
|
@ -160,17 +157,20 @@ declare class URLSearchParams {
|
||||||
size: number;
|
size: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare var URLSearchParams: {
|
||||||
|
readonly prototype: URLSearchParams;
|
||||||
|
new (
|
||||||
|
init?: Iterable<string[]> | Record<string, string> | string,
|
||||||
|
): URLSearchParams;
|
||||||
|
};
|
||||||
|
|
||||||
/** The URL interface represents an object providing static methods used for
|
/** The URL interface represents an object providing static methods used for
|
||||||
* creating object URLs.
|
* creating object URLs.
|
||||||
*
|
*
|
||||||
* @category Web APIs
|
* @category Web APIs
|
||||||
*/
|
*/
|
||||||
declare class URL {
|
declare interface URL {
|
||||||
constructor(url: string | URL, base?: string | URL);
|
|
||||||
static canParse(url: string | URL, base?: string | URL): boolean;
|
|
||||||
static createObjectURL(blob: Blob): string;
|
|
||||||
static revokeObjectURL(url: string): void;
|
|
||||||
|
|
||||||
hash: string;
|
hash: string;
|
||||||
host: string;
|
host: string;
|
||||||
hostname: string;
|
hostname: string;
|
||||||
|
@ -187,6 +187,19 @@ declare class URL {
|
||||||
toJSON(): string;
|
toJSON(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The URL interface represents an object providing static methods used for
|
||||||
|
* creating object URLs.
|
||||||
|
*
|
||||||
|
* @category Web APIs
|
||||||
|
*/
|
||||||
|
declare var URL: {
|
||||||
|
readonly prototype: URL;
|
||||||
|
new (url: string | URL, base?: string | URL): URL;
|
||||||
|
canParse(url: string | URL, base?: string | URL): boolean;
|
||||||
|
createObjectURL(blob: Blob): string;
|
||||||
|
revokeObjectURL(url: string): void;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare interface URLPatternInit {
|
declare interface URLPatternInit {
|
||||||
protocol?: string;
|
protocol?: string;
|
||||||
|
@ -265,9 +278,7 @@ declare interface URLPatternResult {
|
||||||
*
|
*
|
||||||
* @category Web APIs
|
* @category Web APIs
|
||||||
*/
|
*/
|
||||||
declare class URLPattern {
|
declare interface URLPattern {
|
||||||
constructor(input: URLPatternInput, baseURL?: string);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the given input matches the stored pattern.
|
* Test if the given input matches the stored pattern.
|
||||||
*
|
*
|
||||||
|
@ -332,3 +343,38 @@ declare class URLPattern {
|
||||||
/** The pattern string for the `hash`. */
|
/** The pattern string for the `hash`. */
|
||||||
readonly hash: string;
|
readonly hash: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URLPattern API provides a web platform primitive for matching URLs based
|
||||||
|
* on a convenient pattern syntax.
|
||||||
|
*
|
||||||
|
* The syntax is based on path-to-regexp. Wildcards, named capture groups,
|
||||||
|
* regular groups, and group modifiers are all supported.
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* // Specify the pattern as structured data.
|
||||||
|
* const pattern = new URLPattern({ pathname: "/users/:user" });
|
||||||
|
* const match = pattern.exec("https://blog.example.com/users/joe");
|
||||||
|
* console.log(match.pathname.groups.user); // joe
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* // Specify a fully qualified string pattern.
|
||||||
|
* const pattern = new URLPattern("https://example.com/books/:id");
|
||||||
|
* console.log(pattern.test("https://example.com/books/123")); // true
|
||||||
|
* console.log(pattern.test("https://deno.land/books/123")); // false
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* // Specify a relative string pattern with a base URL.
|
||||||
|
* const pattern = new URLPattern("/article/:id", "https://blog.example.com");
|
||||||
|
* console.log(pattern.test("https://blog.example.com/article")); // false
|
||||||
|
* console.log(pattern.test("https://blog.example.com/article/123")); // true
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @category Web APIs
|
||||||
|
*/
|
||||||
|
declare var URLPattern: {
|
||||||
|
readonly prototype: URLPattern;
|
||||||
|
new (input: URLPatternInput, baseURL?: string): URLPattern;
|
||||||
|
};
|
||||||
|
|
426
ext/web/lib.deno_web.d.ts
vendored
426
ext/web/lib.deno_web.d.ts
vendored
|
@ -5,16 +5,71 @@
|
||||||
/// <reference no-default-lib="true" />
|
/// <reference no-default-lib="true" />
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category Web APIs */
|
||||||
declare class DOMException extends Error {
|
declare interface DOMException extends Error {
|
||||||
constructor(message?: string, name?: string);
|
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly message: string;
|
readonly message: string;
|
||||||
readonly code: number;
|
readonly code: number;
|
||||||
|
readonly INDEX_SIZE_ERR: 1;
|
||||||
|
readonly DOMSTRING_SIZE_ERR: 2;
|
||||||
|
readonly HIERARCHY_REQUEST_ERR: 3;
|
||||||
|
readonly WRONG_DOCUMENT_ERR: 4;
|
||||||
|
readonly INVALID_CHARACTER_ERR: 5;
|
||||||
|
readonly NO_DATA_ALLOWED_ERR: 6;
|
||||||
|
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
||||||
|
readonly NOT_FOUND_ERR: 8;
|
||||||
|
readonly NOT_SUPPORTED_ERR: 9;
|
||||||
|
readonly INUSE_ATTRIBUTE_ERR: 10;
|
||||||
|
readonly INVALID_STATE_ERR: 11;
|
||||||
|
readonly SYNTAX_ERR: 12;
|
||||||
|
readonly INVALID_MODIFICATION_ERR: 13;
|
||||||
|
readonly NAMESPACE_ERR: 14;
|
||||||
|
readonly INVALID_ACCESS_ERR: 15;
|
||||||
|
readonly VALIDATION_ERR: 16;
|
||||||
|
readonly TYPE_MISMATCH_ERR: 17;
|
||||||
|
readonly SECURITY_ERR: 18;
|
||||||
|
readonly NETWORK_ERR: 19;
|
||||||
|
readonly ABORT_ERR: 20;
|
||||||
|
readonly URL_MISMATCH_ERR: 21;
|
||||||
|
readonly QUOTA_EXCEEDED_ERR: 22;
|
||||||
|
readonly TIMEOUT_ERR: 23;
|
||||||
|
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||||
|
readonly DATA_CLONE_ERR: 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @category Web APIs */
|
||||||
|
declare var DOMException: {
|
||||||
|
readonly prototype: DOMException;
|
||||||
|
new (message?: string, name?: string): DOMException;
|
||||||
|
readonly INDEX_SIZE_ERR: 1;
|
||||||
|
readonly DOMSTRING_SIZE_ERR: 2;
|
||||||
|
readonly HIERARCHY_REQUEST_ERR: 3;
|
||||||
|
readonly WRONG_DOCUMENT_ERR: 4;
|
||||||
|
readonly INVALID_CHARACTER_ERR: 5;
|
||||||
|
readonly NO_DATA_ALLOWED_ERR: 6;
|
||||||
|
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
||||||
|
readonly NOT_FOUND_ERR: 8;
|
||||||
|
readonly NOT_SUPPORTED_ERR: 9;
|
||||||
|
readonly INUSE_ATTRIBUTE_ERR: 10;
|
||||||
|
readonly INVALID_STATE_ERR: 11;
|
||||||
|
readonly SYNTAX_ERR: 12;
|
||||||
|
readonly INVALID_MODIFICATION_ERR: 13;
|
||||||
|
readonly NAMESPACE_ERR: 14;
|
||||||
|
readonly INVALID_ACCESS_ERR: 15;
|
||||||
|
readonly VALIDATION_ERR: 16;
|
||||||
|
readonly TYPE_MISMATCH_ERR: 17;
|
||||||
|
readonly SECURITY_ERR: 18;
|
||||||
|
readonly NETWORK_ERR: 19;
|
||||||
|
readonly ABORT_ERR: 20;
|
||||||
|
readonly URL_MISMATCH_ERR: 21;
|
||||||
|
readonly QUOTA_EXCEEDED_ERR: 22;
|
||||||
|
readonly TIMEOUT_ERR: 23;
|
||||||
|
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||||
|
readonly DATA_CLONE_ERR: 25;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
interface EventInit {
|
declare interface EventInit {
|
||||||
bubbles?: boolean;
|
bubbles?: boolean;
|
||||||
cancelable?: boolean;
|
cancelable?: boolean;
|
||||||
composed?: boolean;
|
composed?: boolean;
|
||||||
|
@ -24,8 +79,7 @@ interface EventInit {
|
||||||
*
|
*
|
||||||
* @category DOM Events
|
* @category DOM Events
|
||||||
*/
|
*/
|
||||||
declare class Event {
|
declare interface Event {
|
||||||
constructor(type: string, eventInitDict?: EventInit);
|
|
||||||
/** Returns true or false depending on how event was initialized. True if
|
/** Returns true or false depending on how event was initialized. True if
|
||||||
* event goes through its target's ancestors in reverse tree order, and
|
* event goes through its target's ancestors in reverse tree order, and
|
||||||
* false otherwise. */
|
* false otherwise. */
|
||||||
|
@ -80,19 +134,28 @@ declare class Event {
|
||||||
readonly BUBBLING_PHASE: number;
|
readonly BUBBLING_PHASE: number;
|
||||||
readonly CAPTURING_PHASE: number;
|
readonly CAPTURING_PHASE: number;
|
||||||
readonly NONE: number;
|
readonly NONE: number;
|
||||||
static readonly AT_TARGET: number;
|
|
||||||
static readonly BUBBLING_PHASE: number;
|
|
||||||
static readonly CAPTURING_PHASE: number;
|
|
||||||
static readonly NONE: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** An event which takes place in the DOM.
|
||||||
|
*
|
||||||
|
* @category DOM Events
|
||||||
|
*/
|
||||||
|
declare var Event: {
|
||||||
|
readonly prototype: Event;
|
||||||
|
new (type: string, eventInitDict?: EventInit): Event;
|
||||||
|
readonly AT_TARGET: number;
|
||||||
|
readonly BUBBLING_PHASE: number;
|
||||||
|
readonly CAPTURING_PHASE: number;
|
||||||
|
readonly NONE: number;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EventTarget is a DOM interface implemented by objects that can receive events
|
* EventTarget is a DOM interface implemented by objects that can receive events
|
||||||
* and may have listeners for them.
|
* and may have listeners for them.
|
||||||
*
|
*
|
||||||
* @category DOM Events
|
* @category DOM Events
|
||||||
*/
|
*/
|
||||||
declare class EventTarget {
|
declare interface EventTarget {
|
||||||
/** Appends an event listener for events whose type attribute value is type.
|
/** Appends an event listener for events whose type attribute value is type.
|
||||||
* The callback argument sets the callback that will be invoked when the event
|
* The callback argument sets the callback that will be invoked when the event
|
||||||
* is dispatched.
|
* is dispatched.
|
||||||
|
@ -134,13 +197,24 @@ declare class EventTarget {
|
||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventTarget is a DOM interface implemented by objects that can receive events
|
||||||
|
* and may have listeners for them.
|
||||||
|
*
|
||||||
|
* @category DOM Events
|
||||||
|
*/
|
||||||
|
declare var EventTarget: {
|
||||||
|
readonly prototype: EventTarget;
|
||||||
|
new (): EventTarget;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
interface EventListener {
|
declare interface EventListener {
|
||||||
(evt: Event): void | Promise<void>;
|
(evt: Event): void | Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
interface EventListenerObject {
|
declare interface EventListenerObject {
|
||||||
handleEvent(evt: Event): void | Promise<void>;
|
handleEvent(evt: Event): void | Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,19 +224,19 @@ declare type EventListenerOrEventListenerObject =
|
||||||
| EventListenerObject;
|
| EventListenerObject;
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
interface AddEventListenerOptions extends EventListenerOptions {
|
declare interface AddEventListenerOptions extends EventListenerOptions {
|
||||||
once?: boolean;
|
once?: boolean;
|
||||||
passive?: boolean;
|
passive?: boolean;
|
||||||
signal?: AbortSignal;
|
signal?: AbortSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
interface EventListenerOptions {
|
declare interface EventListenerOptions {
|
||||||
capture?: boolean;
|
capture?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category DOM Events */
|
/** @category DOM Events */
|
||||||
interface ProgressEventInit extends EventInit {
|
declare interface ProgressEventInit extends EventInit {
|
||||||
lengthComputable?: boolean;
|
lengthComputable?: boolean;
|
||||||
loaded?: number;
|
loaded?: number;
|
||||||
total?: number;
|
total?: number;
|
||||||
|
@ -174,14 +248,25 @@ interface ProgressEventInit extends EventInit {
|
||||||
*
|
*
|
||||||
* @category DOM Events
|
* @category DOM Events
|
||||||
*/
|
*/
|
||||||
declare class ProgressEvent<T extends EventTarget = EventTarget> extends Event {
|
declare interface ProgressEvent<T extends EventTarget = EventTarget>
|
||||||
constructor(type: string, eventInitDict?: ProgressEventInit);
|
extends Event {
|
||||||
readonly lengthComputable: boolean;
|
readonly lengthComputable: boolean;
|
||||||
readonly loaded: number;
|
readonly loaded: number;
|
||||||
readonly target: T | null;
|
readonly target: T | null;
|
||||||
readonly total: number;
|
readonly total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Events measuring progress of an underlying process, like an HTTP request
|
||||||
|
* (for an XMLHttpRequest, or the loading of the underlying resource of an
|
||||||
|
* <img>, <audio>, <video>, <style> or <link>).
|
||||||
|
*
|
||||||
|
* @category DOM Events
|
||||||
|
*/
|
||||||
|
declare var ProgressEvent: {
|
||||||
|
readonly prototype: ProgressEvent;
|
||||||
|
new (type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
|
||||||
|
};
|
||||||
|
|
||||||
/** Decodes a string of data which has been encoded using base-64 encoding.
|
/** Decodes a string of data which has been encoded using base-64 encoding.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
|
@ -214,7 +299,7 @@ declare interface TextDecodeOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
interface TextDecoder {
|
declare interface TextDecoder {
|
||||||
/** Returns encoding's name, lowercased. */
|
/** Returns encoding's name, lowercased. */
|
||||||
readonly encoding: string;
|
readonly encoding: string;
|
||||||
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
|
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
|
||||||
|
@ -228,7 +313,7 @@ interface TextDecoder {
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
declare var TextDecoder: {
|
declare var TextDecoder: {
|
||||||
prototype: TextDecoder;
|
readonly prototype: TextDecoder;
|
||||||
new (label?: string, options?: TextDecoderOptions): TextDecoder;
|
new (label?: string, options?: TextDecoderOptions): TextDecoder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -239,7 +324,7 @@ declare interface TextEncoderEncodeIntoResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
interface TextEncoder {
|
declare interface TextEncoder {
|
||||||
/** Returns "utf-8". */
|
/** Returns "utf-8". */
|
||||||
readonly encoding: "utf-8";
|
readonly encoding: "utf-8";
|
||||||
/** Returns the result of running UTF-8's encoder. */
|
/** Returns the result of running UTF-8's encoder. */
|
||||||
|
@ -249,12 +334,12 @@ interface TextEncoder {
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
declare var TextEncoder: {
|
declare var TextEncoder: {
|
||||||
prototype: TextEncoder;
|
readonly prototype: TextEncoder;
|
||||||
new (): TextEncoder;
|
new (): TextEncoder;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
interface TextDecoderStream {
|
declare interface TextDecoderStream {
|
||||||
/** Returns encoding's name, lowercased. */
|
/** Returns encoding's name, lowercased. */
|
||||||
readonly encoding: string;
|
readonly encoding: string;
|
||||||
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
|
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
|
||||||
|
@ -268,12 +353,12 @@ interface TextDecoderStream {
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
declare var TextDecoderStream: {
|
declare var TextDecoderStream: {
|
||||||
prototype: TextDecoderStream;
|
readonly prototype: TextDecoderStream;
|
||||||
new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
|
new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
interface TextEncoderStream {
|
declare interface TextEncoderStream {
|
||||||
/** Returns "utf-8". */
|
/** Returns "utf-8". */
|
||||||
readonly encoding: "utf-8";
|
readonly encoding: "utf-8";
|
||||||
readonly readable: ReadableStream<Uint8Array>;
|
readonly readable: ReadableStream<Uint8Array>;
|
||||||
|
@ -283,7 +368,7 @@ interface TextEncoderStream {
|
||||||
|
|
||||||
/** @category Encoding API */
|
/** @category Encoding API */
|
||||||
declare var TextEncoderStream: {
|
declare var TextEncoderStream: {
|
||||||
prototype: TextEncoderStream;
|
readonly prototype: TextEncoderStream;
|
||||||
new (): TextEncoderStream;
|
new (): TextEncoderStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -292,7 +377,7 @@ declare var TextEncoderStream: {
|
||||||
*
|
*
|
||||||
* @category Web APIs
|
* @category Web APIs
|
||||||
*/
|
*/
|
||||||
declare class AbortController {
|
declare interface AbortController {
|
||||||
/** Returns the AbortSignal object associated with this object. */
|
/** Returns the AbortSignal object associated with this object. */
|
||||||
readonly signal: AbortSignal;
|
readonly signal: AbortSignal;
|
||||||
/** Invoking this method will set this object's AbortSignal's aborted flag and
|
/** Invoking this method will set this object's AbortSignal's aborted flag and
|
||||||
|
@ -300,8 +385,18 @@ declare class AbortController {
|
||||||
abort(reason?: any): void;
|
abort(reason?: any): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A controller object that allows you to abort one or more DOM requests as and
|
||||||
|
* when desired.
|
||||||
|
*
|
||||||
|
* @category Web APIs
|
||||||
|
*/
|
||||||
|
declare var AbortController: {
|
||||||
|
readonly prototype: AbortController;
|
||||||
|
new (): AbortController;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
interface AbortSignalEventMap {
|
declare interface AbortSignalEventMap {
|
||||||
abort: Event;
|
abort: Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +405,7 @@ interface AbortSignalEventMap {
|
||||||
*
|
*
|
||||||
* @category Web APIs
|
* @category Web APIs
|
||||||
*/
|
*/
|
||||||
interface AbortSignal extends EventTarget {
|
declare interface AbortSignal extends EventTarget {
|
||||||
/** Returns true if this AbortSignal's AbortController has signaled to abort,
|
/** Returns true if this AbortSignal's AbortController has signaled to abort,
|
||||||
* and false otherwise. */
|
* and false otherwise. */
|
||||||
readonly aborted: boolean;
|
readonly aborted: boolean;
|
||||||
|
@ -344,14 +439,14 @@ interface AbortSignal extends EventTarget {
|
||||||
|
|
||||||
/** @category Web APIs */
|
/** @category Web APIs */
|
||||||
declare var AbortSignal: {
|
declare var AbortSignal: {
|
||||||
prototype: AbortSignal;
|
readonly prototype: AbortSignal;
|
||||||
new (): AbortSignal;
|
new (): never;
|
||||||
abort(reason?: any): AbortSignal;
|
abort(reason?: any): AbortSignal;
|
||||||
timeout(milliseconds: number): AbortSignal;
|
timeout(milliseconds: number): AbortSignal;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Web File API */
|
/** @category Web File API */
|
||||||
interface FileReaderEventMap {
|
declare interface FileReaderEventMap {
|
||||||
"abort": ProgressEvent<FileReader>;
|
"abort": ProgressEvent<FileReader>;
|
||||||
"error": ProgressEvent<FileReader>;
|
"error": ProgressEvent<FileReader>;
|
||||||
"load": ProgressEvent<FileReader>;
|
"load": ProgressEvent<FileReader>;
|
||||||
|
@ -366,7 +461,7 @@ interface FileReaderEventMap {
|
||||||
*
|
*
|
||||||
* @category Web File API
|
* @category Web File API
|
||||||
*/
|
*/
|
||||||
interface FileReader extends EventTarget {
|
declare interface FileReader extends EventTarget {
|
||||||
readonly error: DOMException | null;
|
readonly error: DOMException | null;
|
||||||
onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
||||||
onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
||||||
|
@ -410,7 +505,7 @@ interface FileReader extends EventTarget {
|
||||||
|
|
||||||
/** @category Web File API */
|
/** @category Web File API */
|
||||||
declare var FileReader: {
|
declare var FileReader: {
|
||||||
prototype: FileReader;
|
readonly prototype: FileReader;
|
||||||
new (): FileReader;
|
new (): FileReader;
|
||||||
readonly DONE: number;
|
readonly DONE: number;
|
||||||
readonly EMPTY: number;
|
readonly EMPTY: number;
|
||||||
|
@ -418,10 +513,10 @@ declare var FileReader: {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Web File API */
|
/** @category Web File API */
|
||||||
type BlobPart = BufferSource | Blob | string;
|
declare type BlobPart = BufferSource | Blob | string;
|
||||||
|
|
||||||
/** @category Web File API */
|
/** @category Web File API */
|
||||||
interface BlobPropertyBag {
|
declare interface BlobPropertyBag {
|
||||||
type?: string;
|
type?: string;
|
||||||
endings?: "transparent" | "native";
|
endings?: "transparent" | "native";
|
||||||
}
|
}
|
||||||
|
@ -433,9 +528,7 @@ interface BlobPropertyBag {
|
||||||
*
|
*
|
||||||
* @category Web File API
|
* @category Web File API
|
||||||
*/
|
*/
|
||||||
declare class Blob {
|
declare interface Blob {
|
||||||
constructor(blobParts?: BlobPart[], options?: BlobPropertyBag);
|
|
||||||
|
|
||||||
readonly size: number;
|
readonly size: number;
|
||||||
readonly type: string;
|
readonly type: string;
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
arrayBuffer(): Promise<ArrayBuffer>;
|
||||||
|
@ -444,8 +537,20 @@ declare class Blob {
|
||||||
text(): Promise<string>;
|
text(): Promise<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 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.
|
||||||
|
*
|
||||||
|
* @category Web File API
|
||||||
|
*/
|
||||||
|
declare var Blob: {
|
||||||
|
readonly prototype: Blob;
|
||||||
|
new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web File API */
|
/** @category Web File API */
|
||||||
interface FilePropertyBag extends BlobPropertyBag {
|
declare interface FilePropertyBag extends BlobPropertyBag {
|
||||||
lastModified?: number;
|
lastModified?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,36 +559,40 @@ interface FilePropertyBag extends BlobPropertyBag {
|
||||||
*
|
*
|
||||||
* @category Web File API
|
* @category Web File API
|
||||||
*/
|
*/
|
||||||
declare class File extends Blob {
|
declare interface File extends Blob {
|
||||||
constructor(
|
|
||||||
fileBits: BlobPart[],
|
|
||||||
fileName: string,
|
|
||||||
options?: FilePropertyBag,
|
|
||||||
);
|
|
||||||
|
|
||||||
readonly lastModified: number;
|
readonly lastModified: number;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Provides information about files and allows JavaScript in a web page to
|
||||||
|
* access their content.
|
||||||
|
*
|
||||||
|
* @category Web File API
|
||||||
|
*/
|
||||||
|
declare var File: {
|
||||||
|
readonly prototype: File;
|
||||||
|
new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamDefaultReadDoneResult {
|
declare interface ReadableStreamDefaultReadDoneResult {
|
||||||
done: true;
|
done: true;
|
||||||
value?: undefined;
|
value?: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamDefaultReadValueResult<T> {
|
declare interface ReadableStreamDefaultReadValueResult<T> {
|
||||||
done: false;
|
done: false;
|
||||||
value: T;
|
value: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
type ReadableStreamDefaultReadResult<T> =
|
declare type ReadableStreamDefaultReadResult<T> =
|
||||||
| ReadableStreamDefaultReadValueResult<T>
|
| ReadableStreamDefaultReadValueResult<T>
|
||||||
| ReadableStreamDefaultReadDoneResult;
|
| ReadableStreamDefaultReadDoneResult;
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamDefaultReader<R = any> {
|
declare interface ReadableStreamDefaultReader<R = any> {
|
||||||
readonly closed: Promise<void>;
|
readonly closed: Promise<void>;
|
||||||
cancel(reason?: any): Promise<void>;
|
cancel(reason?: any): Promise<void>;
|
||||||
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
||||||
|
@ -492,29 +601,29 @@ interface ReadableStreamDefaultReader<R = any> {
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var ReadableStreamDefaultReader: {
|
declare var ReadableStreamDefaultReader: {
|
||||||
prototype: ReadableStreamDefaultReader;
|
readonly prototype: ReadableStreamDefaultReader;
|
||||||
new <R>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
|
new <R>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamBYOBReadDoneResult<V extends ArrayBufferView> {
|
declare interface ReadableStreamBYOBReadDoneResult<V extends ArrayBufferView> {
|
||||||
done: true;
|
done: true;
|
||||||
value?: V;
|
value?: V;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamBYOBReadValueResult<V extends ArrayBufferView> {
|
declare interface ReadableStreamBYOBReadValueResult<V extends ArrayBufferView> {
|
||||||
done: false;
|
done: false;
|
||||||
value: V;
|
value: V;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
type ReadableStreamBYOBReadResult<V extends ArrayBufferView> =
|
declare type ReadableStreamBYOBReadResult<V extends ArrayBufferView> =
|
||||||
| ReadableStreamBYOBReadDoneResult<V>
|
| ReadableStreamBYOBReadDoneResult<V>
|
||||||
| ReadableStreamBYOBReadValueResult<V>;
|
| ReadableStreamBYOBReadValueResult<V>;
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamBYOBReader {
|
declare interface ReadableStreamBYOBReader {
|
||||||
readonly closed: Promise<void>;
|
readonly closed: Promise<void>;
|
||||||
cancel(reason?: any): Promise<void>;
|
cancel(reason?: any): Promise<void>;
|
||||||
read<V extends ArrayBufferView>(
|
read<V extends ArrayBufferView>(
|
||||||
|
@ -525,24 +634,30 @@ interface ReadableStreamBYOBReader {
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var ReadableStreamBYOBReader: {
|
declare var ReadableStreamBYOBReader: {
|
||||||
prototype: ReadableStreamBYOBReader;
|
readonly prototype: ReadableStreamBYOBReader;
|
||||||
new (stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader;
|
new (stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamBYOBRequest {
|
declare interface ReadableStreamBYOBRequest {
|
||||||
readonly view: ArrayBufferView | null;
|
readonly view: ArrayBufferView | null;
|
||||||
respond(bytesWritten: number): void;
|
respond(bytesWritten: number): void;
|
||||||
respondWithNewView(view: ArrayBufferView): void;
|
respondWithNewView(view: ArrayBufferView): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableByteStreamControllerCallback {
|
declare var ReadableStreamBYOBRequest: {
|
||||||
|
readonly prototype: ReadableStreamBYOBRequest;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @category Streams API */
|
||||||
|
declare interface ReadableByteStreamControllerCallback {
|
||||||
(controller: ReadableByteStreamController): void | PromiseLike<void>;
|
(controller: ReadableByteStreamController): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface UnderlyingByteSource {
|
declare interface UnderlyingByteSource {
|
||||||
autoAllocateChunkSize?: number;
|
autoAllocateChunkSize?: number;
|
||||||
cancel?: ReadableStreamErrorCallback;
|
cancel?: ReadableStreamErrorCallback;
|
||||||
pull?: ReadableByteStreamControllerCallback;
|
pull?: ReadableByteStreamControllerCallback;
|
||||||
|
@ -551,7 +666,7 @@ interface UnderlyingByteSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface UnderlyingSink<W = any> {
|
declare interface UnderlyingSink<W = any> {
|
||||||
abort?: WritableStreamErrorCallback;
|
abort?: WritableStreamErrorCallback;
|
||||||
close?: WritableStreamDefaultControllerCloseCallback;
|
close?: WritableStreamDefaultControllerCloseCallback;
|
||||||
start?: WritableStreamDefaultControllerStartCallback;
|
start?: WritableStreamDefaultControllerStartCallback;
|
||||||
|
@ -560,7 +675,7 @@ interface UnderlyingSink<W = any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface UnderlyingSource<R = any> {
|
declare interface UnderlyingSource<R = any> {
|
||||||
cancel?: ReadableStreamErrorCallback;
|
cancel?: ReadableStreamErrorCallback;
|
||||||
pull?: ReadableStreamDefaultControllerCallback<R>;
|
pull?: ReadableStreamDefaultControllerCallback<R>;
|
||||||
start?: ReadableStreamDefaultControllerCallback<R>;
|
start?: ReadableStreamDefaultControllerCallback<R>;
|
||||||
|
@ -568,17 +683,17 @@ interface UnderlyingSource<R = any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamErrorCallback {
|
declare interface ReadableStreamErrorCallback {
|
||||||
(reason: any): void | PromiseLike<void>;
|
(reason: any): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamDefaultControllerCallback<R> {
|
declare interface ReadableStreamDefaultControllerCallback<R> {
|
||||||
(controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
|
(controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableStreamDefaultController<R = any> {
|
declare interface ReadableStreamDefaultController<R = any> {
|
||||||
readonly desiredSize: number | null;
|
readonly desiredSize: number | null;
|
||||||
close(): void;
|
close(): void;
|
||||||
enqueue(chunk: R): void;
|
enqueue(chunk: R): void;
|
||||||
|
@ -587,12 +702,12 @@ interface ReadableStreamDefaultController<R = any> {
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var ReadableStreamDefaultController: {
|
declare var ReadableStreamDefaultController: {
|
||||||
prototype: ReadableStreamDefaultController;
|
readonly prototype: ReadableStreamDefaultController;
|
||||||
new (): ReadableStreamDefaultController;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ReadableByteStreamController {
|
declare interface ReadableByteStreamController {
|
||||||
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
||||||
readonly desiredSize: number | null;
|
readonly desiredSize: number | null;
|
||||||
close(): void;
|
close(): void;
|
||||||
|
@ -602,12 +717,12 @@ interface ReadableByteStreamController {
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var ReadableByteStreamController: {
|
declare var ReadableByteStreamController: {
|
||||||
prototype: ReadableByteStreamController;
|
readonly prototype: ReadableByteStreamController;
|
||||||
new (): ReadableByteStreamController;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface PipeOptions {
|
declare interface PipeOptions {
|
||||||
preventAbort?: boolean;
|
preventAbort?: boolean;
|
||||||
preventCancel?: boolean;
|
preventCancel?: boolean;
|
||||||
preventClose?: boolean;
|
preventClose?: boolean;
|
||||||
|
@ -615,12 +730,12 @@ interface PipeOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface QueuingStrategySizeCallback<T = any> {
|
declare interface QueuingStrategySizeCallback<T = any> {
|
||||||
(chunk: T): number;
|
(chunk: T): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface QueuingStrategy<T = any> {
|
declare interface QueuingStrategy<T = any> {
|
||||||
highWaterMark?: number;
|
highWaterMark?: number;
|
||||||
size?: QueuingStrategySizeCallback<T>;
|
size?: QueuingStrategySizeCallback<T>;
|
||||||
}
|
}
|
||||||
|
@ -630,26 +745,27 @@ interface QueuingStrategy<T = any> {
|
||||||
*
|
*
|
||||||
* @category Streams API
|
* @category Streams API
|
||||||
*/
|
*/
|
||||||
interface CountQueuingStrategy extends QueuingStrategy {
|
declare interface CountQueuingStrategy extends QueuingStrategy {
|
||||||
highWaterMark: number;
|
highWaterMark: number;
|
||||||
size(chunk: any): 1;
|
size(chunk: any): 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var CountQueuingStrategy: {
|
declare var CountQueuingStrategy: {
|
||||||
prototype: CountQueuingStrategy;
|
readonly prototype: CountQueuingStrategy;
|
||||||
new (options: { highWaterMark: number }): CountQueuingStrategy;
|
new (options: { highWaterMark: number }): CountQueuingStrategy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
|
declare interface ByteLengthQueuingStrategy
|
||||||
|
extends QueuingStrategy<ArrayBufferView> {
|
||||||
highWaterMark: number;
|
highWaterMark: number;
|
||||||
size(chunk: ArrayBufferView): number;
|
size(chunk: ArrayBufferView): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var ByteLengthQueuingStrategy: {
|
declare var ByteLengthQueuingStrategy: {
|
||||||
prototype: ByteLengthQueuingStrategy;
|
readonly prototype: ByteLengthQueuingStrategy;
|
||||||
new (options: { highWaterMark: number }): ByteLengthQueuingStrategy;
|
new (options: { highWaterMark: number }): ByteLengthQueuingStrategy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -659,7 +775,7 @@ declare var ByteLengthQueuingStrategy: {
|
||||||
*
|
*
|
||||||
* @category Streams API
|
* @category Streams API
|
||||||
*/
|
*/
|
||||||
interface ReadableStream<R = any> {
|
declare interface ReadableStream<R = any> {
|
||||||
readonly locked: boolean;
|
readonly locked: boolean;
|
||||||
cancel(reason?: any): Promise<void>;
|
cancel(reason?: any): Promise<void>;
|
||||||
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
||||||
|
@ -670,6 +786,9 @@ interface ReadableStream<R = any> {
|
||||||
}, options?: PipeOptions): ReadableStream<T>;
|
}, options?: PipeOptions): ReadableStream<T>;
|
||||||
pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
|
pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
|
||||||
tee(): [ReadableStream<R>, ReadableStream<R>];
|
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||||
|
values(options?: {
|
||||||
|
preventCancel?: boolean;
|
||||||
|
}): AsyncIterableIterator<R>;
|
||||||
[Symbol.asyncIterator](options?: {
|
[Symbol.asyncIterator](options?: {
|
||||||
preventCancel?: boolean;
|
preventCancel?: boolean;
|
||||||
}): AsyncIterableIterator<R>;
|
}): AsyncIterableIterator<R>;
|
||||||
|
@ -677,7 +796,7 @@ interface ReadableStream<R = any> {
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var ReadableStream: {
|
declare var ReadableStream: {
|
||||||
prototype: ReadableStream;
|
readonly prototype: ReadableStream;
|
||||||
new (
|
new (
|
||||||
underlyingSource: UnderlyingByteSource,
|
underlyingSource: UnderlyingByteSource,
|
||||||
strategy?: { highWaterMark?: number; size?: undefined },
|
strategy?: { highWaterMark?: number; size?: undefined },
|
||||||
|
@ -686,20 +805,23 @@ declare var ReadableStream: {
|
||||||
underlyingSource?: UnderlyingSource<R>,
|
underlyingSource?: UnderlyingSource<R>,
|
||||||
strategy?: QueuingStrategy<R>,
|
strategy?: QueuingStrategy<R>,
|
||||||
): ReadableStream<R>;
|
): ReadableStream<R>;
|
||||||
|
from<R>(
|
||||||
|
asyncIterable: AsyncIterable<R> | Iterable<R | PromiseLike<R>>,
|
||||||
|
): ReadableStream<R>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface WritableStreamDefaultControllerCloseCallback {
|
declare interface WritableStreamDefaultControllerCloseCallback {
|
||||||
(): void | PromiseLike<void>;
|
(): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface WritableStreamDefaultControllerStartCallback {
|
declare interface WritableStreamDefaultControllerStartCallback {
|
||||||
(controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
(controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface WritableStreamDefaultControllerWriteCallback<W> {
|
declare interface WritableStreamDefaultControllerWriteCallback<W> {
|
||||||
(chunk: W, controller: WritableStreamDefaultController):
|
(chunk: W, controller: WritableStreamDefaultController):
|
||||||
| void
|
| void
|
||||||
| PromiseLike<
|
| PromiseLike<
|
||||||
|
@ -708,7 +830,7 @@ interface WritableStreamDefaultControllerWriteCallback<W> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface WritableStreamErrorCallback {
|
declare interface WritableStreamErrorCallback {
|
||||||
(reason: any): void | PromiseLike<void>;
|
(reason: any): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,7 +840,7 @@ interface WritableStreamErrorCallback {
|
||||||
*
|
*
|
||||||
* @category Streams API
|
* @category Streams API
|
||||||
*/
|
*/
|
||||||
interface WritableStream<W = any> {
|
declare interface WritableStream<W = any> {
|
||||||
readonly locked: boolean;
|
readonly locked: boolean;
|
||||||
abort(reason?: any): Promise<void>;
|
abort(reason?: any): Promise<void>;
|
||||||
close(): Promise<void>;
|
close(): Promise<void>;
|
||||||
|
@ -727,7 +849,7 @@ interface WritableStream<W = any> {
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var WritableStream: {
|
declare var WritableStream: {
|
||||||
prototype: WritableStream;
|
readonly prototype: WritableStream;
|
||||||
new <W = any>(
|
new <W = any>(
|
||||||
underlyingSink?: UnderlyingSink<W>,
|
underlyingSink?: UnderlyingSink<W>,
|
||||||
strategy?: QueuingStrategy<W>,
|
strategy?: QueuingStrategy<W>,
|
||||||
|
@ -741,13 +863,16 @@ declare var WritableStream: {
|
||||||
*
|
*
|
||||||
* @category Streams API
|
* @category Streams API
|
||||||
*/
|
*/
|
||||||
interface WritableStreamDefaultController {
|
declare interface WritableStreamDefaultController {
|
||||||
signal: AbortSignal;
|
signal: AbortSignal;
|
||||||
error(error?: any): void;
|
error(error?: any): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var WritableStreamDefaultController: WritableStreamDefaultController;
|
declare var WritableStreamDefaultController: {
|
||||||
|
readonly prototype: WritableStreamDefaultController;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** This Streams API interface is the object returned by
|
/** This Streams API interface is the object returned by
|
||||||
* WritableStream.getWriter() and once created locks the < writer to the
|
* WritableStream.getWriter() and once created locks the < writer to the
|
||||||
|
@ -756,7 +881,7 @@ declare var WritableStreamDefaultController: WritableStreamDefaultController;
|
||||||
*
|
*
|
||||||
* @category Streams API
|
* @category Streams API
|
||||||
*/
|
*/
|
||||||
interface WritableStreamDefaultWriter<W = any> {
|
declare interface WritableStreamDefaultWriter<W = any> {
|
||||||
readonly closed: Promise<void>;
|
readonly closed: Promise<void>;
|
||||||
readonly desiredSize: number | null;
|
readonly desiredSize: number | null;
|
||||||
readonly ready: Promise<void>;
|
readonly ready: Promise<void>;
|
||||||
|
@ -768,19 +893,19 @@ interface WritableStreamDefaultWriter<W = any> {
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var WritableStreamDefaultWriter: {
|
declare var WritableStreamDefaultWriter: {
|
||||||
prototype: WritableStreamDefaultWriter;
|
readonly prototype: WritableStreamDefaultWriter;
|
||||||
new (): WritableStreamDefaultWriter;
|
new <W>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface TransformStream<I = any, O = any> {
|
declare interface TransformStream<I = any, O = any> {
|
||||||
readonly readable: ReadableStream<O>;
|
readonly readable: ReadableStream<O>;
|
||||||
readonly writable: WritableStream<I>;
|
readonly writable: WritableStream<I>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var TransformStream: {
|
declare var TransformStream: {
|
||||||
prototype: TransformStream;
|
readonly prototype: TransformStream;
|
||||||
new <I = any, O = any>(
|
new <I = any, O = any>(
|
||||||
transformer?: Transformer<I, O>,
|
transformer?: Transformer<I, O>,
|
||||||
writableStrategy?: QueuingStrategy<I>,
|
writableStrategy?: QueuingStrategy<I>,
|
||||||
|
@ -789,7 +914,7 @@ declare var TransformStream: {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface TransformStreamDefaultController<O = any> {
|
declare interface TransformStreamDefaultController<O = any> {
|
||||||
readonly desiredSize: number | null;
|
readonly desiredSize: number | null;
|
||||||
enqueue(chunk: O): void;
|
enqueue(chunk: O): void;
|
||||||
error(reason?: any): void;
|
error(reason?: any): void;
|
||||||
|
@ -797,10 +922,13 @@ interface TransformStreamDefaultController<O = any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
declare var TransformStreamDefaultController: TransformStreamDefaultController;
|
declare var TransformStreamDefaultController: {
|
||||||
|
readonly prototype: TransformStreamDefaultController;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface Transformer<I = any, O = any> {
|
declare interface Transformer<I = any, O = any> {
|
||||||
flush?: TransformStreamDefaultControllerCallback<O>;
|
flush?: TransformStreamDefaultControllerCallback<O>;
|
||||||
readableType?: undefined;
|
readableType?: undefined;
|
||||||
start?: TransformStreamDefaultControllerCallback<O>;
|
start?: TransformStreamDefaultControllerCallback<O>;
|
||||||
|
@ -809,44 +937,54 @@ interface Transformer<I = any, O = any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface TransformStreamDefaultControllerCallback<O> {
|
declare interface TransformStreamDefaultControllerCallback<O> {
|
||||||
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category Streams API */
|
||||||
interface TransformStreamDefaultControllerTransformCallback<I, O> {
|
declare interface TransformStreamDefaultControllerTransformCallback<I, O> {
|
||||||
(
|
(
|
||||||
chunk: I,
|
chunk: I,
|
||||||
controller: TransformStreamDefaultController<O>,
|
controller: TransformStreamDefaultController<O>,
|
||||||
): void | PromiseLike<void>;
|
): void | PromiseLike<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category DOM APIs */
|
||||||
interface MessageEventInit<T = any> extends EventInit {
|
declare interface MessageEventInit<T = any> extends EventInit {
|
||||||
data?: T;
|
data?: T;
|
||||||
origin?: string;
|
origin?: string;
|
||||||
lastEventId?: string;
|
lastEventId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Streams API */
|
/** @category DOM APIs */
|
||||||
declare class MessageEvent<T = any> extends Event {
|
declare interface MessageEvent<T = any> extends Event {
|
||||||
/**
|
/**
|
||||||
* Returns the data of the message.
|
* Returns the data of the message.
|
||||||
*/
|
*/
|
||||||
readonly data: T;
|
readonly data: T;
|
||||||
|
/**
|
||||||
|
* Returns the origin of the message, for server-sent events.
|
||||||
|
*/
|
||||||
|
readonly origin: string;
|
||||||
/**
|
/**
|
||||||
* Returns the last event ID string, for server-sent events.
|
* Returns the last event ID string, for server-sent events.
|
||||||
*/
|
*/
|
||||||
readonly lastEventId: string;
|
readonly lastEventId: string;
|
||||||
|
readonly source: null;
|
||||||
/**
|
/**
|
||||||
* Returns transferred ports.
|
* Returns transferred ports.
|
||||||
*/
|
*/
|
||||||
readonly ports: ReadonlyArray<MessagePort>;
|
readonly ports: ReadonlyArray<MessagePort>;
|
||||||
constructor(type: string, eventInitDict?: MessageEventInit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category DOM APIs */
|
/** @category DOM APIs */
|
||||||
type Transferable = ArrayBuffer | MessagePort;
|
declare var MessageEvent: {
|
||||||
|
readonly prototype: MessageEvent;
|
||||||
|
new <T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @category DOM APIs */
|
||||||
|
declare type Transferable = ArrayBuffer | MessagePort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This type has been renamed to StructuredSerializeOptions. Use that type for
|
* This type has been renamed to StructuredSerializeOptions. Use that type for
|
||||||
|
@ -855,10 +993,10 @@ type Transferable = ArrayBuffer | MessagePort;
|
||||||
* @deprecated use `StructuredSerializeOptions` instead.
|
* @deprecated use `StructuredSerializeOptions` instead.
|
||||||
* @category DOM APIs
|
* @category DOM APIs
|
||||||
*/
|
*/
|
||||||
type PostMessageOptions = StructuredSerializeOptions;
|
declare type PostMessageOptions = StructuredSerializeOptions;
|
||||||
|
|
||||||
/** @category DOM APIs */
|
/** @category DOM APIs */
|
||||||
interface StructuredSerializeOptions {
|
declare interface StructuredSerializeOptions {
|
||||||
transfer?: Transferable[];
|
transfer?: Transferable[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,14 +1006,24 @@ interface StructuredSerializeOptions {
|
||||||
*
|
*
|
||||||
* @category DOM APIs
|
* @category DOM APIs
|
||||||
*/
|
*/
|
||||||
declare class MessageChannel {
|
declare interface MessageChannel {
|
||||||
constructor();
|
|
||||||
readonly port1: MessagePort;
|
readonly port1: MessagePort;
|
||||||
readonly port2: MessagePort;
|
readonly port2: MessagePort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The MessageChannel interface of the Channel Messaging API allows us to
|
||||||
|
* create a new message channel and send data through it via its two MessagePort
|
||||||
|
* properties.
|
||||||
|
*
|
||||||
|
* @category DOM APIs
|
||||||
|
*/
|
||||||
|
declare var MessageChannel: {
|
||||||
|
readonly prototype: MessageChannel;
|
||||||
|
new (): MessageChannel;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category DOM APIs */
|
/** @category DOM APIs */
|
||||||
interface MessagePortEventMap {
|
declare interface MessagePortEventMap {
|
||||||
"message": MessageEvent;
|
"message": MessageEvent;
|
||||||
"messageerror": MessageEvent;
|
"messageerror": MessageEvent;
|
||||||
}
|
}
|
||||||
|
@ -886,7 +1034,7 @@ interface MessagePortEventMap {
|
||||||
*
|
*
|
||||||
* @category DOM APIs
|
* @category DOM APIs
|
||||||
*/
|
*/
|
||||||
declare class MessagePort extends EventTarget {
|
declare interface MessagePort extends EventTarget {
|
||||||
onmessage: ((this: MessagePort, ev: MessageEvent) => any) | null;
|
onmessage: ((this: MessagePort, ev: MessageEvent) => any) | null;
|
||||||
onmessageerror: ((this: MessagePort, ev: MessageEvent) => any) | null;
|
onmessageerror: ((this: MessagePort, ev: MessageEvent) => any) | null;
|
||||||
/**
|
/**
|
||||||
|
@ -930,6 +1078,17 @@ declare class MessagePort extends EventTarget {
|
||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The MessagePort interface of the Channel Messaging API represents one of the
|
||||||
|
* two ports of a MessageChannel, allowing messages to be sent from one port and
|
||||||
|
* listening out for them arriving at the other.
|
||||||
|
*
|
||||||
|
* @category DOM APIs
|
||||||
|
*/
|
||||||
|
declare var MessagePort: {
|
||||||
|
readonly prototype: MessagePort;
|
||||||
|
new (): never;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a deep copy of a given value using the structured clone algorithm.
|
* Creates a deep copy of a given value using the structured clone algorithm.
|
||||||
*
|
*
|
||||||
|
@ -974,7 +1133,25 @@ declare function structuredClone(
|
||||||
*
|
*
|
||||||
* @category Compression Streams API
|
* @category Compression Streams API
|
||||||
*/
|
*/
|
||||||
declare class CompressionStream {
|
declare interface CompressionStream {
|
||||||
|
readonly readable: ReadableStream<Uint8Array>;
|
||||||
|
readonly writable: WritableStream<Uint8Array>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An API for compressing a stream of data.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```ts
|
||||||
|
* await Deno.stdin.readable
|
||||||
|
* .pipeThrough(new CompressionStream("gzip"))
|
||||||
|
* .pipeTo(Deno.stdout.writable);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @category Compression Streams API
|
||||||
|
*/
|
||||||
|
declare var CompressionStream: {
|
||||||
|
readonly prototype: CompressionStream;
|
||||||
/**
|
/**
|
||||||
* Creates a new `CompressionStream` object which compresses a stream of
|
* Creates a new `CompressionStream` object which compresses a stream of
|
||||||
* data.
|
* data.
|
||||||
|
@ -982,8 +1159,25 @@ declare class CompressionStream {
|
||||||
* Throws a `TypeError` if the format passed to the constructor is not
|
* Throws a `TypeError` if the format passed to the constructor is not
|
||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
constructor(format: string);
|
new (format: string): CompressionStream;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An API for decompressing a stream of data.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```ts
|
||||||
|
* const input = await Deno.open("./file.txt.gz");
|
||||||
|
* const output = await Deno.create("./file.txt");
|
||||||
|
*
|
||||||
|
* await input.readable
|
||||||
|
* .pipeThrough(new DecompressionStream("gzip"))
|
||||||
|
* .pipeTo(output.writable);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @category Compression Streams API
|
||||||
|
*/
|
||||||
|
declare interface DecompressionStream {
|
||||||
readonly readable: ReadableStream<Uint8Array>;
|
readonly readable: ReadableStream<Uint8Array>;
|
||||||
readonly writable: WritableStream<Uint8Array>;
|
readonly writable: WritableStream<Uint8Array>;
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +1197,8 @@ declare class CompressionStream {
|
||||||
*
|
*
|
||||||
* @category Compression Streams API
|
* @category Compression Streams API
|
||||||
*/
|
*/
|
||||||
declare class DecompressionStream {
|
declare var DecompressionStream: {
|
||||||
|
readonly prototype: DecompressionStream;
|
||||||
/**
|
/**
|
||||||
* Creates a new `DecompressionStream` object which decompresses a stream of
|
* Creates a new `DecompressionStream` object which decompresses a stream of
|
||||||
* data.
|
* data.
|
||||||
|
@ -1011,11 +1206,8 @@ declare class DecompressionStream {
|
||||||
* Throws a `TypeError` if the format passed to the constructor is not
|
* Throws a `TypeError` if the format passed to the constructor is not
|
||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
constructor(format: string);
|
new (format: string): DecompressionStream;
|
||||||
|
};
|
||||||
readonly readable: ReadableStream<Uint8Array>;
|
|
||||||
readonly writable: WritableStream<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Dispatch an uncaught exception. Similar to a synchronous version of:
|
/** Dispatch an uncaught exception. Similar to a synchronous version of:
|
||||||
* ```ts
|
* ```ts
|
||||||
|
|
35
ext/websocket/lib.deno_websocket.d.ts
vendored
35
ext/websocket/lib.deno_websocket.d.ts
vendored
|
@ -1,20 +1,19 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
// deno-lint-ignore-file no-explicit-any
|
// deno-lint-ignore-file no-explicit-any no-var
|
||||||
|
|
||||||
/// <reference no-default-lib="true" />
|
/// <reference no-default-lib="true" />
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
/** @category Web Sockets */
|
/** @category Web Sockets */
|
||||||
interface CloseEventInit extends EventInit {
|
declare interface CloseEventInit extends EventInit {
|
||||||
code?: number;
|
code?: number;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
wasClean?: boolean;
|
wasClean?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Sockets */
|
/** @category Web Sockets */
|
||||||
declare class CloseEvent extends Event {
|
declare interface CloseEvent extends Event {
|
||||||
constructor(type: string, eventInitDict?: CloseEventInit);
|
|
||||||
/**
|
/**
|
||||||
* Returns the WebSocket connection close code provided by the server.
|
* Returns the WebSocket connection close code provided by the server.
|
||||||
*/
|
*/
|
||||||
|
@ -29,8 +28,13 @@ declare class CloseEvent extends Event {
|
||||||
readonly wasClean: boolean;
|
readonly wasClean: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare var CloseEvent: {
|
||||||
|
readonly prototype: CloseEvent;
|
||||||
|
new (type: string, eventInitDict?: CloseEventInit): CloseEvent;
|
||||||
|
};
|
||||||
|
|
||||||
/** @category Web Sockets */
|
/** @category Web Sockets */
|
||||||
interface WebSocketEventMap {
|
declare interface WebSocketEventMap {
|
||||||
close: CloseEvent;
|
close: CloseEvent;
|
||||||
error: Event;
|
error: Event;
|
||||||
message: MessageEvent;
|
message: MessageEvent;
|
||||||
|
@ -47,14 +51,7 @@ interface WebSocketEventMap {
|
||||||
* @tags allow-net
|
* @tags allow-net
|
||||||
* @category Web Sockets
|
* @category Web Sockets
|
||||||
*/
|
*/
|
||||||
declare class WebSocket extends EventTarget {
|
declare interface WebSocket extends EventTarget {
|
||||||
constructor(url: string | URL, protocols?: string | string[]);
|
|
||||||
|
|
||||||
static readonly CLOSED: number;
|
|
||||||
static readonly CLOSING: number;
|
|
||||||
static readonly CONNECTING: number;
|
|
||||||
static readonly OPEN: number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string that indicates how binary data from the WebSocket object is exposed to scripts:
|
* Returns a string that indicates how binary data from the WebSocket object is exposed to scripts:
|
||||||
*
|
*
|
||||||
|
@ -122,4 +119,14 @@ declare class WebSocket extends EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Web Sockets */
|
/** @category Web Sockets */
|
||||||
type BinaryType = "arraybuffer" | "blob";
|
declare var WebSocket: {
|
||||||
|
readonly prototype: WebSocket;
|
||||||
|
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
||||||
|
readonly CLOSED: number;
|
||||||
|
readonly CLOSING: number;
|
||||||
|
readonly CONNECTING: number;
|
||||||
|
readonly OPEN: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @category Web Sockets */
|
||||||
|
declare type BinaryType = "arraybuffer" | "blob";
|
||||||
|
|
6
ext/webstorage/lib.deno_webstorage.d.ts
vendored
6
ext/webstorage/lib.deno_webstorage.d.ts
vendored
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @category Web Storage API
|
* @category Web Storage API
|
||||||
*/
|
*/
|
||||||
interface Storage {
|
declare interface Storage {
|
||||||
/**
|
/**
|
||||||
* Returns the number of key/value pairs currently present in the list associated with the object.
|
* Returns the number of key/value pairs currently present in the list associated with the object.
|
||||||
*/
|
*/
|
||||||
|
@ -43,6 +43,6 @@ interface Storage {
|
||||||
|
|
||||||
/** @category Web Storage API */
|
/** @category Web Storage API */
|
||||||
declare var Storage: {
|
declare var Storage: {
|
||||||
prototype: Storage;
|
readonly prototype: Storage;
|
||||||
new (): Storage;
|
new (): never;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue