diff options
Diffstat (limited to 'cli/dts/lib.webworker.d.ts')
-rw-r--r-- | cli/dts/lib.webworker.d.ts | 253 |
1 files changed, 114 insertions, 139 deletions
diff --git a/cli/dts/lib.webworker.d.ts b/cli/dts/lib.webworker.d.ts index 87a1e77a1..1e0472624 100644 --- a/cli/dts/lib.webworker.d.ts +++ b/cli/dts/lib.webworker.d.ts @@ -263,6 +263,10 @@ interface ImageEncodeOptions { type?: string; } +interface ImportMeta { + url: string; +} + interface JsonWebKey { alg?: string; crv?: string; @@ -354,13 +358,6 @@ interface PermissionDescriptor { name: PermissionName; } -interface PipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - preventClose?: boolean; - signal?: AbortSignal; -} - interface PostMessageOptions { transfer?: any[]; } @@ -403,19 +400,38 @@ interface PushSubscriptionOptionsInit { interface QueuingStrategy<T = any> { highWaterMark?: number; - size?: QueuingStrategySizeCallback<T>; + size?: QueuingStrategySize<T>; +} + +interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water mark. + * + * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. + */ + highWaterMark: number; } -interface ReadableStreamReadDoneResult<T> { +interface ReadableStreamDefaultReadDoneResult { done: true; - value?: T; + value?: undefined; } -interface ReadableStreamReadValueResult<T> { +interface ReadableStreamDefaultReadValueResult<T> { done: false; value: T; } +interface ReadableWritablePair<R = any, W = any> { + readable: ReadableStream<R>; + /** + * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + */ + writable: WritableStream<W>; +} + interface RegistrationOptions { scope?: string; type?: WorkerType; @@ -515,6 +531,30 @@ interface StorageEstimate { usage?: number; } +interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate as follows: + * + * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. + * + * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. + * + * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * + * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. + * + * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. + */ + preventClose?: boolean; + signal?: AbortSignal; +} + interface SyncEventInit extends ExtendableEventInit { lastChance?: boolean; tag: string; @@ -535,33 +575,25 @@ interface TextEncoderEncodeIntoResult { } interface Transformer<I = any, O = any> { - flush?: TransformStreamDefaultControllerCallback<O>; + flush?: TransformerFlushCallback<O>; readableType?: undefined; - start?: TransformStreamDefaultControllerCallback<O>; - transform?: TransformStreamDefaultControllerTransformCallback<I, O>; + start?: TransformerStartCallback<O>; + transform?: TransformerTransformCallback<I, O>; writableType?: undefined; } -interface UnderlyingByteSource { - autoAllocateChunkSize?: number; - cancel?: ReadableStreamErrorCallback; - pull?: ReadableByteStreamControllerCallback; - start?: ReadableByteStreamControllerCallback; - type: "bytes"; -} - interface UnderlyingSink<W = any> { - abort?: WritableStreamErrorCallback; - close?: WritableStreamDefaultControllerCloseCallback; - start?: WritableStreamDefaultControllerStartCallback; + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; type?: undefined; - write?: WritableStreamDefaultControllerWriteCallback<W>; + write?: UnderlyingSinkWriteCallback<W>; } interface UnderlyingSource<R = any> { - cancel?: ReadableStreamErrorCallback; - pull?: ReadableStreamDefaultControllerCallback<R>; - start?: ReadableStreamDefaultControllerCallback<R>; + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback<R>; + start?: UnderlyingSourceStartCallback<R>; type?: undefined; } @@ -721,13 +753,13 @@ declare var BroadcastChannel: { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> { - highWaterMark: number; - size(chunk: ArrayBufferView): number; + readonly highWaterMark: number; + readonly size: QueuingStrategySize<ArrayBufferView>; } declare var ByteLengthQueuingStrategy: { prototype: ByteLengthQueuingStrategy; - new(options: { highWaterMark: number }): ByteLengthQueuingStrategy; + new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; /** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */ @@ -920,7 +952,7 @@ declare var Client: { interface Clients { claim(): Promise<void>; get(id: string): Promise<Client | undefined>; - matchAll(options?: ClientQueryOptions): Promise<ReadonlyArray<Client>>; + matchAll<T extends ClientQueryOptions>(options?: T): Promise<ReadonlyArray<T["type"] extends "window" ? WindowClient : Client>>; openWindow(url: string): Promise<WindowClient | null>; } @@ -961,13 +993,13 @@ interface ConcatParams extends Algorithm { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface CountQueuingStrategy extends QueuingStrategy { - highWaterMark: number; - size(chunk: any): 1; + readonly highWaterMark: number; + readonly size: QueuingStrategySize; } declare var CountQueuingStrategy: { prototype: CountQueuingStrategy; - new(options: { highWaterMark: number }): CountQueuingStrategy; + new(init: QueuingStrategyInit): CountQueuingStrategy; }; /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ @@ -1644,24 +1676,7 @@ declare var FormData: { }; interface GenericTransformStream { - /** - * Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable. - */ readonly readable: ReadableStream; - /** - * Returns a writable stream which accepts [AllowShared] BufferSource chunks and runs them through encoding's decoder before making them available to readable. - * - * Typically this will be used via the pipeThrough() method on a ReadableStream source. - * - * ``` - * var decoder = new TextDecoderStream(encoding); - * byteReadable - * .pipeThrough(decoder) - * .pipeTo(textWritable); - * ``` - * - * If the error mode is "fatal" and encoding's decoder returns error, both readable and writable will be errored with a TypeError. - */ readonly writable: WritableStream; } @@ -2727,64 +2742,26 @@ declare var PushSubscriptionOptions: { new(): PushSubscriptionOptions; }; -interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | undefined; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBufferView): void; - error(error?: any): void; -} - -declare var ReadableByteStreamController: { - prototype: ReadableByteStreamController; - new(): ReadableByteStreamController; -}; - /** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ interface ReadableStream<R = any> { readonly locked: boolean; cancel(reason?: any): Promise<void>; - getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader<R>; - pipeThrough<T>({ writable, readable }: { writable: WritableStream<R>, readable: ReadableStream<T> }, options?: PipeOptions): ReadableStream<T>; - pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>; + pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>; + pipeTo(dest: WritableStream<R>, options?: StreamPipeOptions): Promise<void>; tee(): [ReadableStream<R>, ReadableStream<R>]; } declare var ReadableStream: { prototype: ReadableStream; - new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number, size?: undefined }): ReadableStream<Uint8Array>; new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; }; -interface ReadableStreamBYOBReader { - readonly closed: Promise<void>; - cancel(reason?: any): Promise<void>; - read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>; - releaseLock(): void; -} - -declare var ReadableStreamBYOBReader: { - prototype: ReadableStreamBYOBReader; - new(): ReadableStreamBYOBReader; -}; - -interface ReadableStreamBYOBRequest { - readonly view: ArrayBufferView; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBufferView): void; -} - -declare var ReadableStreamBYOBRequest: { - prototype: ReadableStreamBYOBRequest; - new(): ReadableStreamBYOBRequest; -}; - interface ReadableStreamDefaultController<R = any> { readonly desiredSize: number | null; close(): void; enqueue(chunk: R): void; - error(error?: any): void; + error(e?: any): void; } declare var ReadableStreamDefaultController: { @@ -2792,29 +2769,21 @@ declare var ReadableStreamDefaultController: { new(): ReadableStreamDefaultController; }; -interface ReadableStreamDefaultReader<R = any> { - readonly closed: Promise<void>; - cancel(reason?: any): Promise<void>; - read(): Promise<ReadableStreamReadResult<R>>; +interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader { + read(): Promise<ReadableStreamDefaultReadResult<R>>; releaseLock(): void; } declare var ReadableStreamDefaultReader: { prototype: ReadableStreamDefaultReader; - new(): ReadableStreamDefaultReader; + new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>; }; -interface ReadableStreamReader<R = any> { - cancel(): Promise<void>; - read(): Promise<ReadableStreamReadResult<R>>; - releaseLock(): void; +interface ReadableStreamGenericReader { + readonly closed: Promise<undefined>; + cancel(reason?: any): Promise<void>; } -declare var ReadableStreamReader: { - prototype: ReadableStreamReader; - new(): ReadableStreamReader; -}; - /** This Fetch API interface represents a resource request. */ interface Request extends Body { /** @@ -2942,7 +2911,7 @@ interface ServiceWorkerContainer extends EventTarget { readonly ready: Promise<ServiceWorkerRegistration>; getRegistration(clientURL?: string): Promise<ServiceWorkerRegistration | undefined>; getRegistrations(): Promise<ReadonlyArray<ServiceWorkerRegistration>>; - register(scriptURL: string, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>; + register(scriptURL: string | URL, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>; startMessages(): void; addEventListener<K extends keyof ServiceWorkerContainerEventMap>(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -3128,14 +3097,14 @@ declare var SyncManager: { /** A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */ interface TextDecoder extends TextDecoderCommon { /** - * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented stream. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. + * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. * * ``` * var string = "", decoder = new TextDecoder(encoding), buffer; * while(buffer = next_chunk()) { * string += decoder.decode(buffer, {stream:true}); * } - * string += decoder.decode(); // end-of-stream + * string += decoder.decode(); // end-of-queue * ``` * * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError. @@ -3154,11 +3123,11 @@ interface TextDecoderCommon { */ readonly encoding: string; /** - * Returns true if error mode is "fatal", and false otherwise. + * Returns true if error mode is "fatal", otherwise false. */ readonly fatal: boolean; /** - * Returns true if ignore BOM flag is set, and false otherwise. + * Returns the value of ignore BOM. */ readonly ignoreBOM: boolean; } @@ -3180,7 +3149,7 @@ interface TextEncoder extends TextEncoderCommon { */ encode(input?: string): Uint8Array; /** - * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination. + * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination. */ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult; } @@ -5559,7 +5528,7 @@ declare var WritableStream: { /** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ interface WritableStreamDefaultController { - error(error?: any): void; + error(e?: any): void; } declare var WritableStreamDefaultController: { @@ -5569,9 +5538,9 @@ declare var WritableStreamDefaultController: { /** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */ interface WritableStreamDefaultWriter<W = any> { - readonly closed: Promise<void>; + readonly closed: Promise<undefined>; readonly desiredSize: number | null; - readonly ready: Promise<void>; + readonly ready: Promise<undefined>; abort(reason?: any): Promise<void>; close(): Promise<void>; releaseLock(): void; @@ -5580,7 +5549,7 @@ interface WritableStreamDefaultWriter<W = any> { declare var WritableStreamDefaultWriter: { prototype: WritableStreamDefaultWriter; - new(): WritableStreamDefaultWriter; + new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>; }; interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { @@ -5876,50 +5845,54 @@ interface PerformanceObserverCallback { (entries: PerformanceObserverEntryList, observer: PerformanceObserver): void; } -interface QueuingStrategySizeCallback<T = any> { +interface QueuingStrategySize<T = any> { (chunk: T): number; } -interface ReadableByteStreamControllerCallback { - (controller: ReadableByteStreamController): void | PromiseLike<void>; -} - -interface ReadableStreamDefaultControllerCallback<R> { - (controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>; -} - -interface ReadableStreamErrorCallback { - (reason: any): void | PromiseLike<void>; +interface TransformerFlushCallback<O> { + (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>; } -interface TransformStreamDefaultControllerCallback<O> { +interface TransformerStartCallback<O> { (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>; } -interface TransformStreamDefaultControllerTransformCallback<I, O> { +interface TransformerTransformCallback<I, O> { (chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>; } -interface VoidFunction { - (): void; +interface UnderlyingSinkAbortCallback { + (reason: any): void | PromiseLike<void>; } -interface WritableStreamDefaultControllerCloseCallback { +interface UnderlyingSinkCloseCallback { (): void | PromiseLike<void>; } -interface WritableStreamDefaultControllerStartCallback { +interface UnderlyingSinkStartCallback { (controller: WritableStreamDefaultController): void | PromiseLike<void>; } -interface WritableStreamDefaultControllerWriteCallback<W> { +interface UnderlyingSinkWriteCallback<W> { (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>; } -interface WritableStreamErrorCallback { +interface UnderlyingSourceCancelCallback { (reason: any): void | PromiseLike<void>; } +interface UnderlyingSourcePullCallback<R> { + (controller: ReadableStreamController<R>): void | PromiseLike<void>; +} + +interface UnderlyingSourceStartCallback<R> { + (controller: ReadableStreamController<R>): void | PromiseLike<void>; +} + +interface VoidFunction { + (): void; +} + /** * Returns dedicatedWorkerGlobal's name, i.e. the value given to the Worker constructor. Primarily useful for debugging. */ @@ -5997,7 +5970,8 @@ type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type TimerHandler = string | Function; type PerformanceEntryList = PerformanceEntry[]; type PushMessageDataInit = BufferSource | string; -type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>; +type ReadableStreamReader<T> = ReadableStreamDefaultReader<T>; +type ReadableStreamController<T> = ReadableStreamDefaultController<T>; type VibratePattern = number | number[]; type AlgorithmIdentifier = string | Algorithm; type HashAlgorithmIdentifier = AlgorithmIdentifier; @@ -6024,6 +5998,7 @@ type DOMTimeStamp = number; type FormDataEntryValue = File | string; type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey; type Transferable = ArrayBuffer | MessagePort | ImageBitmap | OffscreenCanvas; +type ReadableStreamDefaultReadResult<T> = ReadableStreamDefaultReadValueResult<T> | ReadableStreamDefaultReadDoneResult; type BinaryType = "arraybuffer" | "blob"; type CanvasDirection = "inherit" | "ltr" | "rtl"; type CanvasFillRule = "evenodd" | "nonzero"; @@ -6046,7 +6021,7 @@ type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "u type NotificationDirection = "auto" | "ltr" | "rtl"; type NotificationPermission = "default" | "denied" | "granted"; type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2"; -type PermissionName = "accelerometer" | "ambient-light-sensor" | "background-sync" | "bluetooth" | "camera" | "clipboard" | "device-info" | "geolocation" | "gyroscope" | "magnetometer" | "microphone" | "midi" | "notifications" | "persistent-storage" | "push" | "speaker"; +type PermissionName = "accelerometer" | "ambient-light-sensor" | "background-fetch" | "background-sync" | "bluetooth" | "camera" | "clipboard-read" | "clipboard-write" | "device-info" | "display-capture" | "geolocation" | "gyroscope" | "magnetometer" | "microphone" | "midi" | "nfc" | "notifications" | "persistent-storage" | "push" | "speaker"; type PermissionState = "denied" | "granted" | "prompt"; type PremultiplyAlpha = "default" | "none" | "premultiply"; type PushEncryptionKeyName = "auth" | "p256dh"; |