summaryrefslogtreecommitdiff
path: root/cli/js/web
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/web')
-rw-r--r--cli/js/web/base64.ts20
-rw-r--r--cli/js/web/blob.ts8
-rw-r--r--cli/js/web/body.ts12
-rw-r--r--cli/js/web/console.ts146
-rw-r--r--cli/js/web/console_table.ts12
-rw-r--r--cli/js/web/decode_utf8.ts20
-rw-r--r--cli/js/web/dom_file.ts2
-rw-r--r--cli/js/web/dom_iterable.ts10
-rw-r--r--cli/js/web/dom_types.d.ts4
-rw-r--r--cli/js/web/error_event.ts2
-rw-r--r--cli/js/web/event.ts8
-rw-r--r--cli/js/web/event_target.ts42
-rw-r--r--cli/js/web/fetch.ts22
-rw-r--r--cli/js/web/fetch/multipart.ts4
-rw-r--r--cli/js/web/form_data.ts6
-rw-r--r--cli/js/web/headers.ts10
-rw-r--r--cli/js/web/performance.ts50
-rw-r--r--cli/js/web/streams/internals.ts398
-rw-r--r--cli/js/web/streams/queuing_strategy.ts12
-rw-r--r--cli/js/web/streams/readable_byte_stream_controller.ts20
-rw-r--r--cli/js/web/streams/readable_stream.ts30
-rw-r--r--cli/js/web/streams/readable_stream_async_iterator.ts31
-rw-r--r--cli/js/web/streams/readable_stream_default_controller.ts16
-rw-r--r--cli/js/web/streams/readable_stream_default_reader.ts8
-rw-r--r--cli/js/web/streams/symbols.ts2
-rw-r--r--cli/js/web/streams/transform_stream.ts32
-rw-r--r--cli/js/web/streams/transform_stream_default_controller.ts12
-rw-r--r--cli/js/web/streams/writable_stream.ts10
-rw-r--r--cli/js/web/streams/writable_stream_default_controller.ts4
-rw-r--r--cli/js/web/streams/writable_stream_default_writer.ts24
-rw-r--r--cli/js/web/text_encoding.ts14
-rw-r--r--cli/js/web/timers.ts6
-rw-r--r--cli/js/web/url.ts42
-rw-r--r--cli/js/web/url_search_params.ts8
-rw-r--r--cli/js/web/util.ts16
-rw-r--r--cli/js/web/workers.ts6
36 files changed, 532 insertions, 537 deletions
diff --git a/cli/js/web/base64.ts b/cli/js/web/base64.ts
index 328311d03..6f2459b92 100644
--- a/cli/js/web/base64.ts
+++ b/cli/js/web/base64.ts
@@ -45,7 +45,7 @@ export function byteLength(b64: string): number {
function _byteLength(
b64: string,
validLen: number,
- placeHoldersLen: number
+ placeHoldersLen: number,
): number {
return ((validLen + placeHoldersLen) * 3) / 4 - placeHoldersLen;
}
@@ -65,8 +65,7 @@ export function toByteArray(b64: string): Uint8Array {
let i;
for (i = 0; i < len; i += 4) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 18) |
+ tmp = (revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) |
(revLookup[b64.charCodeAt(i + 2)] << 6) |
revLookup[b64.charCodeAt(i + 3)];
@@ -76,15 +75,13 @@ export function toByteArray(b64: string): Uint8Array {
}
if (placeHoldersLen === 2) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 2) |
+ tmp = (revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4);
arr[curByte++] = tmp & 0xff;
}
if (placeHoldersLen === 1) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 10) |
+ tmp = (revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2);
arr[curByte++] = (tmp >> 8) & 0xff;
@@ -107,8 +104,7 @@ function encodeChunk(uint8: Uint8Array, start: number, end: number): string {
let tmp;
const output = [];
for (let i = start; i < end; i += 3) {
- tmp =
- ((uint8[i] << 16) & 0xff0000) +
+ tmp = ((uint8[i] << 16) & 0xff0000) +
((uint8[i + 1] << 8) & 0xff00) +
(uint8[i + 2] & 0xff);
output.push(tripletToBase64(tmp));
@@ -129,8 +125,8 @@ export function fromByteArray(uint8: Uint8Array): string {
encodeChunk(
uint8,
i,
- i + maxChunkLength > len2 ? len2 : i + maxChunkLength
- )
+ i + maxChunkLength > len2 ? len2 : i + maxChunkLength,
+ ),
);
}
@@ -144,7 +140,7 @@ export function fromByteArray(uint8: Uint8Array): string {
lookup[tmp >> 10] +
lookup[(tmp >> 4) & 0x3f] +
lookup[(tmp << 2) & 0x3f] +
- "="
+ "=",
);
}
diff --git a/cli/js/web/blob.ts b/cli/js/web/blob.ts
index 92286029f..7034da723 100644
--- a/cli/js/web/blob.ts
+++ b/cli/js/web/blob.ts
@@ -51,7 +51,7 @@ function convertLineEndingsToNative(s: string): string {
function collectSequenceNotCRLF(
s: string,
- position: number
+ position: number,
): { collected: string; newPosition: number } {
const start = position;
for (
@@ -64,7 +64,7 @@ function collectSequenceNotCRLF(
function toUint8Arrays(
blobParts: BlobPart[],
- doNormalizeLineEndingsToNative: boolean
+ doNormalizeLineEndingsToNative: boolean,
): Uint8Array[] {
const ret: Uint8Array[] = [];
const enc = new TextEncoder();
@@ -103,7 +103,7 @@ function toUint8Arrays(
function processBlobParts(
blobParts: BlobPart[],
- options: BlobPropertyBag
+ options: BlobPropertyBag,
): Uint8Array {
const normalizeLineEndingsToNative = options.ending === "native";
// ArrayBuffer.transfer is not yet implemented in V8, so we just have to
@@ -136,7 +136,7 @@ function getStream(blobBytes: Uint8Array): ReadableStream<ArrayBufferView> {
}
async function readBytes(
- reader: ReadableStreamReader<ArrayBufferView>
+ reader: ReadableStreamReader<ArrayBufferView>,
): Promise<ArrayBuffer> {
const chunks: Uint8Array[] = [];
while (true) {
diff --git a/cli/js/web/body.ts b/cli/js/web/body.ts
index 69aca459f..a7a120ad6 100644
--- a/cli/js/web/body.ts
+++ b/cli/js/web/body.ts
@@ -40,13 +40,13 @@ function validateBodyType(owner: Body, bodySource: BodyInit | null): boolean {
return true; // null body is fine
}
throw new Error(
- `Bad ${owner.constructor.name} body type: ${bodySource.constructor.name}`
+ `Bad ${owner.constructor.name} body type: ${bodySource.constructor.name}`,
);
}
async function bufferFromStream(
stream: ReadableStreamReader,
- size?: number
+ size?: number,
): Promise<ArrayBuffer> {
const encoder = new TextEncoder();
const buffer = new Buffer();
@@ -154,7 +154,7 @@ export class Body implements domTypes.Body {
const value = split.join("=").replace(/\+/g, " ");
formData.append(
decodeURIComponent(name),
- decodeURIComponent(value)
+ decodeURIComponent(value),
);
}
});
@@ -191,7 +191,7 @@ export class Body implements domTypes.Body {
} else if (typeof this._bodySource === "string") {
const enc = new TextEncoder();
return Promise.resolve(
- enc.encode(this._bodySource).buffer as ArrayBuffer
+ enc.encode(this._bodySource).buffer as ArrayBuffer,
);
} else if (this._bodySource instanceof ReadableStreamImpl) {
return bufferFromStream(this._bodySource.getReader(), this.#size);
@@ -201,13 +201,13 @@ export class Body implements domTypes.Body {
) {
const enc = new TextEncoder();
return Promise.resolve(
- enc.encode(this._bodySource.toString()).buffer as ArrayBuffer
+ enc.encode(this._bodySource.toString()).buffer as ArrayBuffer,
);
} else if (!this._bodySource) {
return Promise.resolve(new ArrayBuffer(0));
}
throw new Error(
- `Body type not yet implemented: ${this._bodySource.constructor.name}`
+ `Body type not yet implemented: ${this._bodySource.constructor.name}`,
);
}
}
diff --git a/cli/js/web/console.ts b/cli/js/web/console.ts
index 5ddf50114..181cdb664 100644
--- a/cli/js/web/console.ts
+++ b/cli/js/web/console.ts
@@ -94,7 +94,7 @@ interface InspectIterableOptions<T> {
ctx: ConsoleContext,
level: number,
inspectOptions: Required<InspectOptions>,
- next: () => IteratorResult<[unknown, T], unknown>
+ next: () => IteratorResult<[unknown, T], unknown>,
) => string;
group: boolean;
sort: boolean;
@@ -107,7 +107,7 @@ function inspectIterable<T>(
ctx: ConsoleContext,
level: number,
options: InspectIterableOptions<T>,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
if (level >= inspectOptions.depth) {
return cyan(`[${options.typeName}]`);
@@ -129,8 +129,8 @@ function inspectIterable<T>(
ctx,
level + 1,
inspectOptions,
- next.bind(iter)
- )
+ next.bind(iter),
+ ),
);
}
entriesLength++;
@@ -150,25 +150,25 @@ function inspectIterable<T>(
const initIndentation = `\n${DEFAULT_INDENT.repeat(level + 1)}`;
const entryIndentation = `,\n${DEFAULT_INDENT.repeat(level + 1)}`;
- const closingIndentation = `${
- inspectOptions.trailingComma ? "," : ""
- }\n${DEFAULT_INDENT.repeat(level)}`;
+ const closingIndentation = `${inspectOptions.trailingComma ? "," : ""}\n${
+ DEFAULT_INDENT.repeat(level)
+ }`;
let iContent: string;
if (options.group && entries.length > MIN_GROUP_LENGTH) {
const groups = groupEntries(entries, level, value);
- iContent = `${initIndentation}${groups.join(
- entryIndentation
- )}${closingIndentation}`;
+ iContent = `${initIndentation}${
+ groups.join(entryIndentation)
+ }${closingIndentation}`;
} else {
iContent = entries.length === 0 ? "" : ` ${entries.join(", ")} `;
if (
stripColor(iContent).length > LINE_BREAKING_LENGTH ||
!inspectOptions.compact
) {
- iContent = `${initIndentation}${entries.join(
- entryIndentation
- )}${closingIndentation}`;
+ iContent = `${initIndentation}${
+ entries.join(entryIndentation)
+ }${closingIndentation}`;
}
}
@@ -181,7 +181,7 @@ function groupEntries<T>(
entries: string[],
level: number,
value: Iterable<T>,
- iterableLimit = 100
+ iterableLimit = 100,
): string[] {
let totalLength = 0;
let maxLength = 0;
@@ -225,12 +225,12 @@ function groupEntries<T>(
// Divide that by `actualMax` to receive the correct number of columns.
// The added bias increases the columns for short entries.
Math.round(
- Math.sqrt(approxCharHeights * biasedMax * entriesLength) / biasedMax
+ Math.sqrt(approxCharHeights * biasedMax * entriesLength) / biasedMax,
),
// Do not exceed the breakLength.
Math.floor((LINE_BREAKING_LENGTH - (level + 1)) / actualMax),
// Limit the columns to a maximum of fifteen.
- 15
+ 15,
);
// Return with the original output if no grouping should happen.
if (columns <= 1) {
@@ -272,8 +272,7 @@ function groupEntries<T>(
str += `${entries[j]}, `[order](padding, " ");
}
if (order === "padStart") {
- const padding =
- maxLineLength[j - i] +
+ const padding = maxLineLength[j - i] +
entries[j].length -
dataLen[j] -
separatorSpace;
@@ -295,7 +294,7 @@ function inspectValue(
value: unknown,
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
switch (typeof value) {
case "string":
@@ -353,14 +352,13 @@ function inspectValueWithQuotes(
value: unknown,
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
switch (typeof value) {
case "string":
- const trunc =
- value.length > STR_ABBREVIATE_SIZE
- ? value.slice(0, STR_ABBREVIATE_SIZE) + "..."
- : value;
+ const trunc = value.length > STR_ABBREVIATE_SIZE
+ ? value.slice(0, STR_ABBREVIATE_SIZE) + "..."
+ : value;
return green(quoteString(trunc)); // Quoted strings are green
default:
return inspectValue(value, ctx, level, inspectOptions);
@@ -371,7 +369,7 @@ function inspectArray(
value: unknown[],
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
const options: InspectIterableOptions<unknown> = {
typeName: "Array",
@@ -404,7 +402,7 @@ function inspectTypedArray(
value: TypedArray,
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
const valueLength = value.length;
const options: InspectIterableOptions<unknown> = {
@@ -425,7 +423,7 @@ function inspectSet(
value: Set<unknown>,
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
const options: InspectIterableOptions<unknown> = {
typeName: "Set",
@@ -445,7 +443,7 @@ function inspectMap(
value: Map<unknown, unknown>,
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
const options: InspectIterableOptions<[unknown]> = {
typeName: "Map",
@@ -453,12 +451,14 @@ function inspectMap(
delims: ["{", "}"],
entryHandler: (entry, ctx, level, inspectOptions): string => {
const [key, val] = entry;
- return `${inspectValueWithQuotes(
- key,
- ctx,
- level + 1,
- inspectOptions
- )} => ${inspectValueWithQuotes(val, ctx, level + 1, inspectOptions)}`;
+ return `${
+ inspectValueWithQuotes(
+ key,
+ ctx,
+ level + 1,
+ inspectOptions,
+ )
+ } => ${inspectValueWithQuotes(val, ctx, level + 1, inspectOptions)}`;
},
group: false,
sort: inspectOptions.sorted,
@@ -469,7 +469,7 @@ function inspectMap(
ctx,
level,
options,
- inspectOptions
+ inspectOptions,
);
}
@@ -510,7 +510,7 @@ function inspectPromise(
value: Promise<unknown>,
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
const [state, result] = Deno.core.getPromiseDetails(value);
@@ -518,15 +518,18 @@ function inspectPromise(
return `Promise { ${cyan("<pending>")} }`;
}
- const prefix =
- state === PromiseState.Fulfilled ? "" : `${red("<rejected>")} `;
+ const prefix = state === PromiseState.Fulfilled
+ ? ""
+ : `${red("<rejected>")} `;
- const str = `${prefix}${inspectValueWithQuotes(
- result,
- ctx,
- level + 1,
- inspectOptions
- )}`;
+ const str = `${prefix}${
+ inspectValueWithQuotes(
+ result,
+ ctx,
+ level + 1,
+ inspectOptions,
+ )
+ }`;
if (str.length + PROMISE_STRING_BASE_LENGTH > LINE_BREAKING_LENGTH) {
return `Promise {\n${DEFAULT_INDENT.repeat(level + 1)}${str}\n}`;
@@ -541,7 +544,7 @@ function inspectRawObject(
value: Record<string, unknown>,
ctx: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
if (level >= inspectOptions.depth) {
return cyan("[Object]"); // wrappers are in cyan
@@ -573,28 +576,32 @@ function inspectRawObject(
for (const key of stringKeys) {
entries.push(
- `${key}: ${inspectValueWithQuotes(
- value[key],
- ctx,
- level + 1,
- inspectOptions
- )}`
+ `${key}: ${
+ inspectValueWithQuotes(
+ value[key],
+ ctx,
+ level + 1,
+ inspectOptions,
+ )
+ }`,
);
}
for (const key of symbolKeys) {
entries.push(
- `${key.toString()}: ${inspectValueWithQuotes(
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- value[key as any],
- ctx,
- level + 1,
- inspectOptions
- )}`
+ `${key.toString()}: ${
+ inspectValueWithQuotes(
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ value[key as any],
+ ctx,
+ level + 1,
+ inspectOptions,
+ )
+ }`,
);
}
// Making sure color codes are ignored when calculating the total length
- const totalLength =
- entries.length + level + stripColor(entries.join("")).length;
+ const totalLength = entries.length + level +
+ stripColor(entries.join("")).length;
ctx.delete(value);
@@ -621,7 +628,7 @@ function inspectObject(
value: {},
consoleContext: ConsoleContext,
level: number,
- inspectOptions: Required<InspectOptions>
+ inspectOptions: Required<InspectOptions>,
): string {
if (customInspect in value && typeof value[customInspect] === "function") {
try {
@@ -658,7 +665,7 @@ function inspectObject(
value,
consoleContext,
level,
- inspectOptions
+ inspectOptions,
);
} else {
// Otherwise, default object formatting
@@ -668,7 +675,7 @@ function inspectObject(
export function inspectArgs(
args: unknown[],
- inspectOptions: InspectOptions = {}
+ inspectOptions: InspectOptions = {},
): string {
const rInspectOptions = { ...DEFAULT_INSPECT_OPTIONS, ...inspectOptions };
const first = args[0];
@@ -717,7 +724,7 @@ export function inspectArgs(
args[++a],
new Set<unknown>(),
0,
- rInspectOptions
+ rInspectOptions,
);
break;
case CHAR_PERCENT:
@@ -808,7 +815,7 @@ export class Console {
inspectArgs(args, {
indentLevel: this.indentLevel,
}) + "\n",
- false
+ false,
);
};
@@ -826,7 +833,7 @@ export class Console {
inspectArgs(args, {
indentLevel: this.indentLevel,
}) + "\n",
- true
+ true,
);
};
@@ -879,7 +886,7 @@ export class Console {
if (properties !== undefined && !Array.isArray(properties)) {
throw new Error(
"The 'properties' argument must be of type Array. " +
- "Received type string"
+ "Received type string",
);
}
@@ -927,8 +934,7 @@ export class Console {
let hasPrimitives = false;
Object.keys(resultData).forEach((k, idx): void => {
const value: unknown = resultData[k]!;
- const primitive =
- value === null ||
+ const primitive = value === null ||
(typeof value !== "function" && typeof value !== "object");
if (properties === undefined && primitive) {
hasPrimitives = true;
@@ -1047,7 +1053,7 @@ export const customInspect = Symbol("Deno.customInspect");
export function inspect(
value: unknown,
- inspectOptions: InspectOptions = {}
+ inspectOptions: InspectOptions = {},
): string {
if (typeof value === "string") {
return value;
diff --git a/cli/js/web/console_table.ts b/cli/js/web/console_table.ts
index ba2d763b7..42667d998 100644
--- a/cli/js/web/console_table.ts
+++ b/cli/js/web/console_table.ts
@@ -28,8 +28,8 @@ function isFullWidthCodePoint(code: number): boolean {
return (
code >= 0x1100 &&
(code <= 0x115f || // Hangul Jamo
- code === 0x2329 || // LEFT-POINTING ANGLE BRACKET
- code === 0x232a || // RIGHT-POINTING ANGLE BRACKET
+ code === 0x2329 || // LEFT-POINTING ANGLE BRACKET
+ code === 0x232a || // RIGHT-POINTING ANGLE BRACKET
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
(code >= 0x2e80 && code <= 0x3247 && code !== 0x303f) ||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
@@ -94,7 +94,7 @@ export function cliTable(head: string[], columns: string[][]): string {
const columnWidths = head.map((h: string): number => getStringWidth(h));
const longestColumn = columns.reduce(
(n: number, a: string[]): number => Math.max(n, a.length),
- 0
+ 0,
);
for (let i = 0; i < head.length; i++) {
@@ -114,8 +114,7 @@ export function cliTable(head: string[], columns: string[][]): string {
tableChars.middleMiddle.repeat(i + 2)
);
- let result =
- `${tableChars.topLeft}${divider.join(tableChars.topMiddle)}` +
+ let result = `${tableChars.topLeft}${divider.join(tableChars.topMiddle)}` +
`${tableChars.topRight}\n${renderRow(head, columnWidths)}\n` +
`${tableChars.leftMiddle}${divider.join(tableChars.rowMiddle)}` +
`${tableChars.rightMiddle}\n`;
@@ -124,8 +123,7 @@ export function cliTable(head: string[], columns: string[][]): string {
result += `${renderRow(row, columnWidths)}\n`;
}
- result +=
- `${tableChars.bottomLeft}${divider.join(tableChars.bottomMiddle)}` +
+ result += `${tableChars.bottomLeft}${divider.join(tableChars.bottomMiddle)}` +
tableChars.bottomRight;
return result;
diff --git a/cli/js/web/decode_utf8.ts b/cli/js/web/decode_utf8.ts
index d82634efe..ca190134c 100644
--- a/cli/js/web/decode_utf8.ts
+++ b/cli/js/web/decode_utf8.ts
@@ -31,7 +31,7 @@ declare global {
apply<T, R>(
this: (this: T, ...args: number[]) => R,
thisArg: T,
- args: Uint16Array
+ args: Uint16Array,
): R;
}
}
@@ -39,7 +39,7 @@ declare global {
export function decodeUtf8(
input: Uint8Array,
fatal: boolean,
- ignoreBOM: boolean
+ ignoreBOM: boolean,
): string {
let outString = "";
@@ -61,10 +61,11 @@ export function decodeUtf8(
for (; i < input.length; ++i) {
// Encoding error handling
if (state === 12 || (state !== 0 && (input[i] & 0xc0) !== 0x80)) {
- if (fatal)
+ if (fatal) {
throw new TypeError(
- `Decoder error. Invalid byte in sequence at position ${i} in data.`
+ `Decoder error. Invalid byte in sequence at position ${i} in data.`,
);
+ }
outBuffer[outIndex++] = 0xfffd; // Replacement character
if (outIndex === outBufferLength) {
outString += String.fromCharCode.apply(null, outBuffer);
@@ -73,7 +74,7 @@ export function decodeUtf8(
state = 0;
}
- // prettier-ignore
+ // deno-fmt-ignore
type = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -84,11 +85,10 @@ export function decodeUtf8(
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8
][input[i]];
- codepoint =
- state !== 0
- ? (input[i] & 0x3f) | (codepoint << 6)
- : (0xff >> type) & input[i];
- // prettier-ignore
+ codepoint = state !== 0
+ ? (input[i] & 0x3f) | (codepoint << 6)
+ : (0xff >> type) & input[i];
+ // deno-fmt-ignore
state = [
0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12,
12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12,
diff --git a/cli/js/web/dom_file.ts b/cli/js/web/dom_file.ts
index 3d65e5768..907337e59 100644
--- a/cli/js/web/dom_file.ts
+++ b/cli/js/web/dom_file.ts
@@ -9,7 +9,7 @@ export class DomFileImpl extends blob.DenoBlob implements File {
constructor(
fileBits: BlobPart[],
fileName: string,
- options?: FilePropertyBag
+ options?: FilePropertyBag,
) {
const { lastModified = Date.now(), ...blobPropertyBag } = options ?? {};
super(fileBits, blobPropertyBag);
diff --git a/cli/js/web/dom_iterable.ts b/cli/js/web/dom_iterable.ts
index 271b2f655..7e26a12a4 100644
--- a/cli/js/web/dom_iterable.ts
+++ b/cli/js/web/dom_iterable.ts
@@ -14,13 +14,13 @@ export interface DomIterable<K, V> {
forEach(
callback: (value: V, key: K, parent: this) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- thisArg?: any
+ thisArg?: any,
): void;
}
export function DomIterableMixin<K, V, TBase extends Constructor>(
Base: TBase,
- dataSymbol: symbol
+ dataSymbol: symbol,
): TBase & Constructor<DomIterable<K, V>> {
// we have to cast `this` as `any` because there is no way to describe the
// Base class in a way where the Symbol `dataSymbol` is defined. So the
@@ -56,15 +56,15 @@ export function DomIterableMixin<K, V, TBase extends Constructor>(
forEach(
callbackfn: (value: V, key: K, parent: this) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- thisArg?: any
+ thisArg?: any,
): void {
requiredArguments(
`${this.constructor.name}.forEach`,
arguments.length,
- 1
+ 1,
);
callbackfn = callbackfn.bind(
- thisArg == null ? globalThis : Object(thisArg)
+ thisArg == null ? globalThis : Object(thisArg),
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
for (const [key, value] of (this as any)[dataSymbol]) {
diff --git a/cli/js/web/dom_types.d.ts b/cli/js/web/dom_types.d.ts
index 5d35c9187..b8636b7d1 100644
--- a/cli/js/web/dom_types.d.ts
+++ b/cli/js/web/dom_types.d.ts
@@ -220,7 +220,7 @@ interface NodeList {
item(index: number): Node | null;
forEach(
callbackfn: (value: Node, key: number, parent: NodeList) => void,
- thisArg?: any
+ thisArg?: any,
): void;
[index: number]: Node;
[Symbol.iterator](): IterableIterator<Node>;
@@ -234,7 +234,7 @@ interface NodeListOf<TNode extends Node> extends NodeList {
item(index: number): TNode;
forEach(
callbackfn: (value: TNode, key: number, parent: NodeListOf<TNode>) => void,
- thisArg?: any
+ thisArg?: any,
): void;
[index: number]: TNode;
[Symbol.iterator](): IterableIterator<TNode>;
diff --git a/cli/js/web/error_event.ts b/cli/js/web/error_event.ts
index 8e7853875..c04a49545 100644
--- a/cli/js/web/error_event.ts
+++ b/cli/js/web/error_event.ts
@@ -39,7 +39,7 @@ export class ErrorEventImpl extends Event implements ErrorEvent {
lineno = 0,
colno = 0,
error = null,
- }: ErrorEventInit = {}
+ }: ErrorEventInit = {},
) {
super(type, {
bubbles: bubbles,
diff --git a/cli/js/web/event.ts b/cli/js/web/event.ts
index 556d403a6..d22d41c29 100644
--- a/cli/js/web/event.ts
+++ b/cli/js/web/event.ts
@@ -53,7 +53,7 @@ export function getStopImmediatePropagation(event: Event): boolean {
export function setCurrentTarget(
event: Event,
- value: EventTarget | null
+ value: EventTarget | null,
): void {
(event as EventImpl).currentTarget = value;
}
@@ -85,7 +85,7 @@ export function setPath(event: Event, value: EventPath[]): void {
export function setRelatedTarget<T extends Event>(
event: T,
- value: EventTarget | null
+ value: EventTarget | null,
): void {
if ("relatedTarget" in event) {
(event as T & {
@@ -100,7 +100,7 @@ export function setTarget(event: Event, value: EventTarget | null): void {
export function setStopImmediatePropagation(
event: Event,
- value: boolean
+ value: boolean,
): void {
const data = eventData.get(event as Event);
if (data) {
@@ -111,7 +111,7 @@ export function setStopImmediatePropagation(
// Type guards that widen the event type
export function hasRelatedTarget(
- event: Event
+ event: Event,
): event is domTypes.FocusEvent | domTypes.MouseEvent {
return "relatedTarget" in event;
}
diff --git a/cli/js/web/event_target.ts b/cli/js/web/event_target.ts
index 6f6897425..82935dd9c 100644
--- a/cli/js/web/event_target.ts
+++ b/cli/js/web/event_target.ts
@@ -46,7 +46,7 @@ function getRoot(eventTarget: EventTarget): EventTarget | null {
}
function isNode<T extends EventTarget>(
- eventTarget: T | null
+ eventTarget: T | null,
): eventTarget is T & domTypes.Node {
return Boolean(eventTarget && "nodeType" in eventTarget);
}
@@ -54,7 +54,7 @@ function isNode<T extends EventTarget>(
// https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor
function isShadowInclusiveAncestor(
ancestor: EventTarget | null,
- node: EventTarget | null
+ node: EventTarget | null,
): boolean {
while (isNode(node)) {
if (node === ancestor) {
@@ -76,12 +76,12 @@ function isShadowRoot(nodeImpl: EventTarget | null): boolean {
nodeImpl &&
isNode(nodeImpl) &&
nodeImpl.nodeType === DOCUMENT_FRAGMENT_NODE &&
- getHost(nodeImpl) != null
+ getHost(nodeImpl) != null,
);
}
function isSlotable<T extends EventTarget>(
- nodeImpl: T | null
+ nodeImpl: T | null,
): nodeImpl is T & domTypes.Node & domTypes.Slotable {
return Boolean(isNode(nodeImpl) && "assignedSlot" in nodeImpl);
}
@@ -98,7 +98,7 @@ function appendToEventPath(
targetOverride: EventTarget | null,
relatedTarget: EventTarget | null,
touchTargets: EventTarget[],
- slotInClosedTree: boolean
+ slotInClosedTree: boolean,
): void {
const itemInShadowTree = isNode(target) && isShadowRoot(getRoot(target));
const rootOfClosedTree = isShadowRoot(target) && getMode(target) === "closed";
@@ -117,7 +117,7 @@ function appendToEventPath(
function dispatch(
targetImpl: EventTarget,
eventImpl: Event,
- targetOverride?: EventTarget
+ targetOverride?: EventTarget,
): boolean {
let clearTargets = false;
let activationTarget: EventTarget | null = null;
@@ -139,7 +139,7 @@ function dispatch(
targetOverride,
relatedTarget,
touchTargets,
- false
+ false,
);
const isActivationEvent = eventImpl.type === "click";
@@ -149,8 +149,9 @@ function dispatch(
}
let slotInClosedTree = false;
- let slotable =
- isSlotable(targetImpl) && getAssignedSlot(targetImpl) ? targetImpl : null;
+ let slotable = isSlotable(targetImpl) && getAssignedSlot(targetImpl)
+ ? targetImpl
+ : null;
let parent = getParent(targetImpl);
// Populate event path
@@ -181,7 +182,7 @@ function dispatch(
null,
relatedTarget,
touchTargets,
- slotInClosedTree
+ slotInClosedTree,
);
} else if (parent === relatedTarget) {
parent = null;
@@ -202,7 +203,7 @@ function dispatch(
targetImpl,
relatedTarget,
touchTargets,
- slotInClosedTree
+ slotInClosedTree,
);
}
@@ -226,9 +227,8 @@ function dispatch(
}
const clearTargetsTuple = path[clearTargetsTupleIndex];
- clearTargets =
- (isNode(clearTargetsTuple.target) &&
- isShadowRoot(getRoot(clearTargetsTuple.target))) ||
+ clearTargets = (isNode(clearTargetsTuple.target) &&
+ isShadowRoot(getRoot(clearTargetsTuple.target))) ||
(isNode(clearTargetsTuple.relatedTarget) &&
isShadowRoot(getRoot(clearTargetsTuple.relatedTarget)));
@@ -288,7 +288,7 @@ function dispatch(
* Ref: https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke */
function innerInvokeEventListeners(
eventImpl: Event,
- targetListeners: Record<string, Listener[]>
+ targetListeners: Record<string, Listener[]>,
): boolean {
let found = false;
@@ -381,7 +381,7 @@ function invokeEventListeners(tuple: EventPath, eventImpl: Event): void {
}
function normalizeAddEventHandlerOptions(
- options: boolean | AddEventListenerOptions | undefined
+ options: boolean | AddEventListenerOptions | undefined,
): AddEventListenerOptions {
if (typeof options === "boolean" || typeof options === "undefined") {
return {
@@ -395,7 +395,7 @@ function normalizeAddEventHandlerOptions(
}
function normalizeEventHandlerOptions(
- options: boolean | EventListenerOptions | undefined
+ options: boolean | EventListenerOptions | undefined,
): EventListenerOptions {
if (typeof options === "boolean" || typeof options === "undefined") {
return {
@@ -456,7 +456,7 @@ function getAssignedSlot(target: EventTarget): boolean {
function getHasActivationBehavior(target: EventTarget): boolean {
return Boolean(
- eventTargetData.get(target as EventTarget)?.hasActivationBehavior
+ eventTargetData.get(target as EventTarget)?.hasActivationBehavior,
);
}
@@ -490,7 +490,7 @@ export class EventTargetImpl implements EventTarget {
public addEventListener(
type: string,
callback: EventListenerOrEventListenerObject | null,
- options?: AddEventListenerOptions | boolean
+ options?: AddEventListenerOptions | boolean,
): void {
requiredArguments("EventTarget.addEventListener", arguments.length, 2);
if (callback === null) {
@@ -522,14 +522,14 @@ export class EventTargetImpl implements EventTarget {
public removeEventListener(
type: string,
callback: EventListenerOrEventListenerObject | null,
- options?: EventListenerOptions | boolean
+ options?: EventListenerOptions | boolean,
): void {
requiredArguments("EventTarget.removeEventListener", arguments.length, 2);
const listeners = eventTargetData.get(this ?? globalThis)!.listeners;
if (callback !== null && type in listeners) {
listeners[type] = listeners[type].filter(
- (listener) => listener.callback !== callback
+ (listener) => listener.callback !== callback,
);
} else if (callback === null || !listeners[type]) {
return;
diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts
index d692b83e1..4fe525cde 100644
--- a/cli/js/web/fetch.ts
+++ b/cli/js/web/fetch.ts
@@ -38,14 +38,13 @@ export class Response extends Body.Body implements domTypes.Response {
let status = init.status === undefined ? 200 : Number(init.status || 0);
let statusText = init.statusText ?? "";
- let headers =
- init.headers instanceof Headers
- ? init.headers
- : new Headers(init.headers);
+ let headers = init.headers instanceof Headers
+ ? init.headers
+ : new Headers(init.headers);
if (init.status !== undefined && (status < 200 || status > 599)) {
throw new RangeError(
- `The status provided (${init.status}) is outside the range [200, 599]`
+ `The status provided (${init.status}) is outside the range [200, 599]`,
);
}
@@ -156,7 +155,7 @@ export class Response extends Body.Body implements domTypes.Response {
static redirect(url: URL | string, status: number): domTypes.Response {
if (![301, 302, 303, 307, 308].includes(status)) {
throw new RangeError(
- "The redirection status must be one of 301, 302, 303, 307 and 308."
+ "The redirection status must be one of 301, 302, 303, 307 and 308.",
);
}
return new Response(null, {
@@ -171,7 +170,7 @@ function sendFetchReq(
url: string,
method: string | null,
headers: Headers | null,
- body: ArrayBufferView | undefined
+ body: ArrayBufferView | undefined,
): Promise<FetchResponse> {
let headerArray: Array<[string, string]> = [];
if (headers) {
@@ -189,7 +188,7 @@ function sendFetchReq(
export async function fetch(
input: (domTypes.Request & { _bodySource?: unknown }) | URL | string,
- init?: domTypes.RequestInit
+ init?: domTypes.RequestInit,
): Promise<Response> {
let url: string;
let method: string | null = null;
@@ -203,10 +202,9 @@ export async function fetch(
if (init != null) {
method = init.method || null;
if (init.headers) {
- headers =
- init.headers instanceof Headers
- ? init.headers
- : new Headers(init.headers);
+ headers = init.headers instanceof Headers
+ ? init.headers
+ : new Headers(init.headers);
} else {
headers = null;
}
diff --git a/cli/js/web/fetch/multipart.ts b/cli/js/web/fetch/multipart.ts
index a632d8600..f30975e5e 100644
--- a/cli/js/web/fetch/multipart.ts
+++ b/cli/js/web/fetch/multipart.ts
@@ -64,7 +64,7 @@ export class MultipartBuilder {
#writeFileHeaders = (
field: string,
filename: string,
- type?: string
+ type?: string,
): void => {
const headers = [
[
@@ -122,7 +122,7 @@ export class MultipartParser {
return {
headers,
disposition: getHeaderValueParams(
- headers.get("Content-Disposition") ?? ""
+ headers.get("Content-Disposition") ?? "",
),
};
};
diff --git a/cli/js/web/form_data.ts b/cli/js/web/form_data.ts
index 2566943f0..1a0622638 100644
--- a/cli/js/web/form_data.ts
+++ b/cli/js/web/form_data.ts
@@ -16,7 +16,7 @@ class FormDataBase {
append(
name: string,
value: string | blob.DenoBlob | domFile.DomFileImpl,
- filename?: string
+ filename?: string,
): void {
requiredArguments("FormData.append", arguments.length, 2);
name = String(name);
@@ -82,7 +82,7 @@ class FormDataBase {
set(
name: string,
value: string | blob.DenoBlob | domFile.DomFileImpl,
- filename?: string
+ filename?: string,
): void {
requiredArguments("FormData.set", arguments.length, 2);
name = String(name);
@@ -102,7 +102,7 @@ class FormDataBase {
filename || "blob",
{
type: value.type,
- }
+ },
);
} else {
this[dataSymbol][i][1] = String(value);
diff --git a/cli/js/web/headers.ts b/cli/js/web/headers.ts
index 5fd6abc44..d75f87adc 100644
--- a/cli/js/web/headers.ts
+++ b/cli/js/web/headers.ts
@@ -55,7 +55,7 @@ function validateValue(value: string): void {
function dataAppend(
data: Array<[string, string]>,
key: string,
- value: string
+ value: string,
): void {
for (let i = 0; i < data.length; i++) {
const [dataKey] = data[i];
@@ -85,7 +85,7 @@ function dataAppend(
* entry in the headers list. */
function dataGet(
data: Array<[string, string]>,
- key: string
+ key: string,
): string | undefined {
const setCookieValues = [];
for (const [dataKey, value] of data) {
@@ -118,7 +118,7 @@ function dataGet(
function dataSet(
data: Array<[string, string]>,
key: string,
- value: string
+ value: string,
): void {
for (let i = 0; i < data.length; i++) {
const [dataKey] = data[i];
@@ -169,7 +169,7 @@ class HeadersBase {
constructor(init?: HeadersInit) {
if (init === null) {
throw new TypeError(
- "Failed to construct 'Headers'; The provided value was not valid"
+ "Failed to construct 'Headers'; The provided value was not valid",
);
} else if (isHeaders(init)) {
this[headersData] = [...init];
@@ -183,7 +183,7 @@ class HeadersBase {
requiredArguments(
"Headers.constructor tuple array argument",
tuple.length,
- 2
+ 2,
);
this.append(tuple[0], tuple[1]);
diff --git a/cli/js/web/performance.ts b/cli/js/web/performance.ts
index eb0479b37..1acff9f75 100644
--- a/cli/js/web/performance.ts
+++ b/cli/js/web/performance.ts
@@ -8,7 +8,7 @@ let performanceEntries: PerformanceEntryList = [];
function findMostRecent(
name: string,
- type: "mark" | "measure"
+ type: "mark" | "measure",
): PerformanceEntry | undefined {
return performanceEntries
.slice()
@@ -32,12 +32,12 @@ function convertMarkToTimestamp(mark: string | number): number {
function filterByNameType(
name?: string,
- type?: "mark" | "measure"
+ type?: "mark" | "measure",
): PerformanceEntryList {
return performanceEntries.filter(
(entry) =>
(name ? entry.name === name : true) &&
- (type ? entry.entryType === type : true)
+ (type ? entry.entryType === type : true),
);
}
@@ -72,7 +72,7 @@ export class PerformanceEntryImpl implements PerformanceEntry {
name: string,
entryType: string,
startTime: number,
- duration: number
+ duration: number,
) {
this.#name = name;
this.#entryType = entryType;
@@ -111,7 +111,7 @@ export class PerformanceMarkImpl extends PerformanceEntryImpl
constructor(
name: string,
- { detail = null, startTime = now() }: PerformanceMarkOptions = {}
+ { detail = null, startTime = now() }: PerformanceMarkOptions = {},
) {
super(name, "mark", startTime, 0);
if (startTime < 0) {
@@ -133,11 +133,9 @@ export class PerformanceMarkImpl extends PerformanceEntryImpl
[customInspect](): string {
return this.detail
- ? `${this.constructor.name} {\n detail: ${inspect(this.detail, {
- depth: 3,
- })},\n name: "${this.name}",\n entryType: "${
- this.entryType
- }",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
+ ? `${this.constructor.name} {\n detail: ${
+ inspect(this.detail, { depth: 3 })
+ },\n name: "${this.name}",\n entryType: "${this.entryType}",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
: `${this.constructor.name} { detail: ${this.detail}, name: "${this.name}", entryType: "${this.entryType}", startTime: ${this.startTime}, duration: ${this.duration} }`;
}
}
@@ -161,7 +159,7 @@ export class PerformanceMeasureImpl extends PerformanceEntryImpl
startTime: number,
duration: number,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- detail: any = null
+ detail: any = null,
) {
super(name, "measure", startTime, duration);
this.#detail = cloneValue(detail);
@@ -180,11 +178,9 @@ export class PerformanceMeasureImpl extends PerformanceEntryImpl
[customInspect](): string {
return this.detail
- ? `${this.constructor.name} {\n detail: ${inspect(this.detail, {
- depth: 3,
- })},\n name: "${this.name}",\n entryType: "${
- this.entryType
- }",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
+ ? `${this.constructor.name} {\n detail: ${
+ inspect(this.detail, { depth: 3 })
+ },\n name: "${this.name}",\n entryType: "${this.entryType}",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
: `${this.constructor.name} { detail: ${this.detail}, name: "${this.name}", entryType: "${this.entryType}", startTime: ${this.startTime}, duration: ${this.duration} }`;
}
}
@@ -193,11 +189,11 @@ export class PerformanceImpl implements Performance {
clearMarks(markName?: string): void {
if (markName == null) {
performanceEntries = performanceEntries.filter(
- (entry) => entry.entryType !== "mark"
+ (entry) => entry.entryType !== "mark",
);
} else {
performanceEntries = performanceEntries.filter(
- (entry) => !(entry.name === markName && entry.entryType === "mark")
+ (entry) => !(entry.name === markName && entry.entryType === "mark"),
);
}
}
@@ -205,12 +201,12 @@ export class PerformanceImpl implements Performance {
clearMeasures(measureName?: string): void {
if (measureName == null) {
performanceEntries = performanceEntries.filter(
- (entry) => entry.entryType !== "measure"
+ (entry) => entry.entryType !== "measure",
);
} else {
performanceEntries = performanceEntries.filter(
(entry) =>
- !(entry.name === measureName && entry.entryType === "measure")
+ !(entry.name === measureName && entry.entryType === "measure"),
);
}
}
@@ -220,7 +216,7 @@ export class PerformanceImpl implements Performance {
}
getEntriesByName(
name: string,
- type?: "mark" | "measure"
+ type?: "mark" | "measure",
): PerformanceEntryList {
return filterByNameType(name, type);
}
@@ -230,7 +226,7 @@ export class PerformanceImpl implements Performance {
mark(
markName: string,
- options: PerformanceMarkOptions = {}
+ options: PerformanceMarkOptions = {},
): PerformanceMark {
// 3.1.1.1 If the global object is a Window object and markName uses the
// same name as a read only attribute in the PerformanceTiming interface,
@@ -243,17 +239,17 @@ export class PerformanceImpl implements Performance {
measure(
measureName: string,
- options?: PerformanceMeasureOptions
+ options?: PerformanceMeasureOptions,
): PerformanceMeasure;
measure(
measureName: string,
startMark?: string,
- endMark?: string
+ endMark?: string,
): PerformanceMeasure;
measure(
measureName: string,
startOrMeasureOptions: string | PerformanceMeasureOptions = {},
- endMark?: string
+ endMark?: string,
): PerformanceMeasure {
if (startOrMeasureOptions && typeof startOrMeasureOptions === "object") {
if (endMark) {
@@ -271,7 +267,7 @@ export class PerformanceImpl implements Performance {
"end" in startOrMeasureOptions
) {
throw new TypeError(
- "Cannot specify start, end, and duration together in options."
+ "Cannot specify start, end, and duration together in options.",
);
}
}
@@ -319,7 +315,7 @@ export class PerformanceImpl implements Performance {
endTime - startTime,
typeof startOrMeasureOptions === "object"
? startOrMeasureOptions.detail ?? null
- : null
+ : null,
);
performanceEntries.push(entry);
return entry;
diff --git a/cli/js/web/streams/internals.ts b/cli/js/web/streams/internals.ts
index 58a62e3cb..06c5e304d 100644
--- a/cli/js/web/streams/internals.ts
+++ b/cli/js/web/streams/internals.ts
@@ -66,7 +66,7 @@ export interface ReadableStreamAsyncIterator<T = any> extends AsyncIterator<T> {
export function acquireReadableStreamDefaultReader<T>(
stream: ReadableStreamImpl<T>,
- forAuthorCode = false
+ forAuthorCode = false,
): ReadableStreamDefaultReaderImpl<T> {
const reader = new ReadableStreamDefaultReaderImpl(stream);
reader[sym.forAuthorCode] = forAuthorCode;
@@ -74,7 +74,7 @@ export function acquireReadableStreamDefaultReader<T>(
}
export function acquireWritableStreamDefaultWriter<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): WritableStreamDefaultWriterImpl<W> {
return new WritableStreamDefaultWriterImpl(stream);
}
@@ -82,14 +82,14 @@ export function acquireWritableStreamDefaultWriter<W>(
export function call<F extends (...args: any[]) => any>(
fn: F,
v: ThisType<F>,
- args: Parameters<F>
+ args: Parameters<F>,
): ReturnType<F> {
return Function.prototype.apply.call(fn, v, args);
}
function createAlgorithmFromUnderlyingMethod<
O extends UnderlyingByteSource | UnderlyingSource | Transformer,
- P extends keyof O
+ P extends keyof O,
>(
underlyingObject: O,
methodName: P,
@@ -99,7 +99,7 @@ function createAlgorithmFromUnderlyingMethod<
function createAlgorithmFromUnderlyingMethod<
O extends UnderlyingByteSource | UnderlyingSource | Transformer,
- P extends keyof O
+ P extends keyof O,
>(
underlyingObject: O,
methodName: P,
@@ -108,7 +108,7 @@ function createAlgorithmFromUnderlyingMethod<
): (arg: any) => Promise<void>;
function createAlgorithmFromUnderlyingMethod<
O extends UnderlyingByteSource | UnderlyingSource | Transformer,
- P extends keyof O
+ P extends keyof O,
>(
underlyingObject: O,
methodName: P,
@@ -138,15 +138,15 @@ function createReadableStream<T>(
pullAlgorithm: PullAlgorithm,
cancelAlgorithm: CancelAlgorithm,
highWaterMark = 1,
- sizeAlgorithm: SizeAlgorithm<T> = (): number => 1
+ sizeAlgorithm: SizeAlgorithm<T> = (): number => 1,
): ReadableStreamImpl<T> {
highWaterMark = validateAndNormalizeHighWaterMark(highWaterMark);
const stream: ReadableStreamImpl<T> = Object.create(
- ReadableStreamImpl.prototype
+ ReadableStreamImpl.prototype,
);
initializeReadableStream(stream);
const controller: ReadableStreamDefaultControllerImpl<T> = Object.create(
- ReadableStreamDefaultControllerImpl.prototype
+ ReadableStreamDefaultControllerImpl.prototype,
);
setUpReadableStreamDefaultController(
stream,
@@ -155,7 +155,7 @@ function createReadableStream<T>(
pullAlgorithm,
cancelAlgorithm,
highWaterMark,
- sizeAlgorithm
+ sizeAlgorithm,
);
return stream;
}
@@ -166,13 +166,13 @@ function createWritableStream<W>(
closeAlgorithm: CloseAlgorithm,
abortAlgorithm: AbortAlgorithm,
highWaterMark = 1,
- sizeAlgorithm: SizeAlgorithm<W> = (): number => 1
+ sizeAlgorithm: SizeAlgorithm<W> = (): number => 1,
): WritableStreamImpl<W> {
highWaterMark = validateAndNormalizeHighWaterMark(highWaterMark);
const stream = Object.create(WritableStreamImpl.prototype);
initializeWritableStream(stream);
const controller = Object.create(
- WritableStreamDefaultControllerImpl.prototype
+ WritableStreamDefaultControllerImpl.prototype,
);
setUpWritableStreamDefaultController(
stream,
@@ -182,7 +182,7 @@ function createWritableStream<W>(
closeAlgorithm,
abortAlgorithm,
highWaterMark,
- sizeAlgorithm
+ sizeAlgorithm,
);
return stream;
}
@@ -201,7 +201,7 @@ export function dequeueValue<R>(container: Container<R>): R {
function enqueueValueWithSize<R>(
container: Container<R>,
value: R,
- size: number
+ size: number,
): void {
assert(sym.queue in container && sym.queueTotalSize in container);
size = Number(size);
@@ -225,7 +225,7 @@ export function getDeferred<T>(): Required<Deferred<T>> {
}
export function initializeReadableStream<R>(
- stream: ReadableStreamImpl<R>
+ stream: ReadableStreamImpl<R>,
): void {
stream[sym.state] = "readable";
stream[sym.reader] = stream[sym.storedError] = undefined;
@@ -238,7 +238,7 @@ export function initializeTransformStream<I, O>(
writableHighWaterMark: number,
writableSizeAlgorithm: SizeAlgorithm<I>,
readableHighWaterMark: number,
- readableSizeAlgorithm: SizeAlgorithm<O>
+ readableSizeAlgorithm: SizeAlgorithm<O>,
): void {
const startAlgorithm = (): Promise<void> => startPromise;
const writeAlgorithm = (chunk: any): Promise<void> =>
@@ -253,7 +253,7 @@ export function initializeTransformStream<I, O>(
closeAlgorithm,
abortAlgorithm,
writableHighWaterMark,
- writableSizeAlgorithm
+ writableSizeAlgorithm,
);
const pullAlgorithm = (): PromiseLike<void> =>
transformStreamDefaultSourcePullAlgorithm(stream);
@@ -266,7 +266,7 @@ export function initializeTransformStream<I, O>(
pullAlgorithm,
cancelAlgorithm,
readableHighWaterMark,
- readableSizeAlgorithm
+ readableSizeAlgorithm,
);
stream[sym.backpressure] = stream[sym.backpressureChangePromise] = undefined;
transformStreamSetBackpressure(stream, true);
@@ -277,7 +277,7 @@ export function initializeTransformStream<I, O>(
}
export function initializeWritableStream<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): void {
stream[sym.state] = "writable";
stream[sym.storedError] = stream[sym.writer] = stream[
@@ -315,7 +315,7 @@ function isFiniteNonNegativeNumber(v: unknown): v is number {
}
export function isReadableByteStreamController(
- x: unknown
+ x: unknown,
): x is ReadableByteStreamControllerImpl {
return !(
typeof x !== "object" ||
@@ -333,7 +333,7 @@ export function isReadableStream(x: unknown): x is ReadableStreamImpl {
}
export function isReadableStreamAsyncIterator(
- x: unknown
+ x: unknown,
): x is ReadableStreamAsyncIterator {
if (typeof x !== "object" || x === null) {
return false;
@@ -342,7 +342,7 @@ export function isReadableStreamAsyncIterator(
}
export function isReadableStreamDefaultController(
- x: unknown
+ x: unknown,
): x is ReadableStreamDefaultControllerImpl {
return !(
typeof x !== "object" ||
@@ -352,7 +352,7 @@ export function isReadableStreamDefaultController(
}
export function isReadableStreamDefaultReader<T>(
- x: unknown
+ x: unknown,
): x is ReadableStreamDefaultReaderImpl<T> {
return !(typeof x !== "object" || x === null || !(sym.readRequests in x));
}
@@ -376,7 +376,7 @@ export function isTransformStream(x: unknown): x is TransformStreamImpl {
}
export function isTransformStreamDefaultController(
- x: unknown
+ x: unknown,
): x is TransformStreamDefaultControllerImpl {
return !(
typeof x !== "object" ||
@@ -386,7 +386,7 @@ export function isTransformStreamDefaultController(
}
export function isUnderlyingByteSource(
- underlyingSource: UnderlyingByteSource | UnderlyingSource
+ underlyingSource: UnderlyingByteSource | UnderlyingSource,
): underlyingSource is UnderlyingByteSource {
const { type } = underlyingSource;
const typeString = String(type);
@@ -402,7 +402,7 @@ export function isWritableStream(x: unknown): x is WritableStreamImpl {
}
export function isWritableStreamDefaultController(
- x: unknown
+ x: unknown,
): x is WritableStreamDefaultControllerImpl<any> {
return !(
typeof x !== "object" ||
@@ -412,7 +412,7 @@ export function isWritableStreamDefaultController(
}
export function isWritableStreamDefaultWriter(
- x: unknown
+ x: unknown,
): x is WritableStreamDefaultWriterImpl<any> {
return !(
typeof x !== "object" ||
@@ -427,7 +427,7 @@ export function isWritableStreamLocked(stream: WritableStreamImpl): boolean {
}
export function makeSizeAlgorithmFromSizeFunction<T>(
- size: QueuingStrategySizeCallback<T> | undefined
+ size: QueuingStrategySizeCallback<T> | undefined,
): SizeAlgorithm<T> {
if (size === undefined) {
return (): number => 1;
@@ -448,7 +448,7 @@ function peekQueueValue<T>(container: Container<T>): T | "close" {
}
function readableByteStreamControllerShouldCallPull(
- controller: ReadableByteStreamControllerImpl
+ controller: ReadableByteStreamControllerImpl,
): boolean {
const stream = controller[sym.controlledReadableByteStream];
if (
@@ -472,7 +472,7 @@ function readableByteStreamControllerShouldCallPull(
}
export function readableByteStreamControllerCallPullIfNeeded(
- controller: ReadableByteStreamControllerImpl
+ controller: ReadableByteStreamControllerImpl,
): void {
const shouldPull = readableByteStreamControllerShouldCallPull(controller);
if (!shouldPull) {
@@ -496,20 +496,20 @@ export function readableByteStreamControllerCallPullIfNeeded(
},
(e) => {
readableByteStreamControllerError(controller, e);
- }
- )
+ },
+ ),
);
}
export function readableByteStreamControllerClearAlgorithms(
- controller: ReadableByteStreamControllerImpl
+ controller: ReadableByteStreamControllerImpl,
): void {
(controller as any)[sym.pullAlgorithm] = undefined;
(controller as any)[sym.cancelAlgorithm] = undefined;
}
export function readableByteStreamControllerClose(
- controller: ReadableByteStreamControllerImpl
+ controller: ReadableByteStreamControllerImpl,
): void {
const stream = controller[sym.controlledReadableByteStream];
if (controller[sym.closeRequested] || stream[sym.state] !== "readable") {
@@ -526,7 +526,7 @@ export function readableByteStreamControllerClose(
export function readableByteStreamControllerEnqueue(
controller: ReadableByteStreamControllerImpl,
- chunk: ArrayBufferView
+ chunk: ArrayBufferView,
): void {
const stream = controller[sym.controlledReadableByteStream];
if (controller[sym.closeRequested] || stream[sym.state] !== "readable") {
@@ -540,14 +540,14 @@ export function readableByteStreamControllerEnqueue(
controller,
transferredBuffer,
byteOffset,
- byteLength
+ byteLength,
);
} else {
assert(controller[sym.queue].length === 0);
const transferredView = new Uint8Array(
transferredBuffer,
byteOffset,
- byteLength
+ byteLength,
);
readableStreamFulfillReadRequest(stream, transferredView, false);
}
@@ -558,7 +558,7 @@ export function readableByteStreamControllerEnqueue(
controller,
transferredBuffer,
byteOffset,
- byteLength
+ byteLength,
);
}
readableByteStreamControllerCallPullIfNeeded(controller);
@@ -568,7 +568,7 @@ function readableByteStreamControllerEnqueueChunkToQueue(
controller: ReadableByteStreamControllerImpl,
buffer: ArrayBuffer | SharedArrayBuffer,
byteOffset: number,
- byteLength: number
+ byteLength: number,
): void {
controller[sym.queue].push({
value: buffer,
@@ -580,7 +580,7 @@ function readableByteStreamControllerEnqueueChunkToQueue(
export function readableByteStreamControllerError(
controller: ReadableByteStreamControllerImpl,
- e: any
+ e: any,
): void {
const stream = controller[sym.controlledReadableByteStream];
if (stream[sym.state] !== "readable") {
@@ -593,7 +593,7 @@ export function readableByteStreamControllerError(
}
export function readableByteStreamControllerGetDesiredSize(
- controller: ReadableByteStreamControllerImpl
+ controller: ReadableByteStreamControllerImpl,
): number | null {
const stream = controller[sym.controlledReadableByteStream];
const state = stream[sym.state];
@@ -607,10 +607,10 @@ export function readableByteStreamControllerGetDesiredSize(
}
export function readableByteStreamControllerHandleQueueDrain(
- controller: ReadableByteStreamControllerImpl
+ controller: ReadableByteStreamControllerImpl,
): void {
assert(
- controller[sym.controlledReadableByteStream][sym.state] === "readable"
+ controller[sym.controlledReadableByteStream][sym.state] === "readable",
);
if (controller[sym.queueTotalSize] === 0 && controller[sym.closeRequested]) {
readableByteStreamControllerClearAlgorithms(controller);
@@ -621,7 +621,7 @@ export function readableByteStreamControllerHandleQueueDrain(
}
export function readableStreamAddReadRequest<R>(
- stream: ReadableStreamImpl<R>
+ stream: ReadableStreamImpl<R>,
): Promise<ReadableStreamReadResult<R>> {
assert(isReadableStreamDefaultReader(stream[sym.reader]));
assert(stream[sym.state] === "readable");
@@ -632,7 +632,7 @@ export function readableStreamAddReadRequest<R>(
export function readableStreamCancel<T>(
stream: ReadableStreamImpl<T>,
- reason: any
+ reason: any,
): Promise<void> {
stream[sym.disturbed] = true;
if (stream[sym.state] === "closed") {
@@ -643,7 +643,7 @@ export function readableStreamCancel<T>(
}
readableStreamClose(stream);
return stream[sym.readableStreamController]![sym.cancelSteps](reason).then(
- () => undefined
+ () => undefined,
) as Promise<void>;
}
@@ -661,8 +661,8 @@ export function readableStreamClose<T>(stream: ReadableStreamImpl<T>): void {
readableStreamCreateReadResult<T>(
undefined,
true,
- reader[sym.forAuthorCode]
- )
+ reader[sym.forAuthorCode],
+ ),
);
}
reader[sym.readRequests] = [];
@@ -675,7 +675,7 @@ export function readableStreamClose<T>(stream: ReadableStreamImpl<T>): void {
export function readableStreamCreateReadResult<T>(
value: T | undefined,
done: boolean,
- forAuthorCode: boolean
+ forAuthorCode: boolean,
): ReadableStreamReadResult<T> {
const prototype = forAuthorCode ? Object.prototype : null;
assert(typeof done === "boolean");
@@ -688,7 +688,7 @@ export function readableStreamCreateReadResult<T>(
}
export function readableStreamDefaultControllerCallPullIfNeeded<T>(
- controller: ReadableStreamDefaultControllerImpl<T>
+ controller: ReadableStreamDefaultControllerImpl<T>,
): void {
const shouldPull = readableStreamDefaultControllerShouldCallPull(controller);
if (!shouldPull) {
@@ -711,19 +711,19 @@ export function readableStreamDefaultControllerCallPullIfNeeded<T>(
},
(e) => {
readableStreamDefaultControllerError(controller, e);
- }
+ },
);
}
export function readableStreamDefaultControllerCanCloseOrEnqueue<T>(
- controller: ReadableStreamDefaultControllerImpl<T>
+ controller: ReadableStreamDefaultControllerImpl<T>,
): boolean {
const state = controller[sym.controlledReadableStream][sym.state];
return !controller[sym.closeRequested] && state === "readable";
}
export function readableStreamDefaultControllerClearAlgorithms<T>(
- controller: ReadableStreamDefaultControllerImpl<T>
+ controller: ReadableStreamDefaultControllerImpl<T>,
): void {
(controller as any)[sym.pullAlgorithm] = undefined;
(controller as any)[sym.cancelAlgorithm] = undefined;
@@ -731,7 +731,7 @@ export function readableStreamDefaultControllerClearAlgorithms<T>(
}
export function readableStreamDefaultControllerClose<T>(
- controller: ReadableStreamDefaultControllerImpl<T>
+ controller: ReadableStreamDefaultControllerImpl<T>,
): void {
if (!readableStreamDefaultControllerCanCloseOrEnqueue(controller)) {
return;
@@ -746,7 +746,7 @@ export function readableStreamDefaultControllerClose<T>(
export function readableStreamDefaultControllerEnqueue<T>(
controller: ReadableStreamDefaultControllerImpl<T>,
- chunk: T
+ chunk: T,
): void {
if (!readableStreamDefaultControllerCanCloseOrEnqueue(controller)) {
return;
@@ -770,7 +770,7 @@ export function readableStreamDefaultControllerEnqueue<T>(
}
export function readableStreamDefaultControllerGetDesiredSize<T>(
- controller: ReadableStreamDefaultControllerImpl<T>
+ controller: ReadableStreamDefaultControllerImpl<T>,
): number | null {
const stream = controller[sym.controlledReadableStream];
const state = stream[sym.state];
@@ -785,7 +785,7 @@ export function readableStreamDefaultControllerGetDesiredSize<T>(
export function readableStreamDefaultControllerError<T>(
controller: ReadableStreamDefaultControllerImpl<T>,
- e: any
+ e: any,
): void {
const stream = controller[sym.controlledReadableStream];
if (stream[sym.state] !== "readable") {
@@ -797,13 +797,13 @@ export function readableStreamDefaultControllerError<T>(
}
function readableStreamDefaultControllerHasBackpressure<T>(
- controller: ReadableStreamDefaultControllerImpl<T>
+ controller: ReadableStreamDefaultControllerImpl<T>,
): boolean {
return readableStreamDefaultControllerShouldCallPull(controller);
}
function readableStreamDefaultControllerShouldCallPull<T>(
- controller: ReadableStreamDefaultControllerImpl<T>
+ controller: ReadableStreamDefaultControllerImpl<T>,
): boolean {
const stream = controller[sym.controlledReadableStream];
if (
@@ -824,7 +824,7 @@ function readableStreamDefaultControllerShouldCallPull<T>(
}
export function readableStreamDefaultReaderRead<R>(
- reader: ReadableStreamDefaultReaderImpl<R>
+ reader: ReadableStreamDefaultReaderImpl<R>,
): Promise<ReadableStreamReadResult<R>> {
const stream = reader[sym.ownerReadableStream];
assert(stream);
@@ -834,8 +834,8 @@ export function readableStreamDefaultReaderRead<R>(
readableStreamCreateReadResult<R>(
undefined,
true,
- reader[sym.forAuthorCode]
- )
+ reader[sym.forAuthorCode],
+ ),
);
}
if (stream[sym.state] === "errored") {
@@ -875,24 +875,24 @@ export function readableStreamError(stream: ReadableStreamImpl, e: any): void {
export function readableStreamFulfillReadRequest<R>(
stream: ReadableStreamImpl<R>,
chunk: R,
- done: boolean
+ done: boolean,
): void {
const reader = stream[sym.reader]!;
const readRequest = reader[sym.readRequests].shift()!;
assert(readRequest.resolve);
readRequest.resolve(
- readableStreamCreateReadResult(chunk, done, reader[sym.forAuthorCode])
+ readableStreamCreateReadResult(chunk, done, reader[sym.forAuthorCode]),
);
}
export function readableStreamGetNumReadRequests(
- stream: ReadableStreamImpl
+ stream: ReadableStreamImpl,
): number {
return stream[sym.reader]?.[sym.readRequests].length ?? 0;
}
export function readableStreamHasDefaultReader(
- stream: ReadableStreamImpl
+ stream: ReadableStreamImpl,
): boolean {
const reader = stream[sym.reader];
return !(reader === undefined || !isReadableStreamDefaultReader(reader));
@@ -904,14 +904,14 @@ export function readableStreamPipeTo<T>(
preventClose: boolean,
preventAbort: boolean,
preventCancel: boolean,
- signal: AbortSignalImpl | undefined
+ signal: AbortSignalImpl | undefined,
): Promise<void> {
assert(isReadableStream(source));
assert(isWritableStream(dest));
assert(
typeof preventClose === "boolean" &&
typeof preventAbort === "boolean" &&
- typeof preventCancel === "boolean"
+ typeof preventCancel === "boolean",
);
assert(signal === undefined || signal instanceof AbortSignalImpl);
assert(!isReadableStreamLocked(source));
@@ -947,7 +947,7 @@ export function readableStreamPipeTo<T>(
shutdownWithAction(
() => Promise.all(actions.map((action) => action())),
true,
- error
+ error,
);
};
if (signal.aborted) {
@@ -967,7 +967,7 @@ export function readableStreamPipeTo<T>(
function isOrBecomesClosed(
stream: ReadableStreamImpl | WritableStreamImpl,
promise: Promise<void>,
- action: () => void
+ action: () => void,
): void {
if (stream[sym.state] === "closed") {
action();
@@ -979,7 +979,7 @@ export function readableStreamPipeTo<T>(
function isOrBecomesErrored(
stream: ReadableStreamImpl | WritableStreamImpl,
promise: Promise<void>,
- action: (error: any) => void
+ action: (error: any) => void,
): void {
if (stream[sym.state] === "errored") {
action(stream[sym.storedError]);
@@ -1012,14 +1012,14 @@ export function readableStreamPipeTo<T>(
function shutdownWithAction(
action: () => Promise<any>,
originalIsError?: boolean,
- originalError?: any
+ originalError?: any,
): void {
function doTheRest(): void {
setPromiseIsHandledToTrue(
action().then(
() => finalize(originalIsError, originalError),
- (newError) => finalize(true, newError)
- )
+ (newError) => finalize(true, newError),
+ ),
);
}
@@ -1049,7 +1049,7 @@ export function readableStreamPipeTo<T>(
!writableStreamCloseQueuedOrInFlight(dest)
) {
setPromiseIsHandledToTrue(
- waitForWritesToFinish().then(() => finalize(isError, error))
+ waitForWritesToFinish().then(() => finalize(isError, error)),
);
}
finalize(isError, error);
@@ -1066,7 +1066,7 @@ export function readableStreamPipeTo<T>(
}
currentWrite = writableStreamDefaultWriterWrite(
writer,
- value!
+ value!,
).then(undefined, () => {});
return false;
});
@@ -1094,12 +1094,12 @@ export function readableStreamPipeTo<T>(
shutdownWithAction(
() => writableStreamAbort(dest, storedError),
true,
- storedError
+ storedError,
);
} else {
shutdown(true, storedError);
}
- }
+ },
);
isOrBecomesErrored(dest, writer[sym.closedPromise].promise, (storedError) => {
@@ -1107,7 +1107,7 @@ export function readableStreamPipeTo<T>(
shutdownWithAction(
() => readableStreamCancel(source, storedError),
true,
- storedError
+ storedError,
);
} else {
shutdown(true, storedError);
@@ -1127,13 +1127,13 @@ export function readableStreamPipeTo<T>(
dest[sym.state] === "closed"
) {
const destClosed = new TypeError(
- "The destination writable stream closed before all data could be piped to it."
+ "The destination writable stream closed before all data could be piped to it.",
);
if (!preventCancel) {
shutdownWithAction(
() => readableStreamCancel(source, destClosed),
true,
- destClosed
+ destClosed,
);
} else {
shutdown(true, destClosed);
@@ -1146,7 +1146,7 @@ export function readableStreamPipeTo<T>(
export function readableStreamReaderGenericCancel<R = any>(
reader: ReadableStreamGenericReader<R>,
- reason: any
+ reason: any,
): Promise<void> {
const stream = reader[sym.ownerReadableStream];
assert(stream);
@@ -1155,7 +1155,7 @@ export function readableStreamReaderGenericCancel<R = any>(
export function readableStreamReaderGenericInitialize<R = any>(
reader: ReadableStreamGenericReader<R>,
- stream: ReadableStreamImpl<R>
+ stream: ReadableStreamImpl<R>,
): void {
reader[sym.forAuthorCode] = true;
reader[sym.ownerReadableStream] = stream;
@@ -1174,7 +1174,7 @@ export function readableStreamReaderGenericInitialize<R = any>(
}
export function readableStreamReaderGenericRelease<R = any>(
- reader: ReadableStreamGenericReader<R>
+ reader: ReadableStreamGenericReader<R>,
): void {
assert(reader[sym.ownerReadableStream]);
assert(reader[sym.ownerReadableStream][sym.reader] === reader);
@@ -1194,7 +1194,7 @@ export function readableStreamReaderGenericRelease<R = any>(
export function readableStreamTee<T>(
stream: ReadableStreamImpl<T>,
- cloneForBranch2: boolean
+ cloneForBranch2: boolean,
): [ReadableStreamImpl<T>, ReadableStreamImpl<T>] {
assert(isReadableStream(stream));
assert(typeof cloneForBranch2 === "boolean");
@@ -1225,14 +1225,14 @@ export function readableStreamTee<T>(
readableStreamDefaultControllerClose(
branch1[
sym.readableStreamController
- ] as ReadableStreamDefaultControllerImpl
+ ] as ReadableStreamDefaultControllerImpl,
);
}
if (!canceled2) {
readableStreamDefaultControllerClose(
branch2[
sym.readableStreamController
- ] as ReadableStreamDefaultControllerImpl
+ ] as ReadableStreamDefaultControllerImpl,
);
}
return;
@@ -1248,7 +1248,7 @@ export function readableStreamTee<T>(
branch1[
sym.readableStreamController
] as ReadableStreamDefaultControllerImpl,
- value1
+ value1,
);
}
if (!canceled2) {
@@ -1256,10 +1256,10 @@ export function readableStreamTee<T>(
branch2[
sym.readableStreamController
] as ReadableStreamDefaultControllerImpl,
- value2
+ value2,
);
}
- }
+ },
);
setPromiseIsHandledToTrue(readPromise);
return Promise.resolve();
@@ -1288,12 +1288,12 @@ export function readableStreamTee<T>(
branch1 = createReadableStream(
startAlgorithm,
pullAlgorithm,
- cancel1Algorithm
+ cancel1Algorithm,
);
branch2 = createReadableStream(
startAlgorithm,
pullAlgorithm,
- cancel2Algorithm
+ cancel2Algorithm,
);
setPromiseIsHandledToTrue(
reader[sym.closedPromise].promise.catch((r) => {
@@ -1301,15 +1301,15 @@ export function readableStreamTee<T>(
branch1[
sym.readableStreamController
] as ReadableStreamDefaultControllerImpl,
- r
+ r,
);
readableStreamDefaultControllerError(
branch2[
sym.readableStreamController
] as ReadableStreamDefaultControllerImpl,
- r
+ r,
);
- })
+ }),
);
return [branch1, branch2];
}
@@ -1340,7 +1340,7 @@ function setUpReadableByteStreamController(
pullAlgorithm: PullAlgorithm,
cancelAlgorithm: CancelAlgorithm,
highWaterMark: number,
- autoAllocateChunkSize: number | undefined
+ autoAllocateChunkSize: number | undefined,
): void {
assert(stream[sym.readableStreamController] === undefined);
if (autoAllocateChunkSize !== undefined) {
@@ -1354,7 +1354,7 @@ function setUpReadableByteStreamController(
controller[sym.queueTotalSize] = 0;
controller[sym.closeRequested] = controller[sym.started] = false;
controller[sym.strategyHWM] = validateAndNormalizeHighWaterMark(
- highWaterMark
+ highWaterMark,
);
controller[sym.pullAlgorithm] = pullAlgorithm;
controller[sym.cancelAlgorithm] = cancelAlgorithm;
@@ -1373,19 +1373,19 @@ function setUpReadableByteStreamController(
},
(r) => {
readableByteStreamControllerError(controller, r);
- }
- )
+ },
+ ),
);
}
export function setUpReadableByteStreamControllerFromUnderlyingSource(
stream: ReadableStreamImpl,
underlyingByteSource: UnderlyingByteSource,
- highWaterMark: number
+ highWaterMark: number,
): void {
assert(underlyingByteSource);
const controller: ReadableByteStreamControllerImpl = Object.create(
- ReadableByteStreamControllerImpl.prototype
+ ReadableByteStreamControllerImpl.prototype,
);
const startAlgorithm: StartAlgorithm = () => {
return invokeOrNoop(underlyingByteSource, "start", controller);
@@ -1394,13 +1394,13 @@ export function setUpReadableByteStreamControllerFromUnderlyingSource(
underlyingByteSource,
"pull",
0,
- controller
+ controller,
);
setFunctionName(pullAlgorithm, "[[pullAlgorithm]]");
const cancelAlgorithm = createAlgorithmFromUnderlyingMethod(
underlyingByteSource,
"cancel",
- 1
+ 1,
);
setFunctionName(cancelAlgorithm, "[[cancelAlgorithm]]");
// 3.13.27.6 Let autoAllocateChunkSize be ? GetV(underlyingByteSource, "autoAllocateChunkSize").
@@ -1412,7 +1412,7 @@ export function setUpReadableByteStreamControllerFromUnderlyingSource(
pullAlgorithm,
cancelAlgorithm,
highWaterMark,
- autoAllocateChunkSize
+ autoAllocateChunkSize,
);
}
@@ -1423,7 +1423,7 @@ function setUpReadableStreamDefaultController<T>(
pullAlgorithm: PullAlgorithm,
cancelAlgorithm: CancelAlgorithm,
highWaterMark: number,
- sizeAlgorithm: SizeAlgorithm<T>
+ sizeAlgorithm: SizeAlgorithm<T>,
): void {
assert(stream[sym.readableStreamController] === undefined);
controller[sym.controlledReadableStream] = stream;
@@ -1449,8 +1449,8 @@ function setUpReadableStreamDefaultController<T>(
},
(r) => {
readableStreamDefaultControllerError(controller, r);
- }
- )
+ },
+ ),
);
}
@@ -1458,11 +1458,11 @@ export function setUpReadableStreamDefaultControllerFromUnderlyingSource<T>(
stream: ReadableStreamImpl<T>,
underlyingSource: UnderlyingSource<T>,
highWaterMark: number,
- sizeAlgorithm: SizeAlgorithm<T>
+ sizeAlgorithm: SizeAlgorithm<T>,
): void {
assert(underlyingSource);
const controller: ReadableStreamDefaultControllerImpl<T> = Object.create(
- ReadableStreamDefaultControllerImpl.prototype
+ ReadableStreamDefaultControllerImpl.prototype,
);
const startAlgorithm: StartAlgorithm = (): void | PromiseLike<void> =>
invokeOrNoop(underlyingSource, "start", controller);
@@ -1470,13 +1470,13 @@ export function setUpReadableStreamDefaultControllerFromUnderlyingSource<T>(
underlyingSource,
"pull",
0,
- controller
+ controller,
);
setFunctionName(pullAlgorithm, "[[pullAlgorithm]]");
const cancelAlgorithm: CancelAlgorithm = createAlgorithmFromUnderlyingMethod(
underlyingSource,
"cancel",
- 1
+ 1,
);
setFunctionName(cancelAlgorithm, "[[cancelAlgorithm]]");
setUpReadableStreamDefaultController(
@@ -1486,7 +1486,7 @@ export function setUpReadableStreamDefaultControllerFromUnderlyingSource<T>(
pullAlgorithm,
cancelAlgorithm,
highWaterMark,
- sizeAlgorithm
+ sizeAlgorithm,
);
}
@@ -1494,7 +1494,7 @@ function setUpTransformStreamDefaultController<I, O>(
stream: TransformStreamImpl<I, O>,
controller: TransformStreamDefaultControllerImpl<I, O>,
transformAlgorithm: TransformAlgorithm<I>,
- flushAlgorithm: FlushAlgorithm
+ flushAlgorithm: FlushAlgorithm,
): void {
assert(isTransformStream(stream));
assert(stream[sym.transformStreamController] === undefined);
@@ -1506,18 +1506,18 @@ function setUpTransformStreamDefaultController<I, O>(
export function setUpTransformStreamDefaultControllerFromTransformer<I, O>(
stream: TransformStreamImpl<I, O>,
- transformer: Transformer<I, O>
+ transformer: Transformer<I, O>,
): void {
assert(transformer);
const controller = Object.create(
- TransformStreamDefaultControllerImpl.prototype
+ TransformStreamDefaultControllerImpl.prototype,
) as TransformStreamDefaultControllerImpl<I, O>;
let transformAlgorithm: TransformAlgorithm<I> = (chunk) => {
try {
transformStreamDefaultControllerEnqueue(
controller,
// it defaults to no tranformation, so I is assumed to be O
- (chunk as unknown) as O
+ (chunk as unknown) as O,
);
} catch (e) {
return Promise.reject(e);
@@ -1536,13 +1536,13 @@ export function setUpTransformStreamDefaultControllerFromTransformer<I, O>(
transformer,
"flush",
0,
- controller
+ controller,
);
setUpTransformStreamDefaultController(
stream,
controller,
transformAlgorithm,
- flushAlgorithm
+ flushAlgorithm,
);
}
@@ -1554,7 +1554,7 @@ function setUpWritableStreamDefaultController<W>(
closeAlgorithm: CloseAlgorithm,
abortAlgorithm: AbortAlgorithm,
highWaterMark: number,
- sizeAlgorithm: SizeAlgorithm<W>
+ sizeAlgorithm: SizeAlgorithm<W>,
): void {
assert(isWritableStream(stream));
assert(stream[sym.writableStreamController] === undefined);
@@ -1569,7 +1569,7 @@ function setUpWritableStreamDefaultController<W>(
controller[sym.closeAlgorithm] = closeAlgorithm;
controller[sym.abortAlgorithm] = abortAlgorithm;
const backpressure = writableStreamDefaultControllerGetBackpressure(
- controller
+ controller,
);
writableStreamUpdateBackpressure(stream, backpressure);
const startResult = startAlgorithm();
@@ -1578,19 +1578,19 @@ function setUpWritableStreamDefaultController<W>(
startPromise.then(
() => {
assert(
- stream[sym.state] === "writable" || stream[sym.state] === "erroring"
+ stream[sym.state] === "writable" || stream[sym.state] === "erroring",
);
controller[sym.started] = true;
writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
},
(r) => {
assert(
- stream[sym.state] === "writable" || stream[sym.state] === "erroring"
+ stream[sym.state] === "writable" || stream[sym.state] === "erroring",
);
controller[sym.started] = true;
writableStreamDealWithRejection(stream, r);
- }
- )
+ },
+ ),
);
}
@@ -1598,11 +1598,11 @@ export function setUpWritableStreamDefaultControllerFromUnderlyingSink<W>(
stream: WritableStreamImpl<W>,
underlyingSink: UnderlyingSink<W>,
highWaterMark: number,
- sizeAlgorithm: SizeAlgorithm<W>
+ sizeAlgorithm: SizeAlgorithm<W>,
): void {
assert(underlyingSink);
const controller = Object.create(
- WritableStreamDefaultControllerImpl.prototype
+ WritableStreamDefaultControllerImpl.prototype,
);
const startAlgorithm = (): void | PromiseLike<void> => {
return invokeOrNoop(underlyingSink, "start", controller);
@@ -1611,19 +1611,19 @@ export function setUpWritableStreamDefaultControllerFromUnderlyingSink<W>(
underlyingSink,
"write",
1,
- controller
+ controller,
);
setFunctionName(writeAlgorithm, "[[writeAlgorithm]]");
const closeAlgorithm = createAlgorithmFromUnderlyingMethod(
underlyingSink,
"close",
- 0
+ 0,
);
setFunctionName(closeAlgorithm, "[[closeAlgorithm]]");
const abortAlgorithm = createAlgorithmFromUnderlyingMethod(
underlyingSink,
"abort",
- 1
+ 1,
);
setFunctionName(abortAlgorithm, "[[abortAlgorithm]]");
setUpWritableStreamDefaultController(
@@ -1634,12 +1634,12 @@ export function setUpWritableStreamDefaultControllerFromUnderlyingSink<W>(
closeAlgorithm,
abortAlgorithm,
highWaterMark,
- sizeAlgorithm
+ sizeAlgorithm,
);
}
function transformStreamDefaultControllerClearAlgorithms<I, O>(
- controller: TransformStreamDefaultControllerImpl<I, O>
+ controller: TransformStreamDefaultControllerImpl<I, O>,
): void {
(controller as any)[sym.transformAlgorithm] = undefined;
(controller as any)[sym.flushAlgorithm] = undefined;
@@ -1647,7 +1647,7 @@ function transformStreamDefaultControllerClearAlgorithms<I, O>(
export function transformStreamDefaultControllerEnqueue<I, O>(
controller: TransformStreamDefaultControllerImpl<I, O>,
- chunk: O
+ chunk: O,
): void {
const stream = controller[sym.controlledTransformStream];
const readableController = stream[sym.readable][
@@ -1655,7 +1655,7 @@ export function transformStreamDefaultControllerEnqueue<I, O>(
] as ReadableStreamDefaultControllerImpl<O>;
if (!readableStreamDefaultControllerCanCloseOrEnqueue(readableController)) {
throw new TypeError(
- "TransformStream's readable controller cannot be closed or enqueued."
+ "TransformStream's readable controller cannot be closed or enqueued.",
);
}
try {
@@ -1665,7 +1665,7 @@ export function transformStreamDefaultControllerEnqueue<I, O>(
throw stream[sym.readable][sym.storedError];
}
const backpressure = readableStreamDefaultControllerHasBackpressure(
- readableController
+ readableController,
);
if (backpressure) {
transformStreamSetBackpressure(stream, true);
@@ -1674,14 +1674,14 @@ export function transformStreamDefaultControllerEnqueue<I, O>(
export function transformStreamDefaultControllerError<I, O>(
controller: TransformStreamDefaultControllerImpl<I, O>,
- e: any
+ e: any,
): void {
transformStreamError(controller[sym.controlledTransformStream], e);
}
function transformStreamDefaultControllerPerformTransform<I, O>(
controller: TransformStreamDefaultControllerImpl<I, O>,
- chunk: I
+ chunk: I,
): Promise<void> {
const transformPromise = controller[sym.transformAlgorithm](chunk);
return transformPromise.then(undefined, (r) => {
@@ -1692,14 +1692,14 @@ function transformStreamDefaultControllerPerformTransform<I, O>(
function transformStreamDefaultSinkAbortAlgorithm<I, O>(
stream: TransformStreamImpl<I, O>,
- reason: any
+ reason: any,
): Promise<void> {
transformStreamError(stream, reason);
return Promise.resolve(undefined);
}
function transformStreamDefaultSinkCloseAlgorithm<I, O>(
- stream: TransformStreamImpl<I, O>
+ stream: TransformStreamImpl<I, O>,
): Promise<void> {
const readable = stream[sym.readable];
const controller = stream[sym.transformStreamController];
@@ -1722,13 +1722,13 @@ function transformStreamDefaultSinkCloseAlgorithm<I, O>(
(r) => {
transformStreamError(stream, r);
throw readable[sym.storedError];
- }
+ },
);
}
function transformStreamDefaultSinkWriteAlgorithm<I, O>(
stream: TransformStreamImpl<I, O>,
- chunk: I
+ chunk: I,
): Promise<void> {
assert(stream[sym.writable][sym.state] === "writable");
const controller = stream[sym.transformStreamController];
@@ -1744,7 +1744,7 @@ function transformStreamDefaultSinkWriteAlgorithm<I, O>(
assert(state === "writable");
return transformStreamDefaultControllerPerformTransform(
controller,
- chunk
+ chunk,
);
});
}
@@ -1752,7 +1752,7 @@ function transformStreamDefaultSinkWriteAlgorithm<I, O>(
}
function transformStreamDefaultSourcePullAlgorithm<I, O>(
- stream: TransformStreamImpl<I, O>
+ stream: TransformStreamImpl<I, O>,
): Promise<void> {
assert(stream[sym.backpressure] === true);
assert(stream[sym.backpressureChangePromise] !== undefined);
@@ -1762,19 +1762,19 @@ function transformStreamDefaultSourcePullAlgorithm<I, O>(
function transformStreamError<I, O>(
stream: TransformStreamImpl<I, O>,
- e: any
+ e: any,
): void {
readableStreamDefaultControllerError(
stream[sym.readable][
sym.readableStreamController
] as ReadableStreamDefaultControllerImpl<O>,
- e
+ e,
);
transformStreamErrorWritableAndUnblockWrite(stream, e);
}
export function transformStreamDefaultControllerTerminate<I, O>(
- controller: TransformStreamDefaultControllerImpl<I, O>
+ controller: TransformStreamDefaultControllerImpl<I, O>,
): void {
const stream = controller[sym.controlledTransformStream];
const readableController = stream[sym.readable][
@@ -1787,14 +1787,14 @@ export function transformStreamDefaultControllerTerminate<I, O>(
function transformStreamErrorWritableAndUnblockWrite<I, O>(
stream: TransformStreamImpl<I, O>,
- e: any
+ e: any,
): void {
transformStreamDefaultControllerClearAlgorithms(
- stream[sym.transformStreamController]
+ stream[sym.transformStreamController],
);
writableStreamDefaultControllerErrorIfNeeded(
stream[sym.writable][sym.writableStreamController]!,
- e
+ e,
);
if (stream[sym.backpressure]) {
transformStreamSetBackpressure(stream, false);
@@ -1803,7 +1803,7 @@ function transformStreamErrorWritableAndUnblockWrite<I, O>(
function transformStreamSetBackpressure<I, O>(
stream: TransformStreamImpl<I, O>,
- backpressure: boolean
+ backpressure: boolean,
): void {
assert(stream[sym.backpressure] !== backpressure);
if (stream[sym.backpressureChangePromise] !== undefined) {
@@ -1828,12 +1828,12 @@ function transferArrayBuffer(buffer: ArrayBuffer): ArrayBuffer {
}
export function validateAndNormalizeHighWaterMark(
- highWaterMark: number
+ highWaterMark: number,
): number {
highWaterMark = Number(highWaterMark);
if (Number.isNaN(highWaterMark) || highWaterMark < 0) {
throw new RangeError(
- `highWaterMark must be a positive number or Infinity. Received: ${highWaterMark}.`
+ `highWaterMark must be a positive number or Infinity. Received: ${highWaterMark}.`,
);
}
return highWaterMark;
@@ -1841,7 +1841,7 @@ export function validateAndNormalizeHighWaterMark(
export function writableStreamAbort<W>(
stream: WritableStreamImpl<W>,
- reason: any
+ reason: any,
): Promise<void> {
const state = stream[sym.state];
if (state === "closed" || state === "errored") {
@@ -1866,7 +1866,7 @@ export function writableStreamAbort<W>(
}
function writableStreamAddWriteRequest<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): Promise<void> {
assert(isWritableStream(stream));
assert(stream[sym.state] === "writable");
@@ -1876,12 +1876,14 @@ function writableStreamAddWriteRequest<W>(
}
export function writableStreamClose<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): Promise<void> {
const state = stream[sym.state];
if (state === "closed" || state === "errored") {
return Promise.reject(
- new TypeError("Cannot close an already closed or errored WritableStream.")
+ new TypeError(
+ "Cannot close an already closed or errored WritableStream.",
+ ),
);
}
assert(!writableStreamCloseQueuedOrInFlight(stream));
@@ -1898,7 +1900,7 @@ export function writableStreamClose<W>(
}
export function writableStreamCloseQueuedOrInFlight<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): boolean {
return !(
stream[sym.closeRequest] === undefined &&
@@ -1908,7 +1910,7 @@ export function writableStreamCloseQueuedOrInFlight<W>(
function writableStreamDealWithRejection<W>(
stream: WritableStreamImpl<W>,
- error: any
+ error: any,
): void {
const state = stream[sym.state];
if (state === "writable") {
@@ -1920,7 +1922,7 @@ function writableStreamDealWithRejection<W>(
}
function writableStreamDefaultControllerAdvanceQueueIfNeeded<W>(
- controller: WritableStreamDefaultControllerImpl<W>
+ controller: WritableStreamDefaultControllerImpl<W>,
): void {
const stream = controller[sym.controlledWritableStream];
if (!controller[sym.started]) {
@@ -1947,7 +1949,7 @@ function writableStreamDefaultControllerAdvanceQueueIfNeeded<W>(
}
export function writableStreamDefaultControllerClearAlgorithms<W>(
- controller: WritableStreamDefaultControllerImpl<W>
+ controller: WritableStreamDefaultControllerImpl<W>,
): void {
(controller as any)[sym.writeAlgorithm] = undefined;
(controller as any)[sym.closeAlgorithm] = undefined;
@@ -1956,7 +1958,7 @@ export function writableStreamDefaultControllerClearAlgorithms<W>(
}
function writableStreamDefaultControllerClose<W>(
- controller: WritableStreamDefaultControllerImpl<W>
+ controller: WritableStreamDefaultControllerImpl<W>,
): void {
enqueueValueWithSize(controller, "close", 0);
writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
@@ -1964,7 +1966,7 @@ function writableStreamDefaultControllerClose<W>(
export function writableStreamDefaultControllerError<W>(
controller: WritableStreamDefaultControllerImpl<W>,
- error: any
+ error: any,
): void {
const stream = controller[sym.controlledWritableStream];
assert(stream[sym.state] === "writable");
@@ -1974,7 +1976,7 @@ export function writableStreamDefaultControllerError<W>(
function writableStreamDefaultControllerErrorIfNeeded<W>(
controller: WritableStreamDefaultControllerImpl<W>,
- error: any
+ error: any,
): void {
if (controller[sym.controlledWritableStream][sym.state] === "writable") {
writableStreamDefaultControllerError(controller, error);
@@ -1982,7 +1984,7 @@ function writableStreamDefaultControllerErrorIfNeeded<W>(
}
function writableStreamDefaultControllerGetBackpressure<W>(
- controller: WritableStreamDefaultControllerImpl<W>
+ controller: WritableStreamDefaultControllerImpl<W>,
): boolean {
const desiredSize = writableStreamDefaultControllerGetDesiredSize(controller);
return desiredSize <= 0;
@@ -1990,7 +1992,7 @@ function writableStreamDefaultControllerGetBackpressure<W>(
function writableStreamDefaultControllerGetChunkSize<W>(
controller: WritableStreamDefaultControllerImpl<W>,
- chunk: W
+ chunk: W,
): number {
let returnValue: number;
try {
@@ -2003,13 +2005,13 @@ function writableStreamDefaultControllerGetChunkSize<W>(
}
function writableStreamDefaultControllerGetDesiredSize<W>(
- controller: WritableStreamDefaultControllerImpl<W>
+ controller: WritableStreamDefaultControllerImpl<W>,
): number {
return controller[sym.strategyHWM] - controller[sym.queueTotalSize];
}
function writableStreamDefaultControllerProcessClose<W>(
- controller: WritableStreamDefaultControllerImpl<W>
+ controller: WritableStreamDefaultControllerImpl<W>,
): void {
const stream = controller[sym.controlledWritableStream];
writableStreamMarkCloseRequestInFlight(stream);
@@ -2024,14 +2026,14 @@ function writableStreamDefaultControllerProcessClose<W>(
},
(reason) => {
writableStreamFinishInFlightCloseWithError(stream, reason);
- }
- )
+ },
+ ),
);
}
function writableStreamDefaultControllerProcessWrite<W>(
controller: WritableStreamDefaultControllerImpl<W>,
- chunk: W
+ chunk: W,
): void {
const stream = controller[sym.controlledWritableStream];
writableStreamMarkFirstWriteRequestInFlight(stream);
@@ -2048,7 +2050,7 @@ function writableStreamDefaultControllerProcessWrite<W>(
state === "writable"
) {
const backpressure = writableStreamDefaultControllerGetBackpressure(
- controller
+ controller,
);
writableStreamUpdateBackpressure(stream, backpressure);
}
@@ -2059,15 +2061,15 @@ function writableStreamDefaultControllerProcessWrite<W>(
writableStreamDefaultControllerClearAlgorithms(controller);
}
writableStreamFinishInFlightWriteWithError(stream, reason);
- }
- )
+ },
+ ),
);
}
function writableStreamDefaultControllerWrite<W>(
controller: WritableStreamDefaultControllerImpl<W>,
chunk: W,
- chunkSize: number
+ chunkSize: number,
): void {
const writeRecord = { chunk };
try {
@@ -2082,7 +2084,7 @@ function writableStreamDefaultControllerWrite<W>(
stream[sym.state] === "writable"
) {
const backpressure = writableStreamDefaultControllerGetBackpressure(
- controller
+ controller,
);
writableStreamUpdateBackpressure(stream, backpressure);
}
@@ -2091,7 +2093,7 @@ function writableStreamDefaultControllerWrite<W>(
export function writableStreamDefaultWriterAbort<W>(
writer: WritableStreamDefaultWriterImpl<W>,
- reason: any
+ reason: any,
): Promise<void> {
const stream = writer[sym.ownerWritableStream];
assert(stream);
@@ -2099,7 +2101,7 @@ export function writableStreamDefaultWriterAbort<W>(
}
export function writableStreamDefaultWriterClose<W>(
- writer: WritableStreamDefaultWriterImpl<W>
+ writer: WritableStreamDefaultWriterImpl<W>,
): Promise<void> {
const stream = writer[sym.ownerWritableStream];
assert(stream);
@@ -2107,7 +2109,7 @@ export function writableStreamDefaultWriterClose<W>(
}
function writableStreamDefaultWriterCloseWithErrorPropagation<W>(
- writer: WritableStreamDefaultWriterImpl<W>
+ writer: WritableStreamDefaultWriterImpl<W>,
): Promise<void> {
const stream = writer[sym.ownerWritableStream];
assert(stream);
@@ -2124,7 +2126,7 @@ function writableStreamDefaultWriterCloseWithErrorPropagation<W>(
function writableStreamDefaultWriterEnsureClosePromiseRejected<W>(
writer: WritableStreamDefaultWriterImpl<W>,
- error: any
+ error: any,
): void {
if (writer[sym.closedPromise].reject) {
writer[sym.closedPromise].reject!(error);
@@ -2138,7 +2140,7 @@ function writableStreamDefaultWriterEnsureClosePromiseRejected<W>(
function writableStreamDefaultWriterEnsureReadyPromiseRejected<W>(
writer: WritableStreamDefaultWriterImpl<W>,
- error: any
+ error: any,
): void {
if (writer[sym.readyPromise].reject) {
writer[sym.readyPromise].reject!(error);
@@ -2154,7 +2156,7 @@ function writableStreamDefaultWriterEnsureReadyPromiseRejected<W>(
export function writableStreamDefaultWriterWrite<W>(
writer: WritableStreamDefaultWriterImpl<W>,
- chunk: W
+ chunk: W,
): Promise<void> {
const stream = writer[sym.ownerWritableStream];
assert(stream);
@@ -2162,7 +2164,7 @@ export function writableStreamDefaultWriterWrite<W>(
assert(controller);
const chunkSize = writableStreamDefaultControllerGetChunkSize(
controller,
- chunk
+ chunk,
);
if (stream !== writer[sym.ownerWritableStream]) {
return Promise.reject("Writer has incorrect WritableStream.");
@@ -2184,7 +2186,7 @@ export function writableStreamDefaultWriterWrite<W>(
}
export function writableStreamDefaultWriterGetDesiredSize<W>(
- writer: WritableStreamDefaultWriterImpl<W>
+ writer: WritableStreamDefaultWriterImpl<W>,
): number | null {
const stream = writer[sym.ownerWritableStream];
const state = stream[sym.state];
@@ -2195,18 +2197,18 @@ export function writableStreamDefaultWriterGetDesiredSize<W>(
return 0;
}
return writableStreamDefaultControllerGetDesiredSize(
- stream[sym.writableStreamController]!
+ stream[sym.writableStreamController]!,
);
}
export function writableStreamDefaultWriterRelease<W>(
- writer: WritableStreamDefaultWriterImpl<W>
+ writer: WritableStreamDefaultWriterImpl<W>,
): void {
const stream = writer[sym.ownerWritableStream];
assert(stream);
assert(stream[sym.writer] === writer);
const releasedError = new TypeError(
- "Writer was released and can no longer be used to monitor the stream's closedness."
+ "Writer was released and can no longer be used to monitor the stream's closedness.",
);
writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);
writableStreamDefaultWriterEnsureClosePromiseRejected(writer, releasedError);
@@ -2239,7 +2241,7 @@ function writableStreamFinishErroring<W>(stream: WritableStreamImpl<W>): void {
return;
}
const promise = stream[sym.writableStreamController]![sym.abortSteps](
- abortRequest.reason
+ abortRequest.reason,
);
setPromiseIsHandledToTrue(
promise.then(
@@ -2252,13 +2254,13 @@ function writableStreamFinishErroring<W>(stream: WritableStreamImpl<W>): void {
assert(abortRequest.promise.reject);
abortRequest.promise.reject(reason);
writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- }
- )
+ },
+ ),
);
}
function writableStreamFinishInFlightClose<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): void {
assert(stream[sym.inFlightCloseRequest]);
stream[sym.inFlightCloseRequest]?.resolve!();
@@ -2283,7 +2285,7 @@ function writableStreamFinishInFlightClose<W>(
function writableStreamFinishInFlightCloseWithError<W>(
stream: WritableStreamImpl<W>,
- error: any
+ error: any,
): void {
assert(stream[sym.inFlightCloseRequest]);
stream[sym.inFlightCloseRequest]?.reject!(error);
@@ -2297,7 +2299,7 @@ function writableStreamFinishInFlightCloseWithError<W>(
}
function writableStreamFinishInFlightWrite<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): void {
assert(stream[sym.inFlightWriteRequest]);
stream[sym.inFlightWriteRequest]!.resolve();
@@ -2306,7 +2308,7 @@ function writableStreamFinishInFlightWrite<W>(
function writableStreamFinishInFlightWriteWithError<W>(
stream: WritableStreamImpl<W>,
- error: any
+ error: any,
): void {
assert(stream[sym.inFlightWriteRequest]);
stream[sym.inFlightWriteRequest]!.reject!(error);
@@ -2316,7 +2318,7 @@ function writableStreamFinishInFlightWriteWithError<W>(
}
function writableStreamHasOperationMarkedInFlight<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): boolean {
return !(
stream[sym.inFlightWriteRequest] === undefined &&
@@ -2325,7 +2327,7 @@ function writableStreamHasOperationMarkedInFlight<W>(
}
function writableStreamMarkCloseRequestInFlight<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): void {
assert(stream[sym.inFlightCloseRequest] === undefined);
assert(stream[sym.closeRequest] !== undefined);
@@ -2334,7 +2336,7 @@ function writableStreamMarkCloseRequestInFlight<W>(
}
function writableStreamMarkFirstWriteRequestInFlight<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): void {
assert(stream[sym.inFlightWriteRequest] === undefined);
assert(stream[sym.writeRequests].length);
@@ -2343,7 +2345,7 @@ function writableStreamMarkFirstWriteRequestInFlight<W>(
}
function writableStreamRejectCloseAndClosedPromiseIfNeeded<W>(
- stream: WritableStreamImpl<W>
+ stream: WritableStreamImpl<W>,
): void {
assert(stream[sym.state] === "errored");
if (stream[sym.closeRequest]) {
@@ -2360,7 +2362,7 @@ function writableStreamRejectCloseAndClosedPromiseIfNeeded<W>(
function writableStreamStartErroring<W>(
stream: WritableStreamImpl<W>,
- reason: any
+ reason: any,
): void {
assert(stream[sym.storedError] === undefined);
assert(stream[sym.state] === "writable");
@@ -2382,7 +2384,7 @@ function writableStreamStartErroring<W>(
function writableStreamUpdateBackpressure<W>(
stream: WritableStreamImpl<W>,
- backpressure: boolean
+ backpressure: boolean,
): void {
assert(stream[sym.state] === "writable");
assert(!writableStreamCloseQueuedOrInFlight(stream));
diff --git a/cli/js/web/streams/queuing_strategy.ts b/cli/js/web/streams/queuing_strategy.ts
index 8aa30e142..818f0d51b 100644
--- a/cli/js/web/streams/queuing_strategy.ts
+++ b/cli/js/web/streams/queuing_strategy.ts
@@ -15,9 +15,9 @@ export class CountQueuingStrategyImpl implements CountQueuingStrategy {
}
[customInspect](): string {
- return `${this.constructor.name} { highWaterMark: ${String(
- this.highWaterMark
- )}, size: f }`;
+ return `${this.constructor.name} { highWaterMark: ${
+ String(this.highWaterMark)
+ }, size: f }`;
}
}
@@ -40,9 +40,9 @@ export class ByteLengthQueuingStrategyImpl
}
[customInspect](): string {
- return `${this.constructor.name} { highWaterMark: ${String(
- this.highWaterMark
- )}, size: f }`;
+ return `${this.constructor.name} { highWaterMark: ${
+ String(this.highWaterMark)
+ }, size: f }`;
}
}
diff --git a/cli/js/web/streams/readable_byte_stream_controller.ts b/cli/js/web/streams/readable_byte_stream_controller.ts
index 4a7ffae12..eb4374604 100644
--- a/cli/js/web/streams/readable_byte_stream_controller.ts
+++ b/cli/js/web/streams/readable_byte_stream_controller.ts
@@ -42,7 +42,7 @@ export class ReadableByteStreamControllerImpl
private constructor() {
throw new TypeError(
- "ReadableByteStreamController's constructor cannot be called."
+ "ReadableByteStreamController's constructor cannot be called.",
);
}
@@ -66,7 +66,7 @@ export class ReadableByteStreamControllerImpl
}
if (this[sym.controlledReadableByteStream][sym.state] !== "readable") {
throw new TypeError(
- "ReadableByteStreamController's stream is not in a readable state."
+ "ReadableByteStreamController's stream is not in a readable state.",
);
}
readableByteStreamControllerClose(this);
@@ -81,12 +81,12 @@ export class ReadableByteStreamControllerImpl
}
if (this[sym.controlledReadableByteStream][sym.state] !== "readable") {
throw new TypeError(
- "ReadableByteStreamController's stream is not in a readable state."
+ "ReadableByteStreamController's stream is not in a readable state.",
);
}
if (!ArrayBuffer.isView(chunk)) {
throw new TypeError(
- "You can only enqueue array buffer views when using a ReadableByteStreamController"
+ "You can only enqueue array buffer views when using a ReadableByteStreamController",
);
}
if (isDetachedBuffer(chunk.buffer)) {
@@ -126,8 +126,8 @@ export class ReadableByteStreamControllerImpl
readableStreamCreateReadResult(
view,
false,
- stream[sym.reader]![sym.forAuthorCode]
- )
+ stream[sym.reader]![sym.forAuthorCode],
+ ),
);
}
// 3.11.5.2.5 If autoAllocateChunkSize is not undefined,
@@ -137,13 +137,13 @@ export class ReadableByteStreamControllerImpl
}
[customInspect](): string {
- return `${this.constructor.name} { byobRequest: ${String(
- this.byobRequest
- )}, desiredSize: ${String(this.desiredSize)} }`;
+ return `${this.constructor.name} { byobRequest: ${
+ String(this.byobRequest)
+ }, desiredSize: ${String(this.desiredSize)} }`;
}
}
setFunctionName(
ReadableByteStreamControllerImpl,
- "ReadableByteStreamController"
+ "ReadableByteStreamController",
);
diff --git a/cli/js/web/streams/readable_stream.ts b/cli/js/web/streams/readable_stream.ts
index cf730d23a..086535bd2 100644
--- a/cli/js/web/streams/readable_stream.ts
+++ b/cli/js/web/streams/readable_stream.ts
@@ -41,10 +41,10 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
underlyingSource: UnderlyingByteSource | UnderlyingSource<R> = {},
strategy:
| {
- highWaterMark?: number;
- size?: undefined;
- }
- | QueuingStrategy<R> = {}
+ highWaterMark?: number;
+ size?: undefined;
+ }
+ | QueuingStrategy<R> = {},
) {
initializeReadableStream(this);
const { size } = strategy;
@@ -54,14 +54,14 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
if (isUnderlyingByteSource(underlyingSource)) {
if (size !== undefined) {
throw new RangeError(
- `When underlying source is "bytes", strategy.size must be undefined.`
+ `When underlying source is "bytes", strategy.size must be undefined.`,
);
}
highWaterMark = validateAndNormalizeHighWaterMark(highWaterMark ?? 0);
setUpReadableByteStreamControllerFromUnderlyingSource(
this,
underlyingSource,
- highWaterMark
+ highWaterMark,
);
} else if (type === undefined) {
const sizeAlgorithm = makeSizeAlgorithmFromSizeFunction(size);
@@ -70,11 +70,11 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
this,
underlyingSource,
highWaterMark,
- sizeAlgorithm
+ sizeAlgorithm,
);
} else {
throw new RangeError(
- `Valid values for underlyingSource are "bytes" or undefined. Received: "${type}".`
+ `Valid values for underlyingSource are "bytes" or undefined. Received: "${type}".`,
);
}
}
@@ -93,7 +93,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
}
if (isReadableStreamLocked(this)) {
return Promise.reject(
- new TypeError("Cannot cancel a locked ReadableStream.")
+ new TypeError("Cannot cancel a locked ReadableStream."),
);
}
return readableStreamCancel(this, reason);
@@ -132,7 +132,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
writable: WritableStream<R>;
readable: ReadableStream<T>;
},
- { preventClose, preventAbort, preventCancel, signal }: PipeOptions = {}
+ { preventClose, preventAbort, preventCancel, signal }: PipeOptions = {},
): ReadableStream<T> {
if (!isReadableStream(this)) {
throw new TypeError("Invalid ReadableStream.");
@@ -161,7 +161,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
preventClose,
preventAbort,
preventCancel,
- signal
+ signal,
);
setPromiseIsHandledToTrue(promise);
return readable;
@@ -169,14 +169,14 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
pipeTo(
dest: WritableStream<R>,
- { preventClose, preventAbort, preventCancel, signal }: PipeOptions = {}
+ { preventClose, preventAbort, preventCancel, signal }: PipeOptions = {},
): Promise<void> {
if (!isReadableStream(this)) {
return Promise.reject(new TypeError("Invalid ReadableStream."));
}
if (!isWritableStream(dest)) {
return Promise.reject(
- new TypeError("dest is not a valid WritableStream.")
+ new TypeError("dest is not a valid WritableStream."),
);
}
preventClose = Boolean(preventClose);
@@ -197,7 +197,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
preventClose,
preventAbort,
preventCancel,
- signal
+ signal,
);
}
@@ -215,7 +215,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
[Symbol.asyncIterator](
options: {
preventCancel?: boolean;
- } = {}
+ } = {},
): AsyncIterableIterator<R> {
return this.getIterator(options);
}
diff --git a/cli/js/web/streams/readable_stream_async_iterator.ts b/cli/js/web/streams/readable_stream_async_iterator.ts
index cd656e73d..c6b9759a5 100644
--- a/cli/js/web/streams/readable_stream_async_iterator.ts
+++ b/cli/js/web/streams/readable_stream_async_iterator.ts
@@ -12,25 +12,24 @@ import {
import { assert } from "../../util.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-const AsyncIteratorPrototype: AsyncIterableIterator<any> = Object.getPrototypeOf(
- Object.getPrototypeOf(async function* () {}).prototype
-);
+const AsyncIteratorPrototype: AsyncIterableIterator<any> = Object
+ .getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype);
-export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator = Object.setPrototypeOf(
- {
+export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator =
+ Object.setPrototypeOf({
next(
- this: ReadableStreamAsyncIterator
+ this: ReadableStreamAsyncIterator,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<ReadableStreamReadResult<any>> {
if (!isReadableStreamAsyncIterator(this)) {
return Promise.reject(
- new TypeError("invalid ReadableStreamAsyncIterator.")
+ new TypeError("invalid ReadableStreamAsyncIterator."),
);
}
const reader = this[sym.asyncIteratorReader];
if (!reader[sym.ownerReadableStream]) {
return Promise.reject(
- new TypeError("reader owner ReadableStream is undefined.")
+ new TypeError("reader owner ReadableStream is undefined."),
);
}
return readableStreamDefaultReaderRead(reader).then((result) => {
@@ -47,23 +46,23 @@ export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator =
return(
this: ReadableStreamAsyncIterator,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- value?: any | PromiseLike<any>
+ value?: any | PromiseLike<any>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<ReadableStreamReadResult<any>> {
if (!isReadableStreamAsyncIterator(this)) {
return Promise.reject(
- new TypeError("invalid ReadableStreamAsyncIterator.")
+ new TypeError("invalid ReadableStreamAsyncIterator."),
);
}
const reader = this[sym.asyncIteratorReader];
if (!reader[sym.ownerReadableStream]) {
return Promise.reject(
- new TypeError("reader owner ReadableStream is undefined.")
+ new TypeError("reader owner ReadableStream is undefined."),
);
}
if (reader[sym.readRequests].length) {
return Promise.reject(
- new TypeError("reader has outstanding read requests.")
+ new TypeError("reader has outstanding read requests."),
);
}
if (!this[sym.preventCancel]) {
@@ -74,8 +73,8 @@ export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator =
);
}
readableStreamReaderGenericRelease(reader);
- return Promise.resolve(readableStreamCreateReadResult(value, true, true));
+ return Promise.resolve(
+ readableStreamCreateReadResult(value, true, true),
+ );
},
- },
- AsyncIteratorPrototype
-);
+ }, AsyncIteratorPrototype);
diff --git a/cli/js/web/streams/readable_stream_default_controller.ts b/cli/js/web/streams/readable_stream_default_controller.ts
index 066bc8a8f..8536712b9 100644
--- a/cli/js/web/streams/readable_stream_default_controller.ts
+++ b/cli/js/web/streams/readable_stream_default_controller.ts
@@ -41,7 +41,7 @@ export class ReadableStreamDefaultControllerImpl<R = any>
private constructor() {
throw new TypeError(
- "ReadableStreamDefaultController's constructor cannot be called."
+ "ReadableStreamDefaultController's constructor cannot be called.",
);
}
@@ -58,7 +58,7 @@ export class ReadableStreamDefaultControllerImpl<R = any>
}
if (!readableStreamDefaultControllerCanCloseOrEnqueue(this)) {
throw new TypeError(
- "ReadableStreamDefaultController cannot close or enqueue."
+ "ReadableStreamDefaultController cannot close or enqueue.",
);
}
readableStreamDefaultControllerClose(this);
@@ -104,8 +104,8 @@ export class ReadableStreamDefaultControllerImpl<R = any>
readableStreamCreateReadResult(
chunk,
false,
- stream[sym.reader]![sym.forAuthorCode]
- )
+ stream[sym.reader]![sym.forAuthorCode],
+ ),
);
}
const pendingPromise = readableStreamAddReadRequest(stream);
@@ -114,13 +114,13 @@ export class ReadableStreamDefaultControllerImpl<R = any>
}
[customInspect](): string {
- return `${this.constructor.name} { desiredSize: ${String(
- this.desiredSize
- )} }`;
+ return `${this.constructor.name} { desiredSize: ${
+ String(this.desiredSize)
+ } }`;
}
}
setFunctionName(
ReadableStreamDefaultControllerImpl,
- "ReadableStreamDefaultController"
+ "ReadableStreamDefaultController",
);
diff --git a/cli/js/web/streams/readable_stream_default_reader.ts b/cli/js/web/streams/readable_stream_default_reader.ts
index 4ed0a5c7c..88260effb 100644
--- a/cli/js/web/streams/readable_stream_default_reader.ts
+++ b/cli/js/web/streams/readable_stream_default_reader.ts
@@ -37,12 +37,12 @@ export class ReadableStreamDefaultReaderImpl<R = any>
get closed(): Promise<void> {
if (!isReadableStreamDefaultReader(this)) {
return Promise.reject(
- new TypeError("Invalid ReadableStreamDefaultReader.")
+ new TypeError("Invalid ReadableStreamDefaultReader."),
);
}
return (
this[sym.closedPromise].promise ??
- Promise.reject(new TypeError("Invalid reader."))
+ Promise.reject(new TypeError("Invalid reader."))
);
}
@@ -50,7 +50,7 @@ export class ReadableStreamDefaultReaderImpl<R = any>
cancel(reason?: any): Promise<void> {
if (!isReadableStreamDefaultReader(this)) {
return Promise.reject(
- new TypeError("Invalid ReadableStreamDefaultReader.")
+ new TypeError("Invalid ReadableStreamDefaultReader."),
);
}
if (!this[sym.ownerReadableStream]) {
@@ -62,7 +62,7 @@ export class ReadableStreamDefaultReaderImpl<R = any>
read(): Promise<ReadableStreamReadResult<R>> {
if (!isReadableStreamDefaultReader(this)) {
return Promise.reject(
- new TypeError("Invalid ReadableStreamDefaultReader.")
+ new TypeError("Invalid ReadableStreamDefaultReader."),
);
}
if (!this[sym.ownerReadableStream]) {
diff --git a/cli/js/web/streams/symbols.ts b/cli/js/web/streams/symbols.ts
index 9c0a336e5..82d668598 100644
--- a/cli/js/web/streams/symbols.ts
+++ b/cli/js/web/streams/symbols.ts
@@ -20,7 +20,7 @@ export const closedPromise = Symbol("closedPromise");
export const closeRequest = Symbol("closeRequest");
export const closeRequested = Symbol("closeRequested");
export const controlledReadableByteStream = Symbol(
- "controlledReadableByteStream"
+ "controlledReadableByteStream",
);
export const controlledReadableStream = Symbol("controlledReadableStream");
export const controlledTransformStream = Symbol("controlledTransformStream");
diff --git a/cli/js/web/streams/transform_stream.ts b/cli/js/web/streams/transform_stream.ts
index 1c63a553b..f6924aead 100644
--- a/cli/js/web/streams/transform_stream.ts
+++ b/cli/js/web/streams/transform_stream.ts
@@ -29,7 +29,7 @@ export class TransformStreamImpl<I = any, O = any>
constructor(
transformer: Transformer<I, O> = {},
writableStrategy: QueuingStrategy<I> = {},
- readableStrategy: QueuingStrategy<O> = {}
+ readableStrategy: QueuingStrategy<O> = {},
) {
const writableSizeFunction = writableStrategy.size;
let writableHighWaterMark = writableStrategy.highWaterMark;
@@ -38,36 +38,36 @@ export class TransformStreamImpl<I = any, O = any>
const writableType = transformer.writableType;
if (writableType !== undefined) {
throw new RangeError(
- `Expected transformer writableType to be undefined, received "${String(
- writableType
- )}"`
+ `Expected transformer writableType to be undefined, received "${
+ String(writableType)
+ }"`,
);
}
const writableSizeAlgorithm = makeSizeAlgorithmFromSizeFunction(
- writableSizeFunction
+ writableSizeFunction,
);
if (writableHighWaterMark === undefined) {
writableHighWaterMark = 1;
}
writableHighWaterMark = validateAndNormalizeHighWaterMark(
- writableHighWaterMark
+ writableHighWaterMark,
);
const readableType = transformer.readableType;
if (readableType !== undefined) {
throw new RangeError(
- `Expected transformer readableType to be undefined, received "${String(
- readableType
- )}"`
+ `Expected transformer readableType to be undefined, received "${
+ String(readableType)
+ }"`,
);
}
const readableSizeAlgorithm = makeSizeAlgorithmFromSizeFunction(
- readableSizeFunction
+ readableSizeFunction,
);
if (readableHighWaterMark === undefined) {
readableHighWaterMark = 1;
}
readableHighWaterMark = validateAndNormalizeHighWaterMark(
- readableHighWaterMark
+ readableHighWaterMark,
);
const startPromise = getDeferred<void>();
initializeTransformStream(
@@ -76,7 +76,7 @@ export class TransformStreamImpl<I = any, O = any>
writableHighWaterMark,
writableSizeAlgorithm,
readableHighWaterMark,
- readableSizeAlgorithm
+ readableSizeAlgorithm,
);
// the brand check expects this, and the brand check occurs in the following
// but the property hasn't been defined.
@@ -89,7 +89,7 @@ export class TransformStreamImpl<I = any, O = any>
const startResult: void | PromiseLike<void> = invokeOrNoop(
transformer,
"start",
- this[sym.transformStreamController]
+ this[sym.transformStreamController],
);
startPromise.resolve(startResult);
}
@@ -109,9 +109,9 @@ export class TransformStreamImpl<I = any, O = any>
}
[customInspect](): string {
- return `${this.constructor.name} {\n readable: ${inspect(
- this.readable
- )}\n writable: ${inspect(this.writable)}\n}`;
+ return `${this.constructor.name} {\n readable: ${
+ inspect(this.readable)
+ }\n writable: ${inspect(this.writable)}\n}`;
}
}
diff --git a/cli/js/web/streams/transform_stream_default_controller.ts b/cli/js/web/streams/transform_stream_default_controller.ts
index 22087fb0b..54f1e9f2d 100644
--- a/cli/js/web/streams/transform_stream_default_controller.ts
+++ b/cli/js/web/streams/transform_stream_default_controller.ts
@@ -24,7 +24,7 @@ export class TransformStreamDefaultControllerImpl<I = any, O = any>
private constructor() {
throw new TypeError(
- "TransformStreamDefaultController's constructor cannot be called."
+ "TransformStreamDefaultController's constructor cannot be called.",
);
}
@@ -36,7 +36,7 @@ export class TransformStreamDefaultControllerImpl<I = any, O = any>
sym.readable
][sym.readableStreamController];
return readableStreamDefaultControllerGetDesiredSize(
- readableController as ReadableStreamDefaultControllerImpl<O>
+ readableController as ReadableStreamDefaultControllerImpl<O>,
);
}
@@ -63,13 +63,13 @@ export class TransformStreamDefaultControllerImpl<I = any, O = any>
}
[customInspect](): string {
- return `${this.constructor.name} { desiredSize: ${String(
- this.desiredSize
- )} }`;
+ return `${this.constructor.name} { desiredSize: ${
+ String(this.desiredSize)
+ } }`;
}
}
setFunctionName(
TransformStreamDefaultControllerImpl,
- "TransformStreamDefaultController"
+ "TransformStreamDefaultController",
);
diff --git a/cli/js/web/streams/writable_stream.ts b/cli/js/web/streams/writable_stream.ts
index 2dea5311b..94bedb941 100644
--- a/cli/js/web/streams/writable_stream.ts
+++ b/cli/js/web/streams/writable_stream.ts
@@ -36,7 +36,7 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
constructor(
underlyingSink: UnderlyingSink = {},
- strategy: QueuingStrategy = {}
+ strategy: QueuingStrategy = {},
) {
initializeWritableStream(this);
const size = strategy.size;
@@ -51,7 +51,7 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
this,
underlyingSink,
highWaterMark,
- sizeAlgorithm
+ sizeAlgorithm,
);
}
@@ -69,7 +69,7 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
}
if (isWritableStreamLocked(this)) {
return Promise.reject(
- new TypeError("Cannot abort a locked WritableStream.")
+ new TypeError("Cannot abort a locked WritableStream."),
);
}
return writableStreamAbort(this, reason);
@@ -81,12 +81,12 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
}
if (isWritableStreamLocked(this)) {
return Promise.reject(
- new TypeError("Cannot abort a locked WritableStream.")
+ new TypeError("Cannot abort a locked WritableStream."),
);
}
if (writableStreamCloseQueuedOrInFlight(this)) {
return Promise.reject(
- new TypeError("Cannot close an already closing WritableStream.")
+ new TypeError("Cannot close an already closing WritableStream."),
);
}
return writableStreamClose(this);
diff --git a/cli/js/web/streams/writable_stream_default_controller.ts b/cli/js/web/streams/writable_stream_default_controller.ts
index 0fe5f7ef9..960060b8f 100644
--- a/cli/js/web/streams/writable_stream_default_controller.ts
+++ b/cli/js/web/streams/writable_stream_default_controller.ts
@@ -30,7 +30,7 @@ export class WritableStreamDefaultControllerImpl<W>
private constructor() {
throw new TypeError(
- "WritableStreamDefaultController's constructor cannot be called."
+ "WritableStreamDefaultController's constructor cannot be called.",
);
}
@@ -64,5 +64,5 @@ export class WritableStreamDefaultControllerImpl<W>
setFunctionName(
WritableStreamDefaultControllerImpl,
- "WritableStreamDefaultController"
+ "WritableStreamDefaultController",
);
diff --git a/cli/js/web/streams/writable_stream_default_writer.ts b/cli/js/web/streams/writable_stream_default_writer.ts
index 2e19af923..34e664e95 100644
--- a/cli/js/web/streams/writable_stream_default_writer.ts
+++ b/cli/js/web/streams/writable_stream_default_writer.ts
@@ -68,7 +68,7 @@ export class WritableStreamDefaultWriterImpl<W>
get closed(): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject(
- new TypeError("Invalid WritableStreamDefaultWriter.")
+ new TypeError("Invalid WritableStreamDefaultWriter."),
);
}
return this[sym.closedPromise].promise;
@@ -87,7 +87,7 @@ export class WritableStreamDefaultWriterImpl<W>
get ready(): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject(
- new TypeError("Invalid WritableStreamDefaultWriter.")
+ new TypeError("Invalid WritableStreamDefaultWriter."),
);
}
return this[sym.readyPromise].promise;
@@ -97,12 +97,12 @@ export class WritableStreamDefaultWriterImpl<W>
abort(reason: any): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject(
- new TypeError("Invalid WritableStreamDefaultWriter.")
+ new TypeError("Invalid WritableStreamDefaultWriter."),
);
}
if (!this[sym.ownerWritableStream]) {
Promise.reject(
- new TypeError("WritableStreamDefaultWriter has no owner.")
+ new TypeError("WritableStreamDefaultWriter has no owner."),
);
}
return writableStreamDefaultWriterAbort(this, reason);
@@ -111,18 +111,18 @@ export class WritableStreamDefaultWriterImpl<W>
close(): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject(
- new TypeError("Invalid WritableStreamDefaultWriter.")
+ new TypeError("Invalid WritableStreamDefaultWriter."),
);
}
const stream = this[sym.ownerWritableStream];
if (!stream) {
Promise.reject(
- new TypeError("WritableStreamDefaultWriter has no owner.")
+ new TypeError("WritableStreamDefaultWriter has no owner."),
);
}
if (writableStreamCloseQueuedOrInFlight(stream)) {
Promise.reject(
- new TypeError("Stream is in an invalid state to be closed.")
+ new TypeError("Stream is in an invalid state to be closed."),
);
}
return writableStreamDefaultWriterClose(this);
@@ -143,21 +143,21 @@ export class WritableStreamDefaultWriterImpl<W>
write(chunk: W): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject(
- new TypeError("Invalid WritableStreamDefaultWriter.")
+ new TypeError("Invalid WritableStreamDefaultWriter."),
);
}
if (!this[sym.ownerWritableStream]) {
Promise.reject(
- new TypeError("WritableStreamDefaultWriter has no owner.")
+ new TypeError("WritableStreamDefaultWriter has no owner."),
);
}
return writableStreamDefaultWriterWrite(this, chunk);
}
[customInspect](): string {
- return `${this.constructor.name} { closed: Promise, desiredSize: ${String(
- this.desiredSize
- )}, ready: Promise }`;
+ return `${this.constructor.name} { closed: Promise, desiredSize: ${
+ String(this.desiredSize)
+ }, ready: Promise }`;
}
}
diff --git a/cli/js/web/text_encoding.ts b/cli/js/web/text_encoding.ts
index d225c6928..97848cb77 100644
--- a/cli/js/web/text_encoding.ts
+++ b/cli/js/web/text_encoding.ts
@@ -105,7 +105,7 @@ export function atob(s: string): string {
if (rem === 1 || /[^+/0-9A-Za-z]/.test(s)) {
throw new DOMException(
"The string to be decoded is not correctly encoded",
- "DataDecodeError"
+ "DataDecodeError",
);
}
@@ -129,7 +129,7 @@ export function btoa(s: string): string {
if (charCode > 0xff) {
throw new TypeError(
"The string to be encoded contains characters " +
- "outside of the Latin1 range."
+ "outside of the Latin1 range.",
);
}
byteArray.push(charCode);
@@ -157,7 +157,7 @@ class SingleByteDecoder implements Decoder {
constructor(
index: number[],
- { ignoreBOM = false, fatal = false }: DecoderOptions = {}
+ { ignoreBOM = false, fatal = false }: DecoderOptions = {},
) {
if (ignoreBOM) {
throw new TypeError("Ignoring the BOM is available only with utf-8.");
@@ -222,7 +222,7 @@ const decoders = new Map<string, (options: DecoderOptions) => Decoder>();
// Single byte decoders are an array of code point lookups
const encodingIndexes = new Map<string, number[]>();
-// prettier-ignore
+// deno-fmt-ignore
encodingIndexes.set("windows-1252", [
8364,
129,
@@ -358,7 +358,7 @@ for (const [key, index] of encodingIndexes) {
key,
(options: DecoderOptions): SingleByteDecoder => {
return new SingleByteDecoder(index, options);
- }
+ },
);
}
@@ -442,7 +442,7 @@ export class TextDecoder {
const encoding = encodings.get(label);
if (!encoding) {
throw new RangeError(
- `The encoding label provided ('${label}') is invalid.`
+ `The encoding label provided ('${label}') is invalid.`,
);
}
if (!decoders.has(encoding) && encoding !== "utf-8") {
@@ -453,7 +453,7 @@ export class TextDecoder {
decode(
input?: BufferSource,
- options: TextDecodeOptions = { stream: false }
+ options: TextDecodeOptions = { stream: false },
): string {
if (options.stream) {
throw new TypeError("Stream not supported.");
diff --git a/cli/js/web/timers.ts b/cli/js/web/timers.ts
index e8eacb402..71aef5f85 100644
--- a/cli/js/web/timers.ts
+++ b/cli/js/web/timers.ts
@@ -149,7 +149,7 @@ function unschedule(timer: Timer): void {
const nextDueNode: DueNode | null = dueTree.min();
setOrClearGlobalTimeout(
nextDueNode && nextDueNode.due,
- OriginalDate.now()
+ OriginalDate.now(),
);
}
} else {
@@ -203,7 +203,7 @@ function setTimer(
cb: (...args: Args) => void,
delay: number,
args: Args,
- repeat: boolean
+ repeat: boolean,
): number {
// Bind `args` to the callback and bind `this` to globalThis(global).
const callback: () => void = cb.bind(globalThis, ...args);
@@ -215,7 +215,7 @@ function setTimer(
console.warn(
`${delay} does not fit into` +
" a 32-bit signed integer." +
- "\nTimeout duration was set to 1."
+ "\nTimeout duration was set to 1.",
);
delay = 1;
}
diff --git a/cli/js/web/url.ts b/cli/js/web/url.ts
index 544168d80..f466f9583 100644
--- a/cli/js/web/url.ts
+++ b/cli/js/web/url.ts
@@ -86,14 +86,14 @@ function parse(url: string, isBase = true): URLParts | undefined {
[restAuthentication, restAuthority] = takePattern(restAuthority, /^(.*)@/);
[parts.username, restAuthentication] = takePattern(
restAuthentication,
- /^([^:]*)/
+ /^([^:]*)/,
);
parts.username = encodeUserinfo(parts.username);
[parts.password] = takePattern(restAuthentication, /^:(.*)/);
parts.password = encodeUserinfo(parts.password);
[parts.hostname, restAuthority] = takePattern(
restAuthority,
- /^(\[[0-9a-fA-F.:]{2,}\]|[^:]+)/
+ /^(\[[0-9a-fA-F.:]{2,}\]|[^:]+)/,
);
[parts.port] = takePattern(restAuthority, /^:(.*)/);
if (!isValidPort(parts.port)) {
@@ -122,8 +122,7 @@ function parse(url: string, isBase = true): URLParts | undefined {
function generateUUID(): string {
return "00000000-0000-4000-8000-000000000000".replace(/[0]/g, (): string =>
// random integer from 0 to 15 as a hex digit.
- (getRandomValues(new Uint8Array(1))[0] % 16).toString(16)
- );
+ (getRandomValues(new Uint8Array(1))[0] % 16).toString(16));
}
// Keep it outside of URL to avoid any attempts of access.
@@ -174,7 +173,7 @@ function normalizePath(path: string, isFilePath = false): string {
function resolvePathFromBase(
path: string,
basePath: string,
- isFilePath = false
+ isFilePath = false,
): string {
let normalizedPath = normalizePath(path, isFilePath);
let normalizedBasePath = normalizePath(basePath, isFilePath);
@@ -185,11 +184,11 @@ function resolvePathFromBase(
let baseDriveLetter: string;
[driveLetter, normalizedPath] = takePattern(
normalizedPath,
- /^(\/[A-Za-z]:)(?=\/)/
+ /^(\/[A-Za-z]:)(?=\/)/,
);
[baseDriveLetter, normalizedBasePath] = takePattern(
normalizedBasePath,
- /^(\/[A-Za-z]:)(?=\/)/
+ /^(\/[A-Za-z]:)(?=\/)/,
);
driveLetterPrefix = driveLetter || baseDriveLetter;
}
@@ -306,10 +305,9 @@ export class URLImpl implements URL {
}
get href(): string {
- const authentication =
- this.username || this.password
- ? `${this.username}${this.password ? ":" + this.password : ""}@`
- : "";
+ const authentication = this.username || this.password
+ ? `${this.username}${this.password ? ":" + this.password : ""}@`
+ : "";
const host = this.host;
const slashes = host ? "//" : parts.get(this)!.slashes;
let pathname = this.pathname;
@@ -421,8 +419,9 @@ export class URLImpl implements URL {
}
}
- const urlParts =
- typeof url === "string" ? parse(url, !baseParts) : parts.get(url);
+ const urlParts = typeof url === "string"
+ ? parse(url, !baseParts)
+ : parts.get(url);
if (urlParts == undefined) {
throw new TypeError("Invalid URL.");
}
@@ -441,7 +440,7 @@ export class URLImpl implements URL {
path: resolvePathFromBase(
urlParts.path,
baseParts.path || "/",
- baseParts.protocol == "file"
+ baseParts.protocol == "file",
),
query: urlParts.query,
hash: urlParts.hash,
@@ -522,28 +521,28 @@ function charInC0ControlSet(c: string): boolean {
}
function charInSearchSet(c: string): boolean {
- // prettier-ignore
+ // deno-fmt-ignore
return charInC0ControlSet(c) || ["\u0020", "\u0022", "\u0023", "\u0027", "\u003C", "\u003E"].includes(c) || c > "\u007E";
}
function charInFragmentSet(c: string): boolean {
- // prettier-ignore
+ // deno-fmt-ignore
return charInC0ControlSet(c) || ["\u0020", "\u0022", "\u003C", "\u003E", "\u0060"].includes(c);
}
function charInPathSet(c: string): boolean {
- // prettier-ignore
+ // deno-fmt-ignore
return charInFragmentSet(c) || ["\u0023", "\u003F", "\u007B", "\u007D"].includes(c);
}
function charInUserinfoSet(c: string): boolean {
// "\u0027" ("'") seemingly isn't in the spec, but matches Chrome and Firefox.
- // prettier-ignore
+ // deno-fmt-ignore
return charInPathSet(c) || ["\u0027", "\u002F", "\u003A", "\u003B", "\u003D", "\u0040", "\u005B", "\u005C", "\u005D", "\u005E", "\u007C"].includes(c);
}
function charIsForbiddenInHost(c: string): boolean {
- // prettier-ignore
+ // deno-fmt-ignore
return ["\u0000", "\u0009", "\u000A", "\u000D", "\u0020", "\u0023", "\u0025", "\u002F", "\u003A", "\u003C", "\u003E", "\u003F", "\u0040", "\u005B", "\u005C", "\u005D", "\u005E"].includes(c);
}
@@ -591,8 +590,9 @@ function encodeHostname(s: string, isSpecial = true): string {
if (result.match(/%(?![0-9A-Fa-f]{2})/) != null) {
throw new TypeError("Invalid hostname.");
}
- result = result.replace(/%(.{2})/g, (_, hex) =>
- String.fromCodePoint(Number(`0x${hex}`))
+ result = result.replace(
+ /%(.{2})/g,
+ (_, hex) => String.fromCodePoint(Number(`0x${hex}`)),
);
// IDNA domain to ASCII.
diff --git a/cli/js/web/url_search_params.ts b/cli/js/web/url_search_params.ts
index b4d199fbc..f3e247522 100644
--- a/cli/js/web/url_search_params.ts
+++ b/cli/js/web/url_search_params.ts
@@ -57,14 +57,14 @@ export class URLSearchParamsImpl implements URLSearchParams {
};
#handleArrayInitialization = (
- init: string[][] | Iterable<[string, string]>
+ init: string[][] | Iterable<[string, string]>,
): void => {
// Overload: sequence<sequence<USVString>>
for (const tuple of init) {
// If pair does not contain exactly two items, then throw a TypeError.
if (tuple.length !== 2) {
throw new TypeError(
- "URLSearchParams.constructor tuple array argument must only contain pair elements"
+ "URLSearchParams.constructor tuple array argument must only contain pair elements",
);
}
this.#append(tuple[0], tuple[1]);
@@ -175,7 +175,7 @@ export class URLSearchParamsImpl implements URLSearchParams {
forEach(
callbackfn: (value: string, key: string, parent: this) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- thisArg?: any
+ thisArg?: any,
): void {
requiredArguments("URLSearchParams.forEach", arguments.length, 1);
@@ -212,7 +212,7 @@ export class URLSearchParamsImpl implements URLSearchParams {
return this.#params
.map(
(tuple) =>
- `${encodeURIComponent(tuple[0])}=${encodeURIComponent(tuple[1])}`
+ `${encodeURIComponent(tuple[0])}=${encodeURIComponent(tuple[1])}`,
)
.join("&");
}
diff --git a/cli/js/web/util.ts b/cli/js/web/util.ts
index 281048cd8..3165c37a7 100644
--- a/cli/js/web/util.ts
+++ b/cli/js/web/util.ts
@@ -27,7 +27,7 @@ export function isInvalidDate(x: Date): boolean {
export function requiredArguments(
name: string,
length: number,
- required: number
+ required: number,
): void {
if (length < required) {
const errMsg = `${name} requires at least ${required} argument${
@@ -43,7 +43,7 @@ export function immutableDefine(
o: any,
p: string | number | symbol,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- value: any
+ value: any,
): void {
Object.defineProperty(o, p, {
value,
@@ -64,7 +64,7 @@ export function hasOwnProperty(obj: unknown, v: PropertyKey): boolean {
*
* @internal */
export function isIterable<T, P extends keyof T, K extends T[P]>(
- o: T
+ o: T,
): o is T & Iterable<[P, K]> {
// checks for null and undefined
if (o == null) {
@@ -81,12 +81,12 @@ function cloneArrayBuffer(
srcBuffer: ArrayBufferLike,
srcByteOffset: number,
srcLength: number,
- cloneConstructor: ArrayBufferConstructor | SharedArrayBufferConstructor
+ cloneConstructor: ArrayBufferConstructor | SharedArrayBufferConstructor,
): InstanceType<typeof cloneConstructor> {
// this function fudges the return type but SharedArrayBuffer is disabled for a while anyway
return srcBuffer.slice(
srcByteOffset,
- srcByteOffset + srcLength
+ srcByteOffset + srcLength,
) as InstanceType<typeof cloneConstructor>;
}
@@ -122,7 +122,7 @@ export function cloneValue(value: any): any {
value,
0,
value.byteLength,
- ArrayBuffer
+ ArrayBuffer,
);
objectCloneMemo.set(value, cloned);
return cloned;
@@ -142,7 +142,7 @@ export function cloneValue(value: any): any {
return new (value.constructor as DataViewConstructor)(
clonedBuffer,
value.byteOffset,
- length
+ length,
);
}
if (value instanceof Map) {
@@ -183,7 +183,7 @@ interface GenericConstructor<T = any> {
* are not. */
export function defineEnumerableProps(
Ctor: GenericConstructor,
- props: string[]
+ props: string[],
): void {
for (const prop of props) {
Reflect.defineProperty(Ctor.prototype, prop, { enumerable: true });
diff --git a/cli/js/web/workers.ts b/cli/js/web/workers.ts
index cc40f104c..5fd63477a 100644
--- a/cli/js/web/workers.ts
+++ b/cli/js/web/workers.ts
@@ -94,7 +94,7 @@ export class WorkerImpl extends EventTarget implements Worker {
if (type !== "module") {
throw new Error(
- 'Not yet implemented: only "module" type workers are supported'
+ 'Not yet implemented: only "module" type workers are supported',
);
}
@@ -125,7 +125,7 @@ export class WorkerImpl extends EventTarget implements Worker {
hasSourceCode,
sourceCode,
useDenoNamespace,
- options?.name
+ options?.name,
);
this.#id = id;
this.#poll();
@@ -225,7 +225,7 @@ export class WorkerImpl extends EventTarget implements Worker {
postMessage(message: any, transferOrOptions?: any): void {
if (transferOrOptions) {
throw new Error(
- "Not yet implemented: `transfer` and `options` are not supported."
+ "Not yet implemented: `transfer` and `options` are not supported.",
);
}