@types/node 10.12.20 → 10.12.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/timers.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ declare module "timers" {
2
+ function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
3
+ namespace setTimeout {
4
+ function __promisify__(ms: number): Promise<void>;
5
+ function __promisify__<T>(ms: number, value: T): Promise<T>;
6
+ }
7
+ function clearTimeout(timeoutId: NodeJS.Timeout): void;
8
+ function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
9
+ function clearInterval(intervalId: NodeJS.Timeout): void;
10
+ function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
11
+ namespace setImmediate {
12
+ function __promisify__(): Promise<void>;
13
+ function __promisify__<T>(value: T): Promise<T>;
14
+ }
15
+ function clearImmediate(immediateId: NodeJS.Immediate): void;
16
+ }
node/tls.d.ts ADDED
@@ -0,0 +1,371 @@
1
+ declare module "tls" {
2
+ import * as crypto from "crypto";
3
+ import * as dns from "dns";
4
+ import * as net from "net";
5
+ import * as stream from "stream";
6
+
7
+ const CLIENT_RENEG_LIMIT: number;
8
+ const CLIENT_RENEG_WINDOW: number;
9
+
10
+ interface Certificate {
11
+ /**
12
+ * Country code.
13
+ */
14
+ C: string;
15
+ /**
16
+ * Street.
17
+ */
18
+ ST: string;
19
+ /**
20
+ * Locality.
21
+ */
22
+ L: string;
23
+ /**
24
+ * Organization.
25
+ */
26
+ O: string;
27
+ /**
28
+ * Organizational unit.
29
+ */
30
+ OU: string;
31
+ /**
32
+ * Common name.
33
+ */
34
+ CN: string;
35
+ }
36
+
37
+ interface PeerCertificate {
38
+ subject: Certificate;
39
+ issuer: Certificate;
40
+ subjectaltname: string;
41
+ infoAccess: { [index: string]: string[] | undefined };
42
+ modulus: string;
43
+ exponent: string;
44
+ valid_from: string;
45
+ valid_to: string;
46
+ fingerprint: string;
47
+ ext_key_usage: string[];
48
+ serialNumber: string;
49
+ raw: Buffer;
50
+ }
51
+
52
+ interface DetailedPeerCertificate extends PeerCertificate {
53
+ issuerCertificate: DetailedPeerCertificate;
54
+ }
55
+
56
+ interface CipherNameAndProtocol {
57
+ /**
58
+ * The cipher name.
59
+ */
60
+ name: string;
61
+ /**
62
+ * SSL/TLS protocol version.
63
+ */
64
+ version: string;
65
+ }
66
+
67
+ class TLSSocket extends net.Socket {
68
+ /**
69
+ * Construct a new tls.TLSSocket object from an existing TCP socket.
70
+ */
71
+ constructor(socket: net.Socket, options?: {
72
+ /**
73
+ * An optional TLS context object from tls.createSecureContext()
74
+ */
75
+ secureContext?: SecureContext,
76
+ /**
77
+ * If true the TLS socket will be instantiated in server-mode.
78
+ * Defaults to false.
79
+ */
80
+ isServer?: boolean,
81
+ /**
82
+ * An optional net.Server instance.
83
+ */
84
+ server?: net.Server,
85
+ /**
86
+ * If true the server will request a certificate from clients that
87
+ * connect and attempt to verify that certificate. Defaults to
88
+ * false.
89
+ */
90
+ requestCert?: boolean,
91
+ /**
92
+ * If true the server will reject any connection which is not
93
+ * authorized with the list of supplied CAs. This option only has an
94
+ * effect if requestCert is true. Defaults to false.
95
+ */
96
+ rejectUnauthorized?: boolean,
97
+ /**
98
+ * An array of strings or a Buffer naming possible NPN protocols.
99
+ * (Protocols should be ordered by their priority.)
100
+ */
101
+ NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array,
102
+ /**
103
+ * An array of strings or a Buffer naming possible ALPN protocols.
104
+ * (Protocols should be ordered by their priority.) When the server
105
+ * receives both NPN and ALPN extensions from the client, ALPN takes
106
+ * precedence over NPN and the server does not send an NPN extension
107
+ * to the client.
108
+ */
109
+ ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array,
110
+ /**
111
+ * SNICallback(servername, cb) <Function> A function that will be
112
+ * called if the client supports SNI TLS extension. Two arguments
113
+ * will be passed when called: servername and cb. SNICallback should
114
+ * invoke cb(null, ctx), where ctx is a SecureContext instance.
115
+ * (tls.createSecureContext(...) can be used to get a proper
116
+ * SecureContext.) If SNICallback wasn't provided the default callback
117
+ * with high-level API will be used (see below).
118
+ */
119
+ SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void,
120
+ /**
121
+ * An optional Buffer instance containing a TLS session.
122
+ */
123
+ session?: Buffer,
124
+ /**
125
+ * If true, specifies that the OCSP status request extension will be
126
+ * added to the client hello and an 'OCSPResponse' event will be
127
+ * emitted on the socket before establishing a secure communication
128
+ */
129
+ requestOCSP?: boolean
130
+ });
131
+
132
+ /**
133
+ * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false.
134
+ */
135
+ authorized: boolean;
136
+ /**
137
+ * The reason why the peer's certificate has not been verified.
138
+ * This property becomes available only when tlsSocket.authorized === false.
139
+ */
140
+ authorizationError: Error;
141
+ /**
142
+ * Static boolean value, always true.
143
+ * May be used to distinguish TLS sockets from regular ones.
144
+ */
145
+ encrypted: boolean;
146
+
147
+ /**
148
+ * String containing the selected ALPN protocol.
149
+ * When ALPN has no selected protocol, tlsSocket.alpnProtocol equals false.
150
+ */
151
+ alpnProtocol?: string;
152
+
153
+ /**
154
+ * Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
155
+ * @returns Returns an object representing the cipher name
156
+ * and the SSL/TLS protocol version of the current connection.
157
+ */
158
+ getCipher(): CipherNameAndProtocol;
159
+ /**
160
+ * Returns an object representing the peer's certificate.
161
+ * The returned object has some properties corresponding to the field of the certificate.
162
+ * If detailed argument is true the full chain with issuer property will be returned,
163
+ * if false only the top certificate without issuer property.
164
+ * If the peer does not provide a certificate, it returns null or an empty object.
165
+ * @param detailed - If true; the full chain with issuer property will be returned.
166
+ * @returns An object representing the peer's certificate.
167
+ */
168
+ getPeerCertificate(detailed: true): DetailedPeerCertificate;
169
+ getPeerCertificate(detailed?: false): PeerCertificate;
170
+ getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
171
+ /**
172
+ * Returns a string containing the negotiated SSL/TLS protocol version of the current connection.
173
+ * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process.
174
+ * The value `null` will be returned for server sockets or disconnected client sockets.
175
+ * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information.
176
+ * @returns negotiated SSL/TLS protocol version of the current connection
177
+ */
178
+ getProtocol(): string | null;
179
+ /**
180
+ * Could be used to speed up handshake establishment when reconnecting to the server.
181
+ * @returns ASN.1 encoded TLS session or undefined if none was negotiated.
182
+ */
183
+ getSession(): any;
184
+ /**
185
+ * NOTE: Works only with client TLS sockets.
186
+ * Useful only for debugging, for session reuse provide session option to tls.connect().
187
+ * @returns TLS session ticket or undefined if none was negotiated.
188
+ */
189
+ getTLSTicket(): any;
190
+ /**
191
+ * Initiate TLS renegotiation process.
192
+ *
193
+ * NOTE: Can be used to request peer's certificate after the secure connection has been established.
194
+ * ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.
195
+ * @param options - The options may contain the following fields: rejectUnauthorized,
196
+ * requestCert (See tls.createServer() for details).
197
+ * @param callback - callback(err) will be executed with null as err, once the renegotiation
198
+ * is successfully completed.
199
+ */
200
+ renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any;
201
+ /**
202
+ * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512).
203
+ * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by
204
+ * the TLS layer until the entire fragment is received and its integrity is verified;
205
+ * large fragments can span multiple roundtrips, and their processing can be delayed due to packet
206
+ * loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead,
207
+ * which may decrease overall server throughput.
208
+ * @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512).
209
+ * @returns Returns true on success, false otherwise.
210
+ */
211
+ setMaxSendFragment(size: number): boolean;
212
+
213
+ /**
214
+ * events.EventEmitter
215
+ * 1. OCSPResponse
216
+ * 2. secureConnect
217
+ */
218
+ addListener(event: string, listener: (...args: any[]) => void): this;
219
+ addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
220
+ addListener(event: "secureConnect", listener: () => void): this;
221
+
222
+ emit(event: string | symbol, ...args: any[]): boolean;
223
+ emit(event: "OCSPResponse", response: Buffer): boolean;
224
+ emit(event: "secureConnect"): boolean;
225
+
226
+ on(event: string, listener: (...args: any[]) => void): this;
227
+ on(event: "OCSPResponse", listener: (response: Buffer) => void): this;
228
+ on(event: "secureConnect", listener: () => void): this;
229
+
230
+ once(event: string, listener: (...args: any[]) => void): this;
231
+ once(event: "OCSPResponse", listener: (response: Buffer) => void): this;
232
+ once(event: "secureConnect", listener: () => void): this;
233
+
234
+ prependListener(event: string, listener: (...args: any[]) => void): this;
235
+ prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
236
+ prependListener(event: "secureConnect", listener: () => void): this;
237
+
238
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
239
+ prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
240
+ prependOnceListener(event: "secureConnect", listener: () => void): this;
241
+ }
242
+
243
+ interface TlsOptions extends SecureContextOptions {
244
+ handshakeTimeout?: number;
245
+ requestCert?: boolean;
246
+ rejectUnauthorized?: boolean;
247
+ NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
248
+ ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
249
+ SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void;
250
+ sessionTimeout?: number;
251
+ ticketKeys?: Buffer;
252
+ }
253
+
254
+ interface ConnectionOptions extends SecureContextOptions {
255
+ host?: string;
256
+ port?: number;
257
+ path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
258
+ socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket
259
+ rejectUnauthorized?: boolean; // Defaults to true
260
+ NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
261
+ ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
262
+ checkServerIdentity?: typeof checkServerIdentity;
263
+ servername?: string; // SNI TLS Extension
264
+ session?: Buffer;
265
+ minDHSize?: number;
266
+ secureContext?: SecureContext; // If not provided, the entire ConnectionOptions object will be passed to tls.createSecureContext()
267
+ lookup?: net.LookupFunction;
268
+ }
269
+
270
+ class Server extends net.Server {
271
+ addContext(hostName: string, credentials: {
272
+ key: string;
273
+ cert: string;
274
+ ca: string;
275
+ }): void;
276
+
277
+ /**
278
+ * events.EventEmitter
279
+ * 1. tlsClientError
280
+ * 2. newSession
281
+ * 3. OCSPRequest
282
+ * 4. resumeSession
283
+ * 5. secureConnection
284
+ */
285
+ addListener(event: string, listener: (...args: any[]) => void): this;
286
+ addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
287
+ addListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
288
+ addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
289
+ addListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
290
+ addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
291
+
292
+ emit(event: string | symbol, ...args: any[]): boolean;
293
+ emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
294
+ emit(event: "newSession", sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void): boolean;
295
+ emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: Function): boolean;
296
+ emit(event: "resumeSession", sessionId: any, callback: (err: Error, sessionData: any) => void): boolean;
297
+ emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
298
+
299
+ on(event: string, listener: (...args: any[]) => void): this;
300
+ on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
301
+ on(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
302
+ on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
303
+ on(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
304
+ on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
305
+
306
+ once(event: string, listener: (...args: any[]) => void): this;
307
+ once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
308
+ once(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
309
+ once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
310
+ once(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
311
+ once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
312
+
313
+ prependListener(event: string, listener: (...args: any[]) => void): this;
314
+ prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
315
+ prependListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
316
+ prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
317
+ prependListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
318
+ prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
319
+
320
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
321
+ prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
322
+ prependOnceListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
323
+ prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
324
+ prependOnceListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
325
+ prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
326
+ }
327
+
328
+ interface SecurePair {
329
+ encrypted: any;
330
+ cleartext: any;
331
+ }
332
+
333
+ interface SecureContextOptions {
334
+ pfx?: string | Buffer | Array<string | Buffer | Object>;
335
+ key?: string | Buffer | Array<Buffer | Object>;
336
+ passphrase?: string;
337
+ cert?: string | Buffer | Array<string | Buffer>;
338
+ ca?: string | Buffer | Array<string | Buffer>;
339
+ ciphers?: string;
340
+ honorCipherOrder?: boolean;
341
+ ecdhCurve?: string;
342
+ clientCertEngine?: string;
343
+ crl?: string | Buffer | Array<string | Buffer>;
344
+ dhparam?: string | Buffer;
345
+ secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options
346
+ secureProtocol?: string; // SSL Method, e.g. SSLv23_method
347
+ sessionIdContext?: string;
348
+ }
349
+
350
+ interface SecureContext {
351
+ context: any;
352
+ }
353
+
354
+ /*
355
+ * Verifies the certificate `cert` is issued to host `host`.
356
+ * @host The hostname to verify the certificate against
357
+ * @cert PeerCertificate representing the peer's certificate
358
+ *
359
+ * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined.
360
+ */
361
+ function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined;
362
+ function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server;
363
+ function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
364
+ function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
365
+ function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
366
+ function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
367
+ function createSecureContext(details: SecureContextOptions): SecureContext;
368
+ function getCiphers(): string[];
369
+
370
+ const DEFAULT_ECDH_CURVE: string;
371
+ }
node/trace_events.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ declare module "trace_events" {
2
+ /**
3
+ * The `Tracing` object is used to enable or disable tracing for sets of
4
+ * categories. Instances are created using the
5
+ * `trace_events.createTracing()` method.
6
+ *
7
+ * When created, the `Tracing` object is disabled. Calling the
8
+ * `tracing.enable()` method adds the categories to the set of enabled trace
9
+ * event categories. Calling `tracing.disable()` will remove the categories
10
+ * from the set of enabled trace event categories.
11
+ */
12
+ export interface Tracing {
13
+ /**
14
+ * A comma-separated list of the trace event categories covered by this
15
+ * `Tracing` object.
16
+ */
17
+ readonly categories: string;
18
+
19
+ /**
20
+ * Disables this `Tracing` object.
21
+ *
22
+ * Only trace event categories _not_ covered by other enabled `Tracing`
23
+ * objects and _not_ specified by the `--trace-event-categories` flag
24
+ * will be disabled.
25
+ */
26
+ disable(): void;
27
+
28
+ /**
29
+ * Enables this `Tracing` object for the set of categories covered by
30
+ * the `Tracing` object.
31
+ */
32
+ enable(): void;
33
+
34
+ /**
35
+ * `true` only if the `Tracing` object has been enabled.
36
+ */
37
+ readonly enabled: boolean;
38
+ }
39
+
40
+ interface CreateTracingOptions {
41
+ /**
42
+ * An array of trace category names. Values included in the array are
43
+ * coerced to a string when possible. An error will be thrown if the
44
+ * value cannot be coerced.
45
+ */
46
+ categories: string[];
47
+ }
48
+
49
+ /**
50
+ * Creates and returns a Tracing object for the given set of categories.
51
+ */
52
+ export function createTracing(options: CreateTracingOptions): Tracing;
53
+
54
+ /**
55
+ * Returns a comma-separated list of all currently-enabled trace event
56
+ * categories. The current set of enabled trace event categories is
57
+ * determined by the union of all currently-enabled `Tracing` objects and
58
+ * any categories enabled using the `--trace-event-categories` flag.
59
+ */
60
+ export function getEnabledCategories(): string;
61
+ }
node/ts3.1/index.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.1.
2
+
3
+ // NOTE: TypeScript version-specific augmentations can be found in the following paths:
4
+ // - ~/base.d.ts - Shared definitions common to all TypeScript versions
5
+ // - ~/index.d.ts - Definitions specific to TypeScript 2.1
6
+ // - ~/ts3.1/index.d.ts - Definitions specific to TypeScript 3.1
7
+
8
+ // Reference required types from the default lib:
9
+ /// <reference lib="es2018" />
10
+ /// <reference lib="esnext.asyncIterable" />
11
+ /// <reference lib="esnext.intl" />
12
+
13
+ // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
14
+ // tslint:disable-next-line:no-bad-reference
15
+ /// <reference path="../base.d.ts" />
16
+
17
+ // TypeScript 3.1-specific augmentations:
18
+ /// <reference path="util.d.ts" />
node/ts3.1/util.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ // tslint:disable-next-line:no-bad-reference
2
+ /// <reference path="../util.d.ts" />
3
+ declare module "util" {
4
+ namespace inspect {
5
+ const custom: unique symbol;
6
+ }
7
+ namespace promisify {
8
+ const custom: unique symbol;
9
+ }
10
+ }
node/tty.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ declare module "tty" {
2
+ import * as net from "net";
3
+
4
+ function isatty(fd: number): boolean;
5
+ class ReadStream extends net.Socket {
6
+ isRaw: boolean;
7
+ setRawMode(mode: boolean): void;
8
+ isTTY: boolean;
9
+ }
10
+ class WriteStream extends net.Socket {
11
+ columns: number;
12
+ rows: number;
13
+ isTTY: boolean;
14
+ }
15
+ }
node/url.d.ts ADDED
@@ -0,0 +1,104 @@
1
+ declare module "url" {
2
+ import { ParsedUrlQuery } from 'querystring';
3
+
4
+ interface UrlObjectCommon {
5
+ auth?: string;
6
+ hash?: string;
7
+ host?: string;
8
+ hostname?: string;
9
+ href?: string;
10
+ path?: string;
11
+ pathname?: string;
12
+ protocol?: string;
13
+ search?: string;
14
+ slashes?: boolean;
15
+ }
16
+
17
+ // Input to `url.format`
18
+ interface UrlObject extends UrlObjectCommon {
19
+ port?: string | number;
20
+ query?: string | null | { [key: string]: any };
21
+ }
22
+
23
+ // Output of `url.parse`
24
+ interface Url extends UrlObjectCommon {
25
+ port?: string;
26
+ query?: string | null | ParsedUrlQuery;
27
+ }
28
+
29
+ interface UrlWithParsedQuery extends Url {
30
+ query: ParsedUrlQuery;
31
+ }
32
+
33
+ interface UrlWithStringQuery extends Url {
34
+ query: string | null;
35
+ }
36
+
37
+ function parse(urlStr: string): UrlWithStringQuery;
38
+ function parse(urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;
39
+ function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
40
+ function parse(urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
41
+
42
+ function format(URL: URL, options?: URLFormatOptions): string;
43
+ function format(urlObject: UrlObject | string): string;
44
+ function resolve(from: string, to: string): string;
45
+
46
+ function domainToASCII(domain: string): string;
47
+ function domainToUnicode(domain: string): string;
48
+
49
+ /**
50
+ * This function ensures the correct decodings of percent-encoded characters as
51
+ * well as ensuring a cross-platform valid absolute path string.
52
+ * @param url The file URL string or URL object to convert to a path.
53
+ */
54
+ function fileURLToPath(url: string | URL): string;
55
+
56
+ /**
57
+ * This function ensures that path is resolved absolutely, and that the URL
58
+ * control characters are correctly encoded when converting into a File URL.
59
+ * @param url The path to convert to a File URL.
60
+ */
61
+ function pathToFileURL(url: string): URL;
62
+
63
+ interface URLFormatOptions {
64
+ auth?: boolean;
65
+ fragment?: boolean;
66
+ search?: boolean;
67
+ unicode?: boolean;
68
+ }
69
+
70
+ class URL {
71
+ constructor(input: string, base?: string | URL);
72
+ hash: string;
73
+ host: string;
74
+ hostname: string;
75
+ href: string;
76
+ readonly origin: string;
77
+ password: string;
78
+ pathname: string;
79
+ port: string;
80
+ protocol: string;
81
+ search: string;
82
+ readonly searchParams: URLSearchParams;
83
+ username: string;
84
+ toString(): string;
85
+ toJSON(): string;
86
+ }
87
+
88
+ class URLSearchParams implements Iterable<[string, string]> {
89
+ constructor(init?: URLSearchParams | string | { [key: string]: string | string[] | undefined } | Iterable<[string, string]> | Array<[string, string]>);
90
+ append(name: string, value: string): void;
91
+ delete(name: string): void;
92
+ entries(): IterableIterator<[string, string]>;
93
+ forEach(callback: (value: string, name: string, searchParams: this) => void): void;
94
+ get(name: string): string | null;
95
+ getAll(name: string): string[];
96
+ has(name: string): boolean;
97
+ keys(): IterableIterator<string>;
98
+ set(name: string, value: string): void;
99
+ sort(): void;
100
+ toString(): string;
101
+ values(): IterableIterator<string>;
102
+ [Symbol.iterator](): IterableIterator<[string, string]>;
103
+ }
104
+ }