0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -05:00

feat(fmt): add basic JS doc formatting (#11902)

This commit is contained in:
David Sherret 2021-09-02 18:28:12 -04:00 committed by GitHub
parent 1bf7b90ca8
commit 987716798f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 260 additions and 271 deletions

View file

@ -36,9 +36,9 @@
"tools/wpt/manifest.json" "tools/wpt/manifest.json"
], ],
"plugins": [ "plugins": [
"https://plugins.dprint.dev/typescript-0.53.0.wasm", "https://plugins.dprint.dev/typescript-0.54.0.wasm",
"https://plugins.dprint.dev/json-0.12.3.wasm", "https://plugins.dprint.dev/json-0.13.0.wasm",
"https://plugins.dprint.dev/markdown-0.9.6.wasm", "https://plugins.dprint.dev/markdown-0.10.0.wasm",
"https://plugins.dprint.dev/toml-0.5.1.wasm" "https://plugins.dprint.dev/toml-0.5.1.wasm"
] ]
} }

16
Cargo.lock generated
View file

@ -1034,9 +1034,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-core" name = "dprint-core"
version = "0.44.0" version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58e8b33392ddbb25277c26d9af64f84d1dd661d3a98aeead9abb114854550ad2" checksum = "c5f145afa493cba0217d2c52e256e7626730b8ed97c9db4e20e0db8c242458ca"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"fnv", "fnv",
@ -1045,9 +1045,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-json" name = "dprint-plugin-json"
version = "0.12.3" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2af0c28f3fa7dcc4bfa0f6d88bd55e2cf13e3137e2038952a356a3a78698991" checksum = "4a32a4eef2c639055370f16a359f0278025058e63193f0ad2340f30bf7ca8361"
dependencies = [ dependencies = [
"dprint-core", "dprint-core",
"jsonc-parser", "jsonc-parser",
@ -1056,9 +1056,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-markdown" name = "dprint-plugin-markdown"
version = "0.9.6" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdd7aeda8d9feccc49f178bf246fff6746afee584870c49ee4c4bd890cfb5da8" checksum = "48b364aed2db4ccf8747dc1d9c7eb52a5e981a705c7aadfddd297fc4c3310772"
dependencies = [ dependencies = [
"dprint-core", "dprint-core",
"pulldown-cmark", "pulldown-cmark",
@ -1068,9 +1068,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-typescript" name = "dprint-plugin-typescript"
version = "0.53.0" version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63674b5e577e3244436463aa8ab59947aba0a3d5b4de6d181c6bd7a3e190b336" checksum = "2249bbc5f46daecd4de4157cec4c4a118724024a213bea8a53ac693047959291"
dependencies = [ dependencies = [
"dprint-core", "dprint-core",
"dprint-swc-ecma-ast-view", "dprint-swc-ecma-ast-view",

View file

@ -56,9 +56,9 @@ byteorder = "1.4.3"
clap = "2.33.3" clap = "2.33.3"
data-url = "0.1.0" data-url = "0.1.0"
dissimilar = "1.0.2" dissimilar = "1.0.2"
dprint-plugin-json = "0.12.3" dprint-plugin-json = "0.13.0"
dprint-plugin-markdown = "0.9.6" dprint-plugin-markdown = "0.10.0"
dprint-plugin-typescript = "0.53.0" dprint-plugin-typescript = "0.54.0"
encoding_rs = "0.8.28" encoding_rs = "0.8.28"
env_logger = "0.8.4" env_logger = "0.8.4"
fancy-regex = "0.7.1" fancy-regex = "0.7.1"

View file

@ -54,7 +54,7 @@ declare interface PerformanceMeasureOptions {
detail?: any; detail?: any;
/** Timestamp to be used as the start time or string to be used as start /** Timestamp to be used as the start time or string to be used as start
* mark.*/ * mark. */
start?: string | number; start?: string | number;
/** Duration between the start and end times. */ /** Duration between the start and end times. */
@ -121,7 +121,7 @@ declare namespace Deno {
* `only` set to true and fail the test suite. */ * `only` set to true and fail the test suite. */
only?: boolean; only?: boolean;
/** Check that the number of async completed ops after the test is the same /** Check that the number of async completed ops after the test is the same
* as number of dispatched ops. Defaults to true.*/ * as number of dispatched ops. Defaults to true. */
sanitizeOps?: boolean; sanitizeOps?: boolean;
/** Ensure the test case does not "leak" resources - ie. the resource table /** Ensure the test case does not "leak" resources - ie. the resource table
* after the test has exactly the same contents as before the test. Defaults * after the test has exactly the same contents as before the test. Defaults
@ -183,7 +183,7 @@ declare namespace Deno {
* assertEquals(decoder.decode(data), "Hello world"); * assertEquals(decoder.decode(data), "Hello world");
* }); * });
* ``` * ```
* */ */
export function test(name: string, fn: () => void | Promise<void>): void; export function test(name: string, fn: () => void | Promise<void>): void;
/** Exit the Deno process with optional exit code. If no exit code is supplied /** Exit the Deno process with optional exit code. If no exit code is supplied
@ -295,7 +295,6 @@ declare namespace Deno {
export function linkSync(oldpath: string, newpath: string): void; export function linkSync(oldpath: string, newpath: string): void;
/** /**
*
* Creates `newpath` as a hard link to `oldpath`. * Creates `newpath` as a hard link to `oldpath`.
* *
* ```ts * ```ts
@ -866,7 +865,7 @@ declare namespace Deno {
* any write calls on it will overwrite its contents, by default without * any write calls on it will overwrite its contents, by default without
* truncating it. */ * truncating it. */
write?: boolean; write?: boolean;
/**Sets the option for the append mode. This option, when `true`, means that /** Sets the option for the append mode. This option, when `true`, means that
* writes will append to a file instead of overwriting previous contents. * writes will append to a file instead of overwriting previous contents.
* Note that setting `{ write: true, append: true }` has the same effect as * Note that setting `{ write: true, append: true }` has the same effect as
* setting only `{ append: true }`. */ * setting only `{ append: true }`. */
@ -901,7 +900,6 @@ declare namespace Deno {
} }
/** /**
*
* Check if a given resource id (`rid`) is a TTY. * Check if a given resource id (`rid`) is a TTY.
* *
* ```ts * ```ts
@ -1536,7 +1534,7 @@ declare namespace Deno {
* *
* Requires `allow-read` permission for the target path. * Requires `allow-read` permission for the target path.
* Also requires `allow-read` permission for the CWD if the target path is * Also requires `allow-read` permission for the CWD if the target path is
* relative.*/ * relative. */
export function realPathSync(path: string | URL): string; export function realPathSync(path: string | URL): string;
/** Resolves to the absolute normalized path, with symbolic links resolved. /** Resolves to the absolute normalized path, with symbolic links resolved.
@ -1552,7 +1550,7 @@ declare namespace Deno {
* *
* Requires `allow-read` permission for the target path. * Requires `allow-read` permission for the target path.
* Also requires `allow-read` permission for the CWD if the target path is * Also requires `allow-read` permission for the CWD if the target path is
* relative.*/ * relative. */
export function realPath(path: string | URL): Promise<string>; export function realPath(path: string | URL): Promise<string>;
export interface DirEntry { export interface DirEntry {
@ -1914,7 +1912,7 @@ declare namespace Deno {
* console.log(">>>> event", event); * console.log(">>>> event", event);
* // { kind: "create", paths: [ "/foo.txt" ] } * // { kind: "create", paths: [ "/foo.txt" ] }
* } * }
*``` * ```
* *
* Requires `allow-read` permission. * Requires `allow-read` permission.
* *
@ -1968,7 +1966,7 @@ declare namespace Deno {
* ]); * ]);
* p.close(); * p.close();
* ``` * ```
**/ */
status(): Promise<ProcessStatus>; status(): Promise<ProcessStatus>;
/** Buffer the stdout until EOF and return it as `Uint8Array`. /** Buffer the stdout until EOF and return it as `Uint8Array`.
* *

View file

@ -111,7 +111,7 @@ declare namespace WebAssembly {
/** /**
* Given a `Module` and string, returns a copy of the contents of all custom sections in the * Given a `Module` and string, returns a copy of the contents of all custom sections in the
* module with the given string name. * module with the given string name.
* */ */
static customSections( static customSections(
moduleObject: Module, moduleObject: Module,
sectionName: string, sectionName: string,
@ -494,7 +494,7 @@ declare interface PerformanceMeasureOptions {
detail?: any; detail?: any;
/** Timestamp to be used as the start time or string to be used as start /** Timestamp to be used as the start time or string to be used as start
* mark.*/ * mark. */
start?: string | number; start?: string | number;
/** Duration between the start and end times. */ /** Duration between the start and end times. */

View file

@ -64,7 +64,6 @@ declare namespace Deno {
* ``` * ```
* *
* Requires `allow-env` permission. * Requires `allow-env` permission.
*
*/ */
export function osRelease(): string; export function osRelease(): string;
@ -80,7 +79,6 @@ declare namespace Deno {
* ``` * ```
* *
* Requires `allow-env` permission. * Requires `allow-env` permission.
*
*/ */
export function systemMemoryInfo(): SystemMemoryInfo; export function systemMemoryInfo(): SystemMemoryInfo;
@ -958,137 +956,137 @@ declare namespace Deno {
* Set this to "none" to revoke all permissions. * Set this to "none" to revoke all permissions.
* *
* Defaults to "inherit". * Defaults to "inherit".
*/ */
permissions?: "inherit" | "none" | { permissions?: "inherit" | "none" | {
/** Specifies if the `net` permission should be requested or revoked. /** Specifies if the `net` permission should be requested or revoked.
* If set to `"inherit"`, the current `env` permission will be inherited. * If set to `"inherit"`, the current `env` permission will be inherited.
* If set to `true`, the global `net` permission will be requested. * If set to `true`, the global `net` permission will be requested.
* If set to `false`, the global `net` permission will be revoked. * If set to `false`, the global `net` permission will be revoked.
* *
* Defaults to "inherit". * Defaults to "inherit".
*/ */
env?: "inherit" | boolean | string[]; env?: "inherit" | boolean | string[];
/** Specifies if the `hrtime` permission should be requested or revoked. /** Specifies if the `hrtime` permission should be requested or revoked.
* If set to `"inherit"`, the current `hrtime` permission will be inherited. * If set to `"inherit"`, the current `hrtime` permission will be inherited.
* If set to `true`, the global `hrtime` permission will be requested. * If set to `true`, the global `hrtime` permission will be requested.
* If set to `false`, the global `hrtime` permission will be revoked. * If set to `false`, the global `hrtime` permission will be revoked.
* *
* Defaults to "inherit". * Defaults to "inherit".
*/ */
hrtime?: "inherit" | boolean; hrtime?: "inherit" | boolean;
/** Specifies if the `net` permission should be requested or revoked. /** Specifies if the `net` permission should be requested or revoked.
* if set to `"inherit"`, the current `net` permission will be inherited. * if set to `"inherit"`, the current `net` permission will be inherited.
* if set to `true`, the global `net` permission will be requested. * if set to `true`, the global `net` permission will be requested.
* if set to `false`, the global `net` permission will be revoked. * if set to `false`, the global `net` permission will be revoked.
* if set to `string[]`, the `net` permission will be requested with the * if set to `string[]`, the `net` permission will be requested with the
* specified host strings with the format `"<host>[:<port>]`. * specified host strings with the format `"<host>[:<port>]`.
* *
* Defaults to "inherit". * Defaults to "inherit".
* *
* Examples: * Examples:
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; * import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
* *
* Deno.test({ * Deno.test({
* name: "inherit", * name: "inherit",
* permissions: { * permissions: {
* net: "inherit", * net: "inherit",
* }, * },
* async fn() { * async fn() {
* const status = await Deno.permissions.query({ name: "net" }) * const status = await Deno.permissions.query({ name: "net" })
* assertEquals(status.state, "granted"); * assertEquals(status.state, "granted");
* }, * },
* }); * });
* ``` * ```
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; * import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
* *
* Deno.test({ * Deno.test({
* name: "true", * name: "true",
* permissions: { * permissions: {
* net: true, * net: true,
* }, * },
* async fn() { * async fn() {
* const status = await Deno.permissions.query({ name: "net" }); * const status = await Deno.permissions.query({ name: "net" });
* assertEquals(status.state, "granted"); * assertEquals(status.state, "granted");
* }, * },
* }); * });
* ``` * ```
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; * import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
* *
* Deno.test({ * Deno.test({
* name: "false", * name: "false",
* permissions: { * permissions: {
* net: false, * net: false,
* }, * },
* async fn() { * async fn() {
* const status = await Deno.permissions.query({ name: "net" }); * const status = await Deno.permissions.query({ name: "net" });
* assertEquals(status.state, "denied"); * assertEquals(status.state, "denied");
* }, * },
* }); * });
* ``` * ```
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; * import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
* *
* Deno.test({ * Deno.test({
* name: "localhost:8080", * name: "localhost:8080",
* permissions: { * permissions: {
* net: ["localhost:8080"], * net: ["localhost:8080"],
* }, * },
* async fn() { * async fn() {
* const status = await Deno.permissions.query({ name: "net", host: "localhost:8080" }); * const status = await Deno.permissions.query({ name: "net", host: "localhost:8080" });
* assertEquals(status.state, "granted"); * assertEquals(status.state, "granted");
* }, * },
* }); * });
* ``` * ```
*/ */
net?: "inherit" | boolean | string[]; net?: "inherit" | boolean | string[];
/** Specifies if the `ffi` permission should be requested or revoked. /** Specifies if the `ffi` permission should be requested or revoked.
* If set to `"inherit"`, the current `ffi` permission will be inherited. * If set to `"inherit"`, the current `ffi` permission will be inherited.
* If set to `true`, the global `ffi` permission will be requested. * If set to `true`, the global `ffi` permission will be requested.
* If set to `false`, the global `ffi` permission will be revoked. * If set to `false`, the global `ffi` permission will be revoked.
* *
* Defaults to "inherit". * Defaults to "inherit".
*/ */
ffi?: "inherit" | boolean; ffi?: "inherit" | boolean;
/** Specifies if the `read` permission should be requested or revoked. /** Specifies if the `read` permission should be requested or revoked.
* If set to `"inherit"`, the current `read` permission will be inherited. * If set to `"inherit"`, the current `read` permission will be inherited.
* If set to `true`, the global `read` permission will be requested. * If set to `true`, the global `read` permission will be requested.
* If set to `false`, the global `read` permission will be revoked. * If set to `false`, the global `read` permission will be revoked.
* If set to `Array<string | URL>`, the `read` permission will be requested with the * If set to `Array<string | URL>`, the `read` permission will be requested with the
* specified file paths. * specified file paths.
* *
* Defaults to "inherit". * Defaults to "inherit".
*/ */
read?: "inherit" | boolean | Array<string | URL>; read?: "inherit" | boolean | Array<string | URL>;
/** Specifies if the `run` permission should be requested or revoked. /** Specifies if the `run` permission should be requested or revoked.
* If set to `"inherit"`, the current `run` permission will be inherited. * If set to `"inherit"`, the current `run` permission will be inherited.
* If set to `true`, the global `run` permission will be requested. * If set to `true`, the global `run` permission will be requested.
* If set to `false`, the global `run` permission will be revoked. * If set to `false`, the global `run` permission will be revoked.
* *
* Defaults to "inherit". * Defaults to "inherit".
*/ */
run?: "inherit" | boolean | Array<string | URL>; run?: "inherit" | boolean | Array<string | URL>;
/** Specifies if the `write` permission should be requested or revoked. /** Specifies if the `write` permission should be requested or revoked.
* If set to `"inherit"`, the current `write` permission will be inherited. * If set to `"inherit"`, the current `write` permission will be inherited.
* If set to `true`, the global `write` permission will be requested. * If set to `true`, the global `write` permission will be requested.
* If set to `false`, the global `write` permission will be revoked. * If set to `false`, the global `write` permission will be revoked.
* If set to `Array<string | URL>`, the `write` permission will be requested with the * If set to `Array<string | URL>`, the `write` permission will be requested with the
* specified file paths. * specified file paths.
* *
* Defaults to "inherit". * Defaults to "inherit".
*/ */
write?: "inherit" | boolean | Array<string | URL>; write?: "inherit" | boolean | Array<string | URL>;
}; };
} }
@ -1335,27 +1333,27 @@ declare namespace Deno {
} }
/** **UNSTABLE** New API, yet to be vetted. /** **UNSTABLE** New API, yet to be vetted.
* *
* Create a TLS connection with an attached client certificate. * Create a TLS connection with an attached client certificate.
* *
* ```ts * ```ts
* const conn = await Deno.connectTls({ * const conn = await Deno.connectTls({
* hostname: "deno.land", * hostname: "deno.land",
* port: 443, * port: 443,
* certChain: "---- BEGIN CERTIFICATE ----\n ...", * certChain: "---- BEGIN CERTIFICATE ----\n ...",
* privateKey: "---- BEGIN PRIVATE KEY ----\n ...", * privateKey: "---- BEGIN PRIVATE KEY ----\n ...",
* }); * });
* ``` * ```
* *
* Requires `allow-net` permission. * Requires `allow-net` permission.
*/ */
export function connectTls( export function connectTls(
options: ConnectTlsOptions & ConnectTlsClientCertOptions, options: ConnectTlsOptions & ConnectTlsClientCertOptions,
): Promise<Conn>; ): Promise<Conn>;
export interface StartTlsOptions { export interface StartTlsOptions {
/** A literal IP address or host name that can be resolved to an IP address. /** A literal IP address or host name that can be resolved to an IP address.
* If not specified, defaults to `127.0.0.1`. */ * If not specified, defaults to `127.0.0.1`. */
hostname?: string; hostname?: string;
/** Server certificate file. */ /** Server certificate file. */
certFile?: string; certFile?: string;

View file

@ -333,8 +333,8 @@
}; };
/** /**
* @type {typeof primordials.makeSafe} * @type {typeof primordials.makeSafe}
*/ */
const makeSafe = (unsafe, safe) => { const makeSafe = (unsafe, safe) => {
if (SymbolIterator in unsafe.prototype) { if (SymbolIterator in unsafe.prototype) {
const dummy = new unsafe(); const dummy = new unsafe();

View file

@ -944,10 +944,10 @@
} }
/** /**
* @param {string} format * @param {string} format
* @param {CryptoKey} key * @param {CryptoKey} key
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
// deno-lint-ignore require-await // deno-lint-ignore require-await
async exportKey(format, key) { async exportKey(format, key) {
webidl.assertBranded(this, SubtleCrypto); webidl.assertBranded(this, SubtleCrypto);
@ -1033,11 +1033,11 @@
} }
/** /**
* @param {AlgorithmIdentifier} algorithm * @param {AlgorithmIdentifier} algorithm
* @param {CryptoKey} baseKey * @param {CryptoKey} baseKey
* @param {number} length * @param {number} length
* @returns {Promise<ArrayBuffer>} * @returns {Promise<ArrayBuffer>}
*/ */
async deriveBits(algorithm, baseKey, length) { async deriveBits(algorithm, baseKey, length) {
webidl.assertBranded(this, SubtleCrypto); webidl.assertBranded(this, SubtleCrypto);
const prefix = "Failed to execute 'deriveBits' on 'SubtleCrypto'"; const prefix = "Failed to execute 'deriveBits' on 'SubtleCrypto'";

View file

@ -22,7 +22,7 @@ declare namespace Deno {
/** Waits for and resolves to the next connection to the `Listener`. */ /** Waits for and resolves to the next connection to the `Listener`. */
accept(): Promise<Conn>; accept(): Promise<Conn>;
/** Close closes the listener. Any pending accept promises will be rejected /** Close closes the listener. Any pending accept promises will be rejected
* with errors. */ * with errors. */
close(): void; close(): void;
/** Return the address of the `Listener`. */ /** Return the address of the `Listener`. */
readonly addr: Addr; readonly addr: Addr;
@ -41,7 +41,7 @@ declare namespace Deno {
/** The resource ID of the connection. */ /** The resource ID of the connection. */
readonly rid: number; readonly rid: number;
/** Shuts down (`shutdown(2)`) the write side of the connection. Most /** Shuts down (`shutdown(2)`) the write side of the connection. Most
* callers should just use `close()`. */ * callers should just use `close()`. */
closeWrite(): Promise<void>; closeWrite(): Promise<void>;
} }
@ -49,20 +49,20 @@ declare namespace Deno {
/** The port to listen on. */ /** The port to listen on. */
port: number; port: number;
/** A literal IP address or host name that can be resolved to an IP address. /** A literal IP address or host name that can be resolved to an IP address.
* If not specified, defaults to `0.0.0.0`. */ * If not specified, defaults to `0.0.0.0`. */
hostname?: string; hostname?: string;
} }
/** Listen announces on the local transport address. /** Listen announces on the local transport address.
* *
* ```ts * ```ts
* const listener1 = Deno.listen({ port: 80 }) * const listener1 = Deno.listen({ port: 80 })
* const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 }) * const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 })
* const listener3 = Deno.listen({ hostname: "[2001:db8::1]", port: 80 }); * const listener3 = Deno.listen({ hostname: "[2001:db8::1]", port: 80 });
* const listener4 = Deno.listen({ hostname: "golang.org", port: 80, transport: "tcp" }); * const listener4 = Deno.listen({ hostname: "golang.org", port: 80, transport: "tcp" });
* ``` * ```
* *
* Requires `allow-net` permission. */ * Requires `allow-net` permission. */
export function listen( export function listen(
options: ListenOptions & { transport?: "tcp" }, options: ListenOptions & { transport?: "tcp" },
): Listener; ): Listener;
@ -78,73 +78,73 @@ declare namespace Deno {
} }
/** Listen announces on the local transport address over TLS (transport layer /** Listen announces on the local transport address over TLS (transport layer
* security). * security).
* *
* ```ts * ```ts
* const lstnr = Deno.listenTls({ port: 443, certFile: "./server.crt", keyFile: "./server.key" }); * const lstnr = Deno.listenTls({ port: 443, certFile: "./server.crt", keyFile: "./server.key" });
* ``` * ```
* *
* Requires `allow-net` permission. */ * Requires `allow-net` permission. */
export function listenTls(options: ListenTlsOptions): Listener; export function listenTls(options: ListenTlsOptions): Listener;
export interface ConnectOptions { export interface ConnectOptions {
/** The port to connect to. */ /** The port to connect to. */
port: number; port: number;
/** A literal IP address or host name that can be resolved to an IP address. /** A literal IP address or host name that can be resolved to an IP address.
* If not specified, defaults to `127.0.0.1`. */ * If not specified, defaults to `127.0.0.1`. */
hostname?: string; hostname?: string;
transport?: "tcp"; transport?: "tcp";
} }
/** /**
* Connects to the hostname (default is "127.0.0.1") and port on the named * Connects to the hostname (default is "127.0.0.1") and port on the named
* transport (default is "tcp"), and resolves to the connection (`Conn`). * transport (default is "tcp"), and resolves to the connection (`Conn`).
* *
* ```ts * ```ts
* const conn1 = await Deno.connect({ port: 80 }); * const conn1 = await Deno.connect({ port: 80 });
* const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 }); * const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
* const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 }); * const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
* const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" }); * const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
* ``` * ```
* *
* Requires `allow-net` permission for "tcp". */ * Requires `allow-net` permission for "tcp". */
export function connect(options: ConnectOptions): Promise<Conn>; export function connect(options: ConnectOptions): Promise<Conn>;
export interface ConnectTlsOptions { export interface ConnectTlsOptions {
/** The port to connect to. */ /** The port to connect to. */
port: number; port: number;
/** A literal IP address or host name that can be resolved to an IP address. /** A literal IP address or host name that can be resolved to an IP address.
* If not specified, defaults to `127.0.0.1`. */ * If not specified, defaults to `127.0.0.1`. */
hostname?: string; hostname?: string;
/** Server certificate file. */ /** Server certificate file. */
certFile?: string; certFile?: string;
} }
/** Establishes a secure connection over TLS (transport layer security) using /** Establishes a secure connection over TLS (transport layer security) using
* an optional cert file, hostname (default is "127.0.0.1") and port. The * an optional cert file, hostname (default is "127.0.0.1") and port. The
* cert file is optional and if not included Mozilla's root certificates will * cert file is optional and if not included Mozilla's root certificates will
* be used (see also https://github.com/ctz/webpki-roots for specifics) * be used (see also https://github.com/ctz/webpki-roots for specifics)
* *
* ```ts * ```ts
* const conn1 = await Deno.connectTls({ port: 80 }); * const conn1 = await Deno.connectTls({ port: 80 });
* const conn2 = await Deno.connectTls({ certFile: "./certs/my_custom_root_CA.pem", hostname: "192.0.2.1", port: 80 }); * const conn2 = await Deno.connectTls({ certFile: "./certs/my_custom_root_CA.pem", hostname: "192.0.2.1", port: 80 });
* const conn3 = await Deno.connectTls({ hostname: "[2001:db8::1]", port: 80 }); * const conn3 = await Deno.connectTls({ hostname: "[2001:db8::1]", port: 80 });
* const conn4 = await Deno.connectTls({ certFile: "./certs/my_custom_root_CA.pem", hostname: "golang.org", port: 80}); * const conn4 = await Deno.connectTls({ certFile: "./certs/my_custom_root_CA.pem", hostname: "golang.org", port: 80});
* ``` * ```
* *
* Requires `allow-net` permission. * Requires `allow-net` permission.
*/ */
export function connectTls(options: ConnectTlsOptions): Promise<Conn>; export function connectTls(options: ConnectTlsOptions): Promise<Conn>;
/** Shutdown socket send operations. /** Shutdown socket send operations.
* *
* Matches behavior of POSIX shutdown(3). * Matches behavior of POSIX shutdown(3).
* *
* ```ts * ```ts
* const listener = Deno.listen({ port: 80 }); * const listener = Deno.listen({ port: 80 });
* const conn = await listener.accept(); * const conn = await listener.accept();
* Deno.shutdown(conn.rid); * Deno.shutdown(conn.rid);
* ``` * ```
*/ */
export function shutdown(rid: number): Promise<void>; export function shutdown(rid: number): Promise<void>;
} }

View file

@ -327,12 +327,12 @@
const pendingFireTimers = []; const pendingFireTimers = [];
/** Process and run a single ready timer macrotask. /** Process and run a single ready timer macrotask.
* This function should be registered through Deno.core.setMacrotaskCallback. * This function should be registered through Deno.core.setMacrotaskCallback.
* Returns true when all ready macrotasks have been processed, false if more * Returns true when all ready macrotasks have been processed, false if more
* ready ones are available. The Isolate future would rely on the return value * ready ones are available. The Isolate future would rely on the return value
* to repeatedly invoke this function until depletion. Multiple invocations * to repeatedly invoke this function until depletion. Multiple invocations
* of this function one at a time ensures newly ready microtasks are processed * of this function one at a time ensures newly ready microtasks are processed
* before next macrotask timer callback is invoked. */ * before next macrotask timer callback is invoked. */
function handleTimerMacrotask() { function handleTimerMacrotask() {
if (pendingFireTimers.length > 0) { if (pendingFireTimers.length > 0) {
fire(ArrayPrototypeShift(pendingFireTimers)); fire(ArrayPrototypeShift(pendingFireTimers));

View file

@ -88,7 +88,6 @@ declare class URLSearchParams {
* console.log(value, key, parent); * console.log(value, key, parent);
* }); * });
* ``` * ```
*
*/ */
forEach( forEach(
callbackfn: (value: string, key: string, parent: this) => void, callbackfn: (value: string, key: string, parent: this) => void,

View file

@ -38,7 +38,7 @@
} }
/** Clone a value in a similar way to structured cloning. It is similar to a /** Clone a value in a similar way to structured cloning. It is similar to a
* StructureDeserialize(StructuredSerialize(...)). */ * StructureDeserialize(StructuredSerialize(...)). */
function structuredClone(value) { function structuredClone(value) {
// Performance optimization for buffers, otherwise // Performance optimization for buffers, otherwise
// `serialize/deserialize` will allocate new buffer. // `serialize/deserialize` will allocate new buffer.

View file

@ -2850,7 +2850,7 @@
/** /**
* @template W * @template W
* @param {WritableStream<W>} stream * @param {WritableStream<W>} stream
* */ */
function writableStreamMarkFirstWriteRequestInFlight(stream) { function writableStreamMarkFirstWriteRequestInFlight(stream) {
assert(stream[_inFlightWriteRequest] === undefined); assert(stream[_inFlightWriteRequest] === undefined);
assert(stream[_writeRequests].length); assert(stream[_writeRequests].length);
@ -3765,7 +3765,6 @@
[_writable]; [_writable];
/** /**
*
* @param {Transformer<I, O>} transformer * @param {Transformer<I, O>} transformer
* @param {QueuingStrategy<I>} writableStrategy * @param {QueuingStrategy<I>} writableStrategy
* @param {QueuingStrategy<O>} readableStrategy * @param {QueuingStrategy<O>} readableStrategy

View file

@ -38,7 +38,6 @@
#rid = null; #rid = null;
/** /**
*
* @param {string} label * @param {string} label
* @param {TextDecoderOptions} options * @param {TextDecoderOptions} options
*/ */
@ -198,7 +197,6 @@
#transform; #transform;
/** /**
*
* @param {string} label * @param {string} label
* @param {TextDecoderOptions} options * @param {TextDecoderOptions} options
*/ */

View file

@ -354,7 +354,7 @@
/** /**
* @param {Blob} blob * @param {Blob} blob
* @param {string} [encoding] * @param {string} [encoding]
*/ */
readAsText(blob, encoding = undefined) { readAsText(blob, encoding = undefined) {
webidl.assertBranded(this, FileReader); webidl.assertBranded(this, FileReader);
const prefix = "Failed to execute 'readAsBinaryString' on 'FileReader'"; const prefix = "Failed to execute 'readAsBinaryString' on 'FileReader'";

View file

@ -22,54 +22,54 @@ interface EventInit {
declare class Event { declare class Event {
constructor(type: string, eventInitDict?: EventInit); 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. */
readonly bubbles: boolean; readonly bubbles: boolean;
cancelBubble: boolean; cancelBubble: boolean;
/** Returns true or false depending on how event was initialized. Its return /** Returns true or false depending on how event was initialized. Its return
* value does not always carry meaning, but true can indicate that part of the * value does not always carry meaning, but true can indicate that part of the
* operation during which event was dispatched, can be canceled by invoking * operation during which event was dispatched, can be canceled by invoking
* the preventDefault() method. */ * the preventDefault() method. */
readonly cancelable: boolean; readonly cancelable: boolean;
/** 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 invokes listeners past a ShadowRoot node that is the root of its * event invokes listeners past a ShadowRoot node that is the root of its
* target, and false otherwise. */ * target, and false otherwise. */
readonly composed: boolean; readonly composed: boolean;
/** Returns the object whose event listener's callback is currently being /** Returns the object whose event listener's callback is currently being
* invoked. */ * invoked. */
readonly currentTarget: EventTarget | null; readonly currentTarget: EventTarget | null;
/** Returns true if preventDefault() was invoked successfully to indicate /** Returns true if preventDefault() was invoked successfully to indicate
* cancellation, and false otherwise. */ * cancellation, and false otherwise. */
readonly defaultPrevented: boolean; readonly defaultPrevented: boolean;
/** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE,
* AT_TARGET, and BUBBLING_PHASE. */ * AT_TARGET, and BUBBLING_PHASE. */
readonly eventPhase: number; readonly eventPhase: number;
/** Returns true if event was dispatched by the user agent, and false /** Returns true if event was dispatched by the user agent, and false
* otherwise. */ * otherwise. */
readonly isTrusted: boolean; readonly isTrusted: boolean;
/** Returns the object to which event is dispatched (its target). */ /** Returns the object to which event is dispatched (its target). */
readonly target: EventTarget | null; readonly target: EventTarget | null;
/** Returns the event's timestamp as the number of milliseconds measured /** Returns the event's timestamp as the number of milliseconds measured
* relative to the time origin. */ * relative to the time origin. */
readonly timeStamp: number; readonly timeStamp: number;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */ /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string; readonly type: string;
/** Returns the invocation target objects of event's path (objects on which /** Returns the invocation target objects of event's path (objects on which
* listeners will be invoked), except for any nodes in shadow trees of which * listeners will be invoked), except for any nodes in shadow trees of which
* the shadow root's mode is "closed" that are not reachable from event's * the shadow root's mode is "closed" that are not reachable from event's
* currentTarget. */ * currentTarget. */
composedPath(): EventTarget[]; composedPath(): EventTarget[];
/** If invoked when the cancelable attribute value is true, and while /** If invoked when the cancelable attribute value is true, and while
* executing a listener for the event with passive set to false, signals to * executing a listener for the event with passive set to false, signals to
* the operation that caused event to be dispatched that it needs to be * the operation that caused event to be dispatched that it needs to be
* canceled. */ * canceled. */
preventDefault(): void; preventDefault(): void;
/** Invoking this method prevents event from reaching any registered event /** Invoking this method prevents event from reaching any registered event
* listeners after the current one finishes running and, when dispatched in a * listeners after the current one finishes running and, when dispatched in a
* tree, also prevents event from reaching any other objects. */ * tree, also prevents event from reaching any other objects. */
stopImmediatePropagation(): void; stopImmediatePropagation(): void;
/** When dispatched in a tree, invoking this method prevents event from /** When dispatched in a tree, invoking this method prevents event from
* reaching any objects other than the current object. */ * reaching any objects other than the current object. */
stopPropagation(): void; stopPropagation(): void;
readonly AT_TARGET: number; readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number; readonly BUBBLING_PHASE: number;
@ -82,9 +82,9 @@ declare class Event {
} }
/** /**
* 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.
*/ */
declare class EventTarget { declare class 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
@ -240,7 +240,7 @@ declare class 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
* signal to any observers that the associated activity is to be aborted. */ * signal to any observers that the associated activity is to be aborted. */
abort(): void; abort(): void;
} }
@ -249,10 +249,10 @@ interface AbortSignalEventMap {
} }
/** A signal object that allows you to communicate with a DOM request (such as a /** A signal object that allows you to communicate with a DOM request (such as a
* Fetch) and abort it if required via an AbortController object. */ * Fetch) and abort it if required via an AbortController object. */
interface AbortSignal extends EventTarget { 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;
onabort: ((this: AbortSignal, ev: Event) => any) | null; onabort: ((this: AbortSignal, ev: Event) => any) | null;
addEventListener<K extends keyof AbortSignalEventMap>( addEventListener<K extends keyof AbortSignalEventMap>(

View file

@ -219,10 +219,10 @@
*/ */
/** /**
* @param {string} name * @param {string} name
* @param {InnerGPUAdapter} inner * @param {InnerGPUAdapter} inner
* @returns {GPUAdapter} * @returns {GPUAdapter}
*/ */
function createGPUAdapter(name, inner) { function createGPUAdapter(name, inner) {
/** @type {GPUAdapter} */ /** @type {GPUAdapter} */
const adapter = webidl.createBranded(GPUAdapter); const adapter = webidl.createBranded(GPUAdapter);
@ -544,7 +544,6 @@
const _message = Symbol("[[message]]"); const _message = Symbol("[[message]]");
/** /**
*
* @param {string | undefined} reason * @param {string | undefined} reason
* @param {string} message * @param {string} message
* @returns {GPUDeviceLostInfo} * @returns {GPUDeviceLostInfo}
@ -2269,8 +2268,8 @@
/** /**
* @param {string | null} label * @param {string | null} label
* @param {InnerGPUDevice} device * @param {InnerGPUDevice} device
* @param {number} rid * @param {number} rid
* @returns {GPUBindGroup} * @returns {GPUBindGroup}
*/ */
function createGPUBindGroup(label, device, rid) { function createGPUBindGroup(label, device, rid) {
@ -2312,8 +2311,8 @@
/** /**
* @param {string | null} label * @param {string | null} label
* @param {InnerGPUDevice} device * @param {InnerGPUDevice} device
* @param {number} rid * @param {number} rid
* @returns {GPUShaderModule} * @returns {GPUShaderModule}
*/ */
function createGPUShaderModule(label, device, rid) { function createGPUShaderModule(label, device, rid) {
@ -3377,7 +3376,6 @@
} }
/** /**
*
* @param {number} x * @param {number} x
* @param {number} y * @param {number} y
* @param {number} width * @param {number} width

View file

@ -75,7 +75,7 @@
/** /**
* @param {string} permission * @param {string} permission
* @return {(boolean | string[])} * @return {(boolean | string[])}
* */ */
function parseArrayPermission( function parseArrayPermission(
value, value,
permission, permission,

View file

@ -111,7 +111,6 @@
const statusCache = new Map(); const statusCache = new Map();
/** /**
*
* @param {Deno.PermissionDescriptor} desc * @param {Deno.PermissionDescriptor} desc
* @param {Deno.PermissionState} state * @param {Deno.PermissionState} state
* @returns {PermissionStatus} * @returns {PermissionStatus}