diff options
Diffstat (limited to 'cli/js/web')
27 files changed, 0 insertions, 530 deletions
diff --git a/cli/js/web/blob.ts b/cli/js/web/blob.ts index 1309ddff0..31674a62d 100644 --- a/cli/js/web/blob.ts +++ b/cli/js/web/blob.ts @@ -133,7 +133,6 @@ export class DenoBlob implements domTypes.Blob { readonly size: number = 0; readonly type: string = ""; - /** A blob object represents a file-like object of immutable, raw data. */ constructor( blobParts?: domTypes.BlobPart[], options?: domTypes.BlobPropertyBag diff --git a/cli/js/web/console.ts b/cli/js/web/console.ts index 8a34d62a1..7f79dd255 100644 --- a/cli/js/web/console.ts +++ b/cli/js/web/console.ts @@ -363,7 +363,6 @@ function createObjectString( } } -/** @internal */ export function stringifyArgs( args: unknown[], { depth = DEFAULT_MAX_DEPTH, indentLevel = 0 }: ConsoleOptions = {} @@ -480,7 +479,6 @@ export class Console { indentLevel: number; [isConsoleInstance] = false; - /** @internal */ constructor(private printFunc: PrintFunc) { this.indentLevel = 0; this[isConsoleInstance] = true; @@ -494,7 +492,6 @@ export class Console { return console; } - /** Writes the arguments to stdout */ log = (...args: unknown[]): void => { this.printFunc( stringifyArgs(args, { @@ -504,29 +501,15 @@ export class Console { ); }; - /** Writes the arguments to stdout */ debug = this.log; - /** Writes the arguments to stdout */ info = this.log; - /** Writes the properties of the supplied `obj` to stdout */ dir = (obj: unknown, options: ConsoleOptions = {}): void => { this.printFunc(stringifyArgs([obj], options) + "\n", false); }; - /** From MDN: - * Displays an interactive tree of the descendant elements of - * the specified XML/HTML element. If it is not possible to display - * as an element the JavaScript Object view is shown instead. - * The output is presented as a hierarchical listing of expandable - * nodes that let you see the contents of child nodes. - * - * Since we write to stdout, we can't display anything interactive - * we just fall back to `console.dir`. - */ dirxml = this.dir; - /** Writes the arguments to stdout */ warn = (...args: unknown[]): void => { this.printFunc( stringifyArgs(args, { @@ -536,14 +519,8 @@ export class Console { ); }; - /** Writes the arguments to stdout */ error = this.warn; - /** Writes an error message to stdout if the assertion is `false`. If the - * assertion is `true`, nothing happens. - * - * ref: https://console.spec.whatwg.org/#assert - */ assert = (condition = false, ...args: unknown[]): void => { if (condition) { return; @@ -750,15 +727,8 @@ export class Console { } } -/** A symbol which can be used as a key for a custom method which will be called - * when `Deno.inspect()` is called, or when the object is logged to the console. - */ export const customInspect = Symbol.for("Deno.customInspect"); -/** - * `inspect()` converts input into string that has the same format - * as printed by `console.log(...)`; - */ export function inspect( value: unknown, { depth = DEFAULT_MAX_DEPTH }: ConsoleOptions = {} diff --git a/cli/js/web/custom_event.ts b/cli/js/web/custom_event.ts index 2d94df56d..24a263baf 100644 --- a/cli/js/web/custom_event.ts +++ b/cli/js/web/custom_event.ts @@ -42,7 +42,4 @@ export class CustomEvent extends event.Event implements domTypes.CustomEvent { } } -/** Built-in objects providing `get` methods for our - * interceptable JavaScript operations. - */ Reflect.defineProperty(CustomEvent.prototype, "detail", { enumerable: true }); diff --git a/cli/js/web/dom_iterable.ts b/cli/js/web/dom_iterable.ts index f365d555f..e9be9009f 100644 --- a/cli/js/web/dom_iterable.ts +++ b/cli/js/web/dom_iterable.ts @@ -7,10 +7,6 @@ import { exposeForTest } from "../internals.ts"; // eslint-disable-next-line @typescript-eslint/no-explicit-any type Constructor<T = {}> = new (...args: any[]) => T; -/** Mixes in a DOM iterable methods into a base class, assumes that there is - * a private data iterable that is part of the base class, located at - * `[dataSymbol]`. - */ export function DomIterableMixin<K, V, TBase extends Constructor>( Base: TBase, dataSymbol: symbol diff --git a/cli/js/web/dom_types.ts b/cli/js/web/dom_types.ts index 23347ce66..bcc6be468 100644 --- a/cli/js/web/dom_types.ts +++ b/cli/js/web/dom_types.ts @@ -125,46 +125,14 @@ export interface ProgressEventInit extends EventInit { } export interface URLSearchParams extends DomIterable<string, string> { - /** - * Appends a specified key/value pair as a new search parameter. - */ append(name: string, value: string): void; - /** - * Deletes the given search parameter, and its associated value, - * from the list of all search parameters. - */ delete(name: string): void; - /** - * Returns the first value associated to the given search parameter. - */ get(name: string): string | null; - /** - * Returns all the values association with a given search parameter. - */ getAll(name: string): string[]; - /** - * Returns a Boolean indicating if such a search parameter exists. - */ has(name: string): boolean; - /** - * Sets the value associated to a given search parameter to the given value. - * If there were several values, delete the others. - */ set(name: string, value: string): void; - /** - * Sort all key/value pairs contained in this object in place - * and return undefined. The sort order is according to Unicode - * code points of the keys. - */ sort(): void; - /** - * Returns a query string suitable for use in a URL. - */ toString(): string; - /** - * Iterates over each name-value pair in the query - * and invokes the given function. - */ forEach( callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any @@ -305,46 +273,19 @@ export interface FormDataConstructor { prototype: FormData; } -/** A blob object represents a file-like object of immutable, raw data. */ export interface Blob { - /** The size, in bytes, of the data contained in the `Blob` object. */ readonly size: number; - /** A string indicating the media type of the data contained in the `Blob`. - * If the type is unknown, this string is empty. - */ readonly type: string; - /** Returns a new `Blob` object containing the data in the specified range of - * bytes of the source `Blob`. - */ slice(start?: number, end?: number, contentType?: string): Blob; } export interface Body { - /** A simple getter used to expose a `ReadableStream` of the body contents. */ readonly body: ReadableStream | 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>; } @@ -474,44 +415,18 @@ export interface QueuingStrategySizeCallback<T = any> { } export interface Headers extends DomIterable<string, string> { - /** Appends a new value onto an existing header inside a `Headers` object, or - * adds the header if it does not already exist. - */ append(name: string, value: string): void; - /** Deletes a header from a `Headers` object. */ 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 - * `Headers` object with a given name. - */ get(name: string): string | null; - /** Returns a boolean stating whether a `Headers` object contains a certain - * header. - */ 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 - * the header if it does not already exist. - */ set(name: string, value: string): void; - /** Returns an iterator allowing to go through all values contained in - * this Headers object. The values are ByteString objects. - */ values(): IterableIterator<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]>; } @@ -585,171 +500,49 @@ export interface RequestConstructor { } export interface Request extends Body { - /** Returns the cache mode associated with request, which is a string - * indicating how the the request will interact with the browser's cache when - * fetching. - */ readonly cache?: RequestCache; - /** Returns the credentials mode associated with request, which is a string - * indicating whether credentials will be sent with the request always, never, - * or only when sent to a same-origin URL. - */ readonly credentials?: RequestCredentials; - /** Returns the kind of resource requested by request, (e.g., `document` or - * `script`). - */ readonly destination?: RequestDestination; - /** Returns a Headers object consisting of the headers associated with - * request. - * - * Note that headers added in the network layer by the user agent - * will not be accounted for in this object, (e.g., the `Host` header). - */ readonly headers: Headers; - /** Returns request's subresource integrity metadata, which is a cryptographic - * hash of the resource being fetched. Its value consists of multiple hashes - * separated by whitespace. [SRI] - */ readonly integrity?: string; - /** Returns a boolean indicating whether or not request is for a history - * navigation (a.k.a. back-forward navigation). - */ readonly isHistoryNavigation?: boolean; - /** Returns a boolean indicating whether or not request is for a reload - * navigation. - */ readonly isReloadNavigation?: boolean; - /** Returns a boolean indicating whether or not request can outlive the global - * in which it was created. - */ readonly keepalive?: boolean; - /** Returns request's HTTP method, which is `GET` by default. */ readonly method: string; - /** Returns the mode associated with request, which is a string indicating - * whether the request will use CORS, or will be restricted to same-origin - * URLs. - */ readonly mode?: RequestMode; - /** Returns the redirect mode associated with request, which is a string - * indicating how redirects for the request will be handled during fetching. - * - * A request will follow redirects by default. - */ readonly redirect?: RequestRedirect; - /** Returns the referrer of request. Its value can be a same-origin URL if - * explicitly set in init, the empty string to indicate no referrer, and - * `about:client` when defaulting to the global's default. - * - * This is used during fetching to determine the value of the `Referer` - * header of the request being made. - */ readonly referrer?: string; - /** Returns the referrer policy associated with request. This is used during - * fetching to compute the value of the request's referrer. - */ readonly referrerPolicy?: ReferrerPolicy; - /** Returns the signal associated with request, which is an AbortSignal object - * indicating whether or not request has been aborted, and its abort event - * handler. - */ readonly signal?: AbortSignal; - /** Returns the URL of request as a string. */ readonly url: string; clone(): Request; } export interface Response extends Body { - /** Contains the `Headers` object associated with the response. */ readonly headers: Headers; - /** Contains a boolean stating whether the response was successful (status in - * the range 200-299) or not. - */ readonly ok: boolean; - /** Indicates whether or not the response is the result of a redirect; that - * is, its URL list has more than one entry. - */ readonly redirected: boolean; - /** Contains the status code of the response (e.g., `200` for a success). */ readonly status: number; - /** Contains the status message corresponding to the status code (e.g., `OK` - * for `200`). - */ readonly statusText: string; readonly trailer: Promise<Headers>; - /** Contains the type of the response (e.g., `basic`, `cors`). */ readonly type: ResponseType; - /** Contains the URL of the response. */ readonly url: string; - /** Creates a clone of a `Response` object. */ clone(): Response; } export interface Location { - /** - * Returns a DOMStringList object listing the origins of the ancestor browsing - * contexts, from the parent browsing context to the top-level browsing - * context. - */ readonly ancestorOrigins: string[]; - /** - * Returns the Location object's URL's fragment (includes leading "#" if - * non-empty). - * Can be set, to navigate to the same URL with a changed fragment (ignores - * leading "#"). - */ hash: string; - /** - * Returns the Location object's URL's host and port (if different from the - * default port for the scheme). Can be set, to navigate to the same URL with - * a changed host and port. - */ host: string; - /** - * Returns the Location object's URL's host. Can be set, to navigate to the - * same URL with a changed host. - */ hostname: string; - /** - * Returns the Location object's URL. Can be set, to navigate to the given - * URL. - */ href: string; - /** Returns the Location object's URL's origin. */ readonly origin: string; - /** - * Returns the Location object's URL's path. - * Can be set, to navigate to the same URL with a changed path. - */ pathname: string; - /** - * Returns the Location object's URL's port. - * Can be set, to navigate to the same URL with a changed port. - */ port: string; - /** - * Returns the Location object's URL's scheme. - * Can be set, to navigate to the same URL with a changed scheme. - */ protocol: string; - /** - * Returns the Location object's URL's query (includes leading "?" if - * non-empty). Can be set, to navigate to the same URL with a changed query - * (ignores leading "?"). - */ search: string; - /** - * Navigates to the given URL. - */ assign(url: string): void; - /** - * Reloads the current page. - */ reload(): void; - /** @deprecated */ reload(forcedReload: boolean): void; - /** - * Removes the current page from the session history and navigates to the - * given URL. - */ replace(url: string): void; } diff --git a/cli/js/web/event.ts b/cli/js/web/event.ts index a30e33447..ef5c4d175 100644 --- a/cli/js/web/event.ts +++ b/cli/js/web/event.ts @@ -187,12 +187,6 @@ export class Event implements domTypes.Event { return getPrivateValue(this, eventAttributes, "type"); } - /** Returns the event’s path (objects on which listeners will be - * invoked). This does not include nodes in shadow trees if the - * shadow root was created with its ShadowRoot.mode closed. - * - * event.composedPath(); - */ composedPath(): domTypes.EventPath[] { if (this._path.length === 0) { return []; @@ -299,41 +293,22 @@ export class Event implements domTypes.Event { return composedPath; } - /** Cancels the event (if it is cancelable). - * See https://dom.spec.whatwg.org/#set-the-canceled-flag - * - * event.preventDefault(); - */ preventDefault(): void { if (this.cancelable && !this._inPassiveListenerFlag) { this._canceledFlag = true; } } - /** Stops the propagation of events further along in the DOM. - * - * event.stopPropagation(); - */ stopPropagation(): void { this._stopPropagationFlag = true; } - /** For this particular event, no other listener will be called. - * Neither those attached on the same element, nor those attached - * on elements which will be traversed later (in capture phase, - * for instance). - * - * event.stopImmediatePropagation(); - */ stopImmediatePropagation(): void { this._stopPropagationFlag = true; this._stopImmediatePropagationFlag = true; } } -/** Built-in objects providing `get` methods for our - * interceptable JavaScript operations. - */ Reflect.defineProperty(Event.prototype, "bubbles", { enumerable: true }); Reflect.defineProperty(Event.prototype, "cancelable", { enumerable: true }); Reflect.defineProperty(Event.prototype, "composed", { enumerable: true }); diff --git a/cli/js/web/event_target.ts b/cli/js/web/event_target.ts index 03557526a..7fe26441d 100644 --- a/cli/js/web/event_target.ts +++ b/cli/js/web/event_target.ts @@ -486,9 +486,6 @@ const eventTargetHelpers = { } }; -/** Built-in objects providing `get` methods for our - * interceptable JavaScript operations. - */ Reflect.defineProperty(EventTarget.prototype, "addEventListener", { enumerable: true }); diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts index daa926e51..3972da4f2 100644 --- a/cli/js/web/fetch.ts +++ b/cli/js/web/fetch.ts @@ -456,7 +456,6 @@ async function sendFetchReq( return await opFetch(args, body); } -/** Fetch a resource from the network. */ export async function fetch( input: domTypes.Request | URL | string, init?: domTypes.RequestInit diff --git a/cli/js/web/form_data.ts b/cli/js/web/form_data.ts index 461210b9d..2c70d416f 100644 --- a/cli/js/web/form_data.ts +++ b/cli/js/web/form_data.ts @@ -10,12 +10,6 @@ const dataSymbol = Symbol("data"); class FormDataBase { private [dataSymbol]: Array<[string, domTypes.FormDataEntryValue]> = []; - /** Appends a new value onto an existing key inside a `FormData` - * object, or adds the key if it does not already exist. - * - * formData.append('name', 'first'); - * formData.append('name', 'second'); - */ append(name: string, value: string): void; append(name: string, value: blob.DenoBlob, filename?: string): void; append(name: string, value: string | blob.DenoBlob, filename?: string): void { @@ -29,10 +23,6 @@ class FormDataBase { } } - /** Deletes a key/value pair from a `FormData` object. - * - * formData.delete('name'); - */ delete(name: string): void { requiredArguments("FormData.delete", arguments.length, 1); name = String(name); @@ -46,11 +36,6 @@ class FormDataBase { } } - /** Returns an array of all the values associated with a given key - * from within a `FormData`. - * - * formData.getAll('name'); - */ getAll(name: string): domTypes.FormDataEntryValue[] { requiredArguments("FormData.getAll", arguments.length, 1); name = String(name); @@ -64,11 +49,6 @@ class FormDataBase { return values; } - /** Returns the first value associated with a given key from within a - * `FormData` object. - * - * formData.get('name'); - */ get(name: string): domTypes.FormDataEntryValue | null { requiredArguments("FormData.get", arguments.length, 1); name = String(name); @@ -81,23 +61,12 @@ class FormDataBase { return null; } - /** Returns a boolean stating whether a `FormData` object contains a - * certain key/value pair. - * - * formData.has('name'); - */ has(name: string): boolean { requiredArguments("FormData.has", arguments.length, 1); name = String(name); return this[dataSymbol].some((entry): boolean => entry[0] === name); } - /** Sets a new value for an existing key inside a `FormData` object, or - * adds the key/value if it does not already exist. - * ref: https://xhr.spec.whatwg.org/#dom-formdata-set - * - * formData.set('name', 'value'); - */ set(name: string, value: string): void; set(name: string, value: blob.DenoBlob, filename?: string): void; set(name: string, value: string | blob.DenoBlob, filename?: string): void { diff --git a/cli/js/web/performance.ts b/cli/js/web/performance.ts index cb4daa846..7077b1edb 100644 --- a/cli/js/web/performance.ts +++ b/cli/js/web/performance.ts @@ -2,13 +2,6 @@ import { now as opNow } from "../ops/timers.ts"; export class Performance { - /** Returns a current time from Deno's start in milliseconds. - * - * Use the flag --allow-hrtime return a precise value. - * - * const t = performance.now(); - * console.log(`${t} ms since start!`); - */ now(): number { const res = opNow(); return res.seconds * 1e3 + res.subsecNanos / 1e6; diff --git a/cli/js/web/request.ts b/cli/js/web/request.ts index 1416a95d6..8afc35e7a 100644 --- a/cli/js/web/request.ts +++ b/cli/js/web/request.ts @@ -28,11 +28,6 @@ function normalizeMethod(m: string): string { return m; } -/** - * An HTTP request - * @param {Blob|String} [body] - * @param {Object} [init] - */ export class Request extends body.Body implements domTypes.Request { public method: string; public url: string; @@ -83,20 +78,9 @@ export class Request extends body.Body implements domTypes.Request { this.headers = headers; // readonly attribute ByteString method; - /** - * The HTTP request method - * @readonly - * @default GET - * @type {string} - */ this.method = "GET"; // readonly attribute USVString url; - /** - * The request URL - * @readonly - * @type {string} - */ this.url = ""; // readonly attribute RequestCredentials credentials; diff --git a/cli/js/web/streams/mod.ts b/cli/js/web/streams/mod.ts index 5389aaf6d..a6b55ed5a 100644 --- a/cli/js/web/streams/mod.ts +++ b/cli/js/web/streams/mod.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * @stardazed/streams - implementation of the web streams standard - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - export { SDReadableStream as ReadableStream } from "./readable-stream.ts"; /* TODO The following are currently unused so not exported for clarity. export { WritableStream } from "./writable-stream.ts"; diff --git a/cli/js/web/streams/queue-mixin.ts b/cli/js/web/streams/queue-mixin.ts index 23c57d75f..a7ed14974 100644 --- a/cli/js/web/streams/queue-mixin.ts +++ b/cli/js/web/streams/queue-mixin.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/queue-mixin - internal queue operations for stream controllers - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - /* eslint-disable @typescript-eslint/no-explicit-any */ // TODO reenable this lint here diff --git a/cli/js/web/streams/queue.ts b/cli/js/web/streams/queue.ts index 264851baf..16e3eafe4 100644 --- a/cli/js/web/streams/queue.ts +++ b/cli/js/web/streams/queue.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/queue - simple queue type with chunked array backing - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - const CHUNK_SIZE = 16384; export interface Queue<T> { diff --git a/cli/js/web/streams/readable-byte-stream-controller.ts b/cli/js/web/streams/readable-byte-stream-controller.ts index 86efd416c..8067b5d35 100644 --- a/cli/js/web/streams/readable-byte-stream-controller.ts +++ b/cli/js/web/streams/readable-byte-stream-controller.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/readable-byte-stream-controller - ReadableByteStreamController class implementation - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - /* eslint-disable @typescript-eslint/no-explicit-any */ // TODO reenable this lint here diff --git a/cli/js/web/streams/readable-internals.ts b/cli/js/web/streams/readable-internals.ts index 67f5a69b1..b96262ef7 100644 --- a/cli/js/web/streams/readable-internals.ts +++ b/cli/js/web/streams/readable-internals.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/readable-internals - internal types and functions for readable streams - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - /* eslint-disable @typescript-eslint/no-explicit-any */ // TODO reenable this lint here diff --git a/cli/js/web/streams/readable-stream-byob-reader.ts b/cli/js/web/streams/readable-stream-byob-reader.ts index 0f9bfb037..8527f8db9 100644 --- a/cli/js/web/streams/readable-stream-byob-reader.ts +++ b/cli/js/web/streams/readable-stream-byob-reader.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/readable-stream-byob-reader - ReadableStreamBYOBReader class implementation - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - import * as rs from "./readable-internals.ts"; import * as shared from "./shared-internals.ts"; diff --git a/cli/js/web/streams/readable-stream-byob-request.ts b/cli/js/web/streams/readable-stream-byob-request.ts index 25b937f10..75ca1ddfe 100644 --- a/cli/js/web/streams/readable-stream-byob-request.ts +++ b/cli/js/web/streams/readable-stream-byob-request.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/readable-stream-byob-request - ReadableStreamBYOBRequest class implementation - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - import * as rs from "./readable-internals.ts"; export class ReadableStreamBYOBRequest { diff --git a/cli/js/web/streams/readable-stream-default-controller.ts b/cli/js/web/streams/readable-stream-default-controller.ts index e9ddce1bc..d33226a9b 100644 --- a/cli/js/web/streams/readable-stream-default-controller.ts +++ b/cli/js/web/streams/readable-stream-default-controller.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/readable-stream-default-controller - ReadableStreamDefaultController class implementation - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - /* eslint-disable @typescript-eslint/no-explicit-any */ // TODO reenable this lint here diff --git a/cli/js/web/streams/readable-stream-default-reader.ts b/cli/js/web/streams/readable-stream-default-reader.ts index eb1910a9d..3fbf22c8c 100644 --- a/cli/js/web/streams/readable-stream-default-reader.ts +++ b/cli/js/web/streams/readable-stream-default-reader.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/readable-stream-default-reader - ReadableStreamDefaultReader class implementation - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - import * as rs from "./readable-internals.ts"; import * as shared from "./shared-internals.ts"; diff --git a/cli/js/web/streams/readable-stream.ts b/cli/js/web/streams/readable-stream.ts index 4d9d85889..e062c278e 100644 --- a/cli/js/web/streams/readable-stream.ts +++ b/cli/js/web/streams/readable-stream.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/readable-stream - ReadableStream class implementation - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - /* eslint prefer-const: "off" */ // TODO remove this, surpressed because of // 284:7 error 'branch1' is never reassigned. Use 'const' instead prefer-const diff --git a/cli/js/web/streams/shared-internals.ts b/cli/js/web/streams/shared-internals.ts index 93155fecc..3d802b083 100644 --- a/cli/js/web/streams/shared-internals.ts +++ b/cli/js/web/streams/shared-internals.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/shared-internals - common types and methods for streams - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - /* eslint-disable @typescript-eslint/no-explicit-any */ // TODO don't disable this warning @@ -20,7 +13,6 @@ export const storedError_ = Symbol("storedError_"); // --------- -/** An error reason / result can be anything */ export type ErrorResult = any; // --------- @@ -122,11 +114,6 @@ function supportsSharedArrayBuffer(): boolean { return sharedArrayBufferSupported_; } -/** - * Implement a method of value cloning that is reasonably close to performing `StructuredSerialize(StructuredDeserialize(value))` - * from the HTML standard. Used by the internal `readableStreamTee` method to clone values for connected implementations. - * @see https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal - */ export function cloneValue(value: any): any { const valueType = typeof value; switch (valueType) { diff --git a/cli/js/web/streams/strategies.ts b/cli/js/web/streams/strategies.ts index 5f7ffc632..98fe0f91a 100644 --- a/cli/js/web/streams/strategies.ts +++ b/cli/js/web/streams/strategies.ts @@ -1,13 +1,6 @@ // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546 // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT -/** - * streams/strategies - implementation of the built-in stream strategies - * Part of Stardazed - * (c) 2018-Present by Arthur Langereis - @zenmumbler - * https://github.com/stardazed/sd-streams - */ - /* eslint-disable @typescript-eslint/no-explicit-any */ // TODO reenable this lint here diff --git a/cli/js/web/text_encoding.ts b/cli/js/web/text_encoding.ts index 928cbe7e1..2da53d934 100644 --- a/cli/js/web/text_encoding.ts +++ b/cli/js/web/text_encoding.ts @@ -92,7 +92,6 @@ class UTF8Encoder implements Encoder { } } -/** Decodes a string of data which has been encoded using base-64. */ export function atob(s: string): string { s = String(s); s = s.replace(/[\t\n\f\r ]/g, ""); @@ -120,7 +119,6 @@ export function atob(s: string): string { return result; } -/** Creates a base-64 ASCII string from the input string. */ export function btoa(s: string): string { const byteArray = []; for (let i = 0; i < s.length; i++) { @@ -303,13 +301,10 @@ function isEitherArrayBuffer(x: any): x is EitherArrayBuffer { export class TextDecoder { private _encoding: string; - /** Returns encoding's name, lowercased. */ get encoding(): string { return this._encoding; } - /** Returns `true` if error mode is "fatal", and `false` otherwise. */ readonly fatal: boolean = false; - /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ readonly ignoreBOM: boolean = false; constructor(label = "utf-8", options: TextDecoderOptions = { fatal: false }) { @@ -334,7 +329,6 @@ export class TextDecoder { this._encoding = encoding; } - /** Returns the result of running encoding's decoder. */ decode( input?: domTypes.BufferSource, options: TextDecodeOptions = { stream: false } @@ -400,9 +394,7 @@ interface TextEncoderEncodeIntoResult { } export class TextEncoder { - /** Returns "utf-8". */ readonly encoding = "utf-8"; - /** Returns the result of running UTF-8's encoder. */ encode(input = ""): Uint8Array { // For performance reasons we utilise a highly optimised decoder instead of // the general decoder. diff --git a/cli/js/web/timers.ts b/cli/js/web/timers.ts index 806b7c160..520a2722a 100644 --- a/cli/js/web/timers.ts +++ b/cli/js/web/timers.ts @@ -261,7 +261,6 @@ function setTimer( return timer.id; } -/** Sets a timer which executes a function once after the timer expires. */ export function setTimeout( cb: (...args: Args) => void, delay = 0, @@ -273,7 +272,6 @@ export function setTimeout( return setTimer(cb, delay, args, false); } -/** Repeatedly calls a function, with a fixed time delay between each call. */ export function setInterval( cb: (...args: Args) => void, delay = 0, @@ -285,7 +283,6 @@ export function setInterval( return setTimer(cb, delay, args, true); } -/** Clears a previously set timer by id. AKA clearTimeout and clearInterval. */ function clearTimer(id: number): void { id = Number(id); const timer = idMap.get(id); diff --git a/cli/js/web/url_search_params.ts b/cli/js/web/url_search_params.ts index ed93045da..8f60f2918 100644 --- a/cli/js/web/url_search_params.ts +++ b/cli/js/web/url_search_params.ts @@ -60,22 +60,12 @@ export class URLSearchParams { (this.url as any)._parts.query = query; } - /** Appends a specified key/value pair as a new search parameter. - * - * searchParams.append('name', 'first'); - * searchParams.append('name', 'second'); - */ append(name: string, value: string): void { requiredArguments("URLSearchParams.append", arguments.length, 2); this.params.push([String(name), String(value)]); this.updateSteps(); } - /** Deletes the given search parameter and its associated value, - * from the list of all search parameters. - * - * searchParams.delete('name'); - */ delete(name: string): void { requiredArguments("URLSearchParams.delete", arguments.length, 1); name = String(name); @@ -90,11 +80,6 @@ export class URLSearchParams { this.updateSteps(); } - /** Returns all the values associated with a given search parameter - * as an array. - * - * searchParams.getAll('name'); - */ getAll(name: string): string[] { requiredArguments("URLSearchParams.getAll", arguments.length, 1); name = String(name); @@ -108,10 +93,6 @@ export class URLSearchParams { return values; } - /** Returns the first value associated to the given search parameter. - * - * searchParams.get('name'); - */ get(name: string): string | null { requiredArguments("URLSearchParams.get", arguments.length, 1); name = String(name); @@ -124,24 +105,12 @@ export class URLSearchParams { return null; } - /** Returns a Boolean that indicates whether a parameter with the - * specified name exists. - * - * searchParams.has('name'); - */ has(name: string): boolean { requiredArguments("URLSearchParams.has", arguments.length, 1); name = String(name); return this.params.some((entry): boolean => entry[0] === name); } - /** Sets the value associated with a given search parameter to the - * given value. If there were several matching values, this method - * deletes the others. If the search parameter doesn't exist, this - * method creates it. - * - * searchParams.set('name', 'value'); - */ set(name: string, value: string): void { requiredArguments("URLSearchParams.set", arguments.length, 2); @@ -175,12 +144,6 @@ export class URLSearchParams { this.updateSteps(); } - /** Sort all key/value pairs contained in this object in place and - * return undefined. The sort order is according to Unicode code - * points of the keys. - * - * searchParams.sort(); - */ sort(): void { this.params = this.params.sort((a, b): number => a[0] === b[0] ? 0 : a[0] > b[0] ? 1 : -1 @@ -188,15 +151,6 @@ export class URLSearchParams { this.updateSteps(); } - /** Calls a function for each element contained in this object in - * place and return undefined. Optionally accepts an object to use - * as this when executing callback as second argument. - * - * searchParams.forEach((value, key, parent) => { - * console.log(value, key, parent); - * }); - * - */ forEach( callbackfn: (value: string, key: string, parent: this) => void, // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -213,58 +167,26 @@ export class URLSearchParams { } } - /** Returns an iterator allowing to go through all keys contained - * in this object. - * - * for (const key of searchParams.keys()) { - * console.log(key); - * } - */ *keys(): IterableIterator<string> { for (const entry of this.params) { yield entry[0]; } } - /** Returns an iterator allowing to go through all values contained - * in this object. - * - * for (const value of searchParams.values()) { - * console.log(value); - * } - */ *values(): IterableIterator<string> { for (const entry of this.params) { yield entry[1]; } } - /** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - * - * for (const [key, value] of searchParams.entries()) { - * console.log(key, value); - * } - */ *entries(): IterableIterator<[string, string]> { yield* this.params; } - /** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - * - * for (const [key, value] of searchParams[Symbol.iterator]()) { - * console.log(key, value); - * } - */ *[Symbol.iterator](): IterableIterator<[string, string]> { yield* this.params; } - /** Returns a query string suitable for use in a URL. - * - * searchParams.toString(); - */ toString(): string { return this.params .map( diff --git a/cli/js/web/util.ts b/cli/js/web/util.ts index b0a050973..8d248ce1f 100644 --- a/cli/js/web/util.ts +++ b/cli/js/web/util.ts @@ -47,29 +47,6 @@ export function getPrivateValue< throw new TypeError("Illegal invocation"); } -/** - * Determines whether an object has a property with the specified name. - * Avoid calling prototype builtin `hasOwnProperty` for two reasons: - * - * 1. `hasOwnProperty` is defined on the object as something else: - * - * const options = { - * ending: 'utf8', - * hasOwnProperty: 'foo' - * }; - * options.hasOwnProperty('ending') // throws a TypeError - * - * 2. The object doesn't inherit from `Object.prototype`: - * - * const options = Object.create(null); - * options.ending = 'utf8'; - * options.hasOwnProperty('ending'); // throws a TypeError - * - * @param obj A Object. - * @param v A property name. - * @see https://eslint.org/docs/rules/no-prototype-builtins - * @internal - */ export function hasOwnProperty<T>(obj: T, v: PropertyKey): boolean { if (obj == null) { return false; |