diff --git a/bindings/globals/flow/console.js.flow b/bindings/globals/flow/console.js.flow index 3066e09a..972a0e2a 100644 --- a/bindings/globals/flow/console.js.flow +++ b/bindings/globals/flow/console.js.flow @@ -2,27 +2,39 @@ interface Console { log(...values: any[]): void; + info(...values: any[]): void; + dir(...values: any[]): void; + dirxml(...values: any[]): void, warn(...values: any[]): void; + error(...values: any[]): void; + debug(...values: any[]): void; assert(assertion: boolean, ...values: any[]): void; + clear(): void; + trace(...values: any[]): void; group(...values: any[]): void; + groupCollapsed(...values: any[]): void; + groupEnd(): void; count(label?: string): void; + countReset(label?: string): void; time(label?: string): void; + timeLog(label?: string, ...values: any[]): void; + timeEnd(label?: string): void; table(data: any, columns?: string[]): void; diff --git a/bindings/globals/flow/timers.js.flow b/bindings/globals/flow/timers.js.flow index f40c36c6..f842b2ce 100644 --- a/bindings/globals/flow/timers.js.flow +++ b/bindings/globals/flow/timers.js.flow @@ -2,9 +2,11 @@ // TODO: Improve Typing for Arguments declare function setTimeout(callback: (...arguments: T[]) => void, duration?: number, ...arguments: T[]): number; + declare function setInterval(callback: (...arguments: T[]) => void, duration?: number, ...arguments: T[]): number; declare function clearTimeout(id: number): void; + declare function clearInterval(id: number): void; declare function queueMacrotask(callback: () => void): void; diff --git a/bindings/globals/typescript/abort.d.ts b/bindings/globals/typescript/abort.d.ts index 565184fc..390bf1e1 100644 --- a/bindings/globals/typescript/abort.d.ts +++ b/bindings/globals/typescript/abort.d.ts @@ -2,15 +2,18 @@ declare class AbortController { constructor(); get signal(): AbortSignal; + abort(reason?: any): void; } declare class AbortSignal { - static abort(reason?: any): AbortSignal; - static timeout(time: number): AbortSignal; - get aborted(): boolean; + get reason(): any; + static abort(reason?: any): AbortSignal; + + static timeout(time: number): AbortSignal; + throwIfAborted(): void; } diff --git a/bindings/globals/typescript/console.d.ts b/bindings/globals/typescript/console.d.ts index 33872a35..0dd464ca 100644 --- a/bindings/globals/typescript/console.d.ts +++ b/bindings/globals/typescript/console.d.ts @@ -1,26 +1,38 @@ declare namespace console { function log(...values: any[]): void; + function info(...values: any[]): void; + function dir(...values: any[]): void; + function dirxml(...values: any[]): void; function warn(...values: any[]): void; + function error(...values: any[]): void; + function debug(...values: any[]): void; function assert(assertion: boolean, ...values: any[]): void; + function clear(): void; + function trace(...values: any[]): void; function group(...values: any[]): void; + function groupCollapsed(...values: any[]): void; + function groupEnd(): void; function count(label?: string): void; + function countReset(label?: string): void; function time(label?: string): void; + function timeLog(label?: string, ...values: any[]): void; + function timeEnd(label?: string): void; function table(data: any, columns?: string[]): void; diff --git a/bindings/globals/typescript/encoding.d.ts b/bindings/globals/typescript/encoding.d.ts index 3c193c56..65877c74 100644 --- a/bindings/globals/typescript/encoding.d.ts +++ b/bindings/globals/typescript/encoding.d.ts @@ -11,7 +11,9 @@ declare class TextDecoder { constructor(label?: string, options?: DecoderOptions); get encoding(): string; + get fatal(): boolean; + get ignoreBOM(): boolean; decode(buffer: BufferSource, options?: DecodeOptions): string; @@ -26,5 +28,6 @@ declare class TextEncoder { get encoding(): string; encode(input?: string): Uint8Array; + encodeInto(source: string, destination: Uint8Array): EncodeResult; } diff --git a/bindings/globals/typescript/fetch.d.ts b/bindings/globals/typescript/fetch.d.ts index 7757c9f4..fa0c05d7 100644 --- a/bindings/globals/typescript/fetch.d.ts +++ b/bindings/globals/typescript/fetch.d.ts @@ -1,16 +1,21 @@ declare type HeadersInit = Headers | [string, string][] | Record; declare class Headers implements Iterable<[string, string]> { - constructor(init?: HeadersInit); + constructor(init?: HeadersInit); - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getSetCookie(): string[]; - has(name: string): boolean; - set(name: string, value: string): void; + append(name: string, value: string): void; - [Symbol.iterator](): Iterator<[string, string]>; + delete(name: string): void; + + get(name: string): string | null; + + getSetCookie(): string[]; + + has(name: string): boolean; + + set(name: string, value: string): void; + + [Symbol.iterator](): Iterator<[string, string]>; } declare type BodyInit = BufferSource | string; @@ -18,37 +23,37 @@ declare type BodyInit = BufferSource | string; declare type RequestInfo = Request | string; declare type RequestDestination = - "" - | "audio" - | "audioworklet" - | "document" - | "embed" - | "font" - | "frame" - | "iframe" - | "image" - | "manifest" - | "object" - | "paintworklet" - | "report" - | "script" - | "sharedworker" - | "style" - | "track" - | "video" - | "worker" - | "xslt"; + "" + | "audio" + | "audioworklet" + | "document" + | "embed" + | "font" + | "frame" + | "iframe" + | "image" + | "manifest" + | "object" + | "paintworklet" + | "report" + | "script" + | "sharedworker" + | "style" + | "track" + | "video" + | "worker" + | "xslt"; declare type ReferrerPolicy = - "" - | "no-referrer" - | "no-referrer-when-downgrade" - | "same-origin" - | "origin" - | "strict-origin" - | "origin-when-cross-origin" - | "strict-origin-when-cross-origin" - | "unsafe-url"; + "" + | "no-referrer" + | "no-referrer-when-downgrade" + | "same-origin" + | "origin" + | "strict-origin" + | "origin-when-cross-origin" + | "strict-origin-when-cross-origin" + | "unsafe-url"; declare type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; @@ -63,78 +68,93 @@ declare type RequestDuplex = "half"; declare type RequestPriority = "high" | "low" | "auto"; declare interface RequestInit { - method?: string; - headers?: HeadersInit; - body?: BodyInit; + method?: string; + headers?: HeadersInit; + body?: BodyInit; - referrer?: string; - referrerPolicy?: ReferrerPolicy; + referrer?: string; + referrerPolicy?: ReferrerPolicy; - mode?: RequestMode; - credentials?: RequestCredentials; - cache?: RequestCache; - redirect?: RequestRedirect; + mode?: RequestMode; + credentials?: RequestCredentials; + cache?: RequestCache; + redirect?: RequestRedirect; - integrity?: string; - keepalive?: boolean; - signal?: AbortSignal; + integrity?: string; + keepalive?: boolean; + signal?: AbortSignal; - duplex?: RequestDuplex; - priority?: RequestPriority; - window?: null; + duplex?: RequestDuplex; + priority?: RequestPriority; + window?: null; } declare class Request { - constructor(input: RequestInfo, init?: RequestInit); + constructor(input: RequestInfo, init?: RequestInit); + + get method(): string; + + get url(): string; + + get headers(): Headers; + + get destination(): RequestDestination; + + get referrer(): string; - get method(): string; - get url(): string; - get headers(): Headers; + get referrerPolicy(): ReferrerPolicy; - get destination(): RequestDestination; - get referrer(): string; - get referrerPolicy(): ReferrerPolicy; + get mode(): RequestMode; - get mode(): RequestMode; - get credentials(): RequestCredentials; - get cache(): RequestCache; - get redirect(): RequestRedirect; + get credentials(): RequestCredentials; - get integrity(): string; - get keepalive(): boolean; + get cache(): RequestCache; - get isReloadNavigation(): string; - get isHistoryNavigation(): string; + get redirect(): RequestRedirect; - get signal(): AbortSignal; - get duplex(): RequestDuplex; + get integrity(): string; + + get keepalive(): boolean; + + get isReloadNavigation(): string; + + get isHistoryNavigation(): string; + + get signal(): AbortSignal; + + get duplex(): RequestDuplex; } declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; + status?: number; + statusText?: string; + headers?: HeadersInit; } declare type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; declare class Response { - constructor(body?: BodyInit, init?: ResponseInit); + constructor(body?: BodyInit, init?: ResponseInit); + + get type(): ResponseType; + + get url(): string; + + get redirected(): boolean; + + get status(): number; + + get ok(): boolean; - get type(): ResponseType; + get statusText(): string; - get url(): string; - get redirected(): boolean; + get headers(): Headers; - get status(): number; - get ok(): boolean; - get statusText(): string; + get bodyUsed(): boolean; - get headers(): Headers; + arrayBuffer(): Promise; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; + text(): Promise; } declare function fetch(input: RequestInfo, init?: RequestInit): Promise; diff --git a/bindings/globals/typescript/timers.d.ts b/bindings/globals/typescript/timers.d.ts index 4e55e437..9ac1cf6e 100644 --- a/bindings/globals/typescript/timers.d.ts +++ b/bindings/globals/typescript/timers.d.ts @@ -1,7 +1,9 @@ declare function setTimeout(callback: (...arguments: [...T]) => void, duration?: number, ...arguments: [...T]): number; + declare function setInterval(callback: (...arguments: [...T]) => void, duration?: number, ...arguments: [...T]): number; declare function clearTimeout(id: number): void; + declare function clearInterval(id: number): void; declare function queueMacrotask(callback: () => void): void; diff --git a/bindings/globals/typescript/url.d.ts b/bindings/globals/typescript/url.d.ts index 6ec8b028..5cb5f396 100644 --- a/bindings/globals/typescript/url.d.ts +++ b/bindings/globals/typescript/url.d.ts @@ -1,43 +1,54 @@ declare class URL { constructor(url: string, base?: string); - static canParse(url: string, base?: string): boolean; - get href(): string; + set href(href: string); get origin(): string; get protocol(): string; + set protocol(protocol: string); get username(): string; + set username(username: string); get password(): string | null; + set password(password: string); get host(): string | null; + set host(host: string); get hostname(): string | null; + set hostname(hostname: string); get port(): number | null; + set port(port: number); get pathname(): string; + set pathname(path: string); get search(): string | null; + set search(string: string); get searchParams(): URLSearchParams; get hash(): string | null; + set hash(hash: string); + static canParse(url: string, base?: string): boolean; + toString(): string; + toJSON(): string; } @@ -47,15 +58,21 @@ declare class URLSearchParams implements Iterable<[string, string]> { get size(): number; append(name: string, value: string): void; + delete(name: string, value?: string): void; + get(name: string): string | null; + getAll(name: string): string[]; + has(name: string, value?: string): boolean; + set(name: string, value: string): void; sort(): void; [Symbol.iterator](): Iterator<[string, string]>; + toString(): string; } diff --git a/bindings/modules/flow/assert.js.flow b/bindings/modules/flow/assert.js.flow index e9d47f34..584468d3 100644 --- a/bindings/modules/flow/assert.js.flow +++ b/bindings/modules/flow/assert.js.flow @@ -2,8 +2,11 @@ declare module "assert" { declare export function ok(assertion?: boolean, message?: string): void; + declare export function equal(actual: any, expected: any, message?: string): void; + declare export function throws(func: () => void, message?: string): void; + declare export function fail(message?: string): void; declare export default { diff --git a/bindings/modules/flow/fs.js.flow b/bindings/modules/flow/fs.js.flow index 080937fa..eb7916ea 100644 --- a/bindings/modules/flow/fs.js.flow +++ b/bindings/modules/flow/fs.js.flow @@ -2,17 +2,29 @@ declare module "fs" { declare export function readBinary(path: string): Promise; + declare export function readString(path: string): Promise; + declare export function readDir(path: string): Promise; + declare export function write(path: string, contents: string): Promise; + declare export function createDir(path: string): Promise; + declare export function createDirRecursive(path: string): Promise; + declare export function removeFile(path: string): Promise; + declare export function removeDir(path: string): Promise; + declare export function removeDirRecursive(path: string): Promise; + declare export function copy(from: string, to: string): Promise; + declare export function rename(from: string, to: string): Promise; + declare export function softLink(original: string, link: string): Promise; + declare export function hardLink(original: string, link: string): Promise; declare export var sync: { diff --git a/bindings/modules/flow/path.js.flow b/bindings/modules/flow/path.js.flow index 1b2573d3..60f74cf0 100644 --- a/bindings/modules/flow/path.js.flow +++ b/bindings/modules/flow/path.js.flow @@ -2,17 +2,29 @@ declare module "path" { declare export function join(...segments: string[]): string; + declare export function stripPrefix(path: string, prefix: string): string; + declare export function fileStem(path: string): string | null; + declare export function parent(path: string): string | null; + declare export function fileName(path: string): string | null; + declare export function extension(path: string): string | null; + declare export function withFileName(path: string, fileName: string): string; + declare export function withExtension(path: string, extension: string): string; + declare export function isAbsolute(path: string): boolean; + declare export function isRelative(path: string): boolean; + declare export function hasRoot(path: string): boolean; + declare export function startsWith(path: string, prefix: string): boolean; + declare export function endsWith(path: string, suffix: string): boolean; declare export var separator: string; diff --git a/bindings/modules/flow/url.js.flow b/bindings/modules/flow/url.js.flow index e39b66f8..51c8c125 100644 --- a/bindings/modules/flow/url.js.flow +++ b/bindings/modules/flow/url.js.flow @@ -2,6 +2,7 @@ declare module "url" { declare export function domainToASCII(domain: string, strict?: boolean): string; + declare export function domainToUnicode(domain: string): string; declare export default { diff --git a/bindings/modules/typescript/assert.d.ts b/bindings/modules/typescript/assert.d.ts index 6f247bb8..716cbb84 100644 --- a/bindings/modules/typescript/assert.d.ts +++ b/bindings/modules/typescript/assert.d.ts @@ -1,7 +1,10 @@ declare module "assert" { export function ok(assertion?: boolean, message?: string): void; + export function equals(actual: any, expected: any, message?: string): void; + export function throws(func: () => void, message?: string): void; + export function fail(message?: string): void; namespace Assert { diff --git a/bindings/modules/typescript/fs.d.ts b/bindings/modules/typescript/fs.d.ts index 0d805aa2..4e836731 100644 --- a/bindings/modules/typescript/fs.d.ts +++ b/bindings/modules/typescript/fs.d.ts @@ -1,16 +1,28 @@ declare module "fs" { export function readBinary(path: string): Promise; + export function readString(path: string): Promise; + export function readDir(path: string): Promise; + export function write(path: string, contents: string): Promise; + export function createDir(path: string): Promise; + export function createDirRecursive(path: string): Promise; + export function removeFile(path: string): Promise; + export function removeDir(path: string): Promise; + export function removeDirRecursive(path: string): Promise; + export function copy(from: string, to: string): Promise; + export function rename(from: string, to: string): Promise; + export function softLink(original: string, link: string): Promise; + export function hardLink(original: string, link: string): Promise; export const sync: { diff --git a/bindings/modules/typescript/path.d.ts b/bindings/modules/typescript/path.d.ts index 2eb8206a..07180aac 100644 --- a/bindings/modules/typescript/path.d.ts +++ b/bindings/modules/typescript/path.d.ts @@ -1,16 +1,28 @@ declare module "path" { export function join(...segments: string[]): string; + export function stripPrefix(path: string, prefix: string): string; + export function fileStem(path: string): string | null; + export function parent(path: string): string | null; + export function fileName(path: string): string | null; + export function extension(path: string): string | null; + export function withFileName(path: string, fileName: string): string; + export function withExtension(path: string, extension: string): string; + export function isAbsolute(path: string): boolean; + export function isRelative(path: string): boolean; + export function hasRoot(path: string): boolean; + export function startsWith(path: string, prefix: string): boolean; + export function endsWith(path: string, suffix: string): boolean; export const separator: string; diff --git a/bindings/modules/typescript/url.d.ts b/bindings/modules/typescript/url.d.ts index c2e8e51e..5023bb75 100644 --- a/bindings/modules/typescript/url.d.ts +++ b/bindings/modules/typescript/url.d.ts @@ -1,5 +1,6 @@ declare module "url" { export function domainToASCII(domain: string, strict?: boolean): string; + export function domainToUnicode(domain: string): string; namespace Url { diff --git a/bindings/tsconfig.json b/bindings/tsconfig.json index afc372e4..2539f5d9 100644 --- a/bindings/tsconfig.json +++ b/bindings/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "es2022", - "lib": ["es2022"], - + "lib": [ + "es2022" + ], "module": "es2022", "strict": true, - - "skipLibCheck": false, + "skipLibCheck": false } } diff --git a/runtime/src/globals/fetch/request/options.rs b/runtime/src/globals/fetch/request/options.rs index 0a1fb6c4..27defe85 100644 --- a/runtime/src/globals/fetch/request/options.rs +++ b/runtime/src/globals/fetch/request/options.rs @@ -13,7 +13,7 @@ use mozjs::jsval::JSVal; use url::Url; use ion::{Context, Error, ErrorKind, Result, Value}; -use ion::conversions::{FromValue, ToValue}; +use ion::conversions::FromValue; use crate::globals::fetch::body::FetchBody; use crate::globals::fetch::header::HeadersInit;