@types/node 18.11.5 → 20.2.5
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/README.md +2 -2
- node/assert.d.ts +86 -75
- node/async_hooks.d.ts +66 -37
- node/buffer.d.ts +193 -100
- node/child_process.d.ts +82 -56
- node/cluster.d.ts +12 -12
- node/console.d.ts +5 -5
- node/crypto.d.ts +233 -235
- node/dgram.d.ts +15 -15
- node/diagnostics_channel.d.ts +59 -21
- node/dns/promises.d.ts +50 -6
- node/dns.d.ts +26 -17
- node/domain.d.ts +4 -4
- node/events.d.ts +111 -65
- node/fs/promises.d.ts +99 -47
- node/fs.d.ts +244 -73
- node/globals.d.ts +6 -3
- node/http.d.ts +265 -148
- node/http2.d.ts +42 -47
- node/https.d.ts +53 -153
- node/index.d.ts +2 -1
- node/inspector.d.ts +10 -3
- node/module.d.ts +6 -4
- node/net.d.ts +32 -15
- node/os.d.ts +27 -16
- node/package.json +9 -4
- node/path.d.ts +4 -4
- node/perf_hooks.d.ts +28 -15
- node/process.d.ts +49 -46
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +5 -5
- node/readline/promises.d.ts +65 -63
- node/readline.d.ts +32 -159
- node/repl.d.ts +20 -20
- node/stream/consumers.d.ts +1 -1
- node/stream.d.ts +950 -869
- node/string_decoder.d.ts +6 -6
- node/test.d.ts +877 -139
- node/timers/promises.d.ts +26 -1
- node/timers.d.ts +125 -4
- node/tls.d.ts +120 -29
- node/trace_events.d.ts +20 -9
- node/ts4.8/assert.d.ts +86 -75
- node/ts4.8/async_hooks.d.ts +66 -37
- node/ts4.8/buffer.d.ts +193 -101
- node/ts4.8/child_process.d.ts +82 -56
- node/ts4.8/cluster.d.ts +12 -12
- node/ts4.8/console.d.ts +5 -5
- node/ts4.8/crypto.d.ts +230 -233
- node/ts4.8/dgram.d.ts +15 -15
- node/ts4.8/diagnostics_channel.d.ts +59 -21
- node/ts4.8/dns/promises.d.ts +50 -6
- node/ts4.8/dns.d.ts +26 -17
- node/ts4.8/domain.d.ts +4 -4
- node/ts4.8/events.d.ts +111 -65
- node/ts4.8/fs/promises.d.ts +97 -46
- node/ts4.8/fs.d.ts +244 -73
- node/ts4.8/globals.d.ts +21 -12
- node/ts4.8/http.d.ts +265 -148
- node/ts4.8/http2.d.ts +42 -47
- node/ts4.8/https.d.ts +53 -153
- node/ts4.8/inspector.d.ts +10 -3
- node/ts4.8/module.d.ts +6 -4
- node/ts4.8/net.d.ts +33 -16
- node/ts4.8/os.d.ts +27 -16
- node/ts4.8/path.d.ts +4 -4
- node/ts4.8/perf_hooks.d.ts +28 -15
- node/ts4.8/process.d.ts +49 -46
- node/ts4.8/punycode.d.ts +1 -1
- node/ts4.8/querystring.d.ts +5 -5
- node/ts4.8/readline/promises.d.ts +65 -63
- node/ts4.8/readline.d.ts +32 -159
- node/ts4.8/repl.d.ts +20 -20
- node/ts4.8/stream/consumers.d.ts +1 -1
- node/ts4.8/stream.d.ts +192 -140
- node/ts4.8/string_decoder.d.ts +6 -6
- node/ts4.8/test.d.ts +877 -139
- node/ts4.8/timers/promises.d.ts +26 -1
- node/ts4.8/timers.d.ts +125 -4
- node/ts4.8/tls.d.ts +120 -29
- node/ts4.8/trace_events.d.ts +20 -9
- node/ts4.8/tty.d.ts +4 -5
- node/ts4.8/url.d.ts +46 -42
- node/ts4.8/util.d.ts +325 -123
- node/ts4.8/v8.d.ts +253 -14
- node/ts4.8/vm.d.ts +417 -32
- node/ts4.8/wasi.d.ts +13 -19
- node/ts4.8/worker_threads.d.ts +38 -34
- node/ts4.8/zlib.d.ts +11 -11
- node/tty.d.ts +4 -5
- node/url.d.ts +46 -42
- node/util.d.ts +325 -123
- node/v8.d.ts +253 -14
- node/vm.d.ts +417 -32
- node/wasi.d.ts +13 -19
- node/worker_threads.d.ts +38 -34
- node/zlib.d.ts +11 -11
node/ts4.8/url.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `url` module provides utilities for URL resolution and parsing. It can
|
|
3
|
-
* accessed using:
|
|
2
|
+
* The `node:url` module provides utilities for URL resolution and parsing. It can
|
|
3
|
+
* be accessed using:
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
* import url from 'url';
|
|
6
|
+
* import url from 'node:url';
|
|
7
7
|
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module 'url' {
|
|
11
11
|
import { Blob as NodeBlob } from 'node:buffer';
|
|
@@ -54,17 +54,11 @@ declare module 'url' {
|
|
|
54
54
|
*
|
|
55
55
|
* A `URIError` is thrown if the `auth` property is present but cannot be decoded.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* issues can be introduced. Specifically, issues with [host name spoofing](https://hackerone.com/reports/678487) and
|
|
61
|
-
* incorrect handling of usernames and passwords have been identified.
|
|
62
|
-
*
|
|
63
|
-
* Deprecation of this API has been shelved for now primarily due to the the
|
|
64
|
-
* inability of the [WHATWG API to parse relative URLs](https://github.com/nodejs/node/issues/12682#issuecomment-1154492373).
|
|
65
|
-
* [Discussions are ongoing](https://github.com/whatwg/url/issues/531) for the best way to resolve this.
|
|
66
|
-
*
|
|
57
|
+
* `url.parse()` uses a lenient, non-standard algorithm for parsing URL
|
|
58
|
+
* strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted
|
|
59
|
+
* input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead.
|
|
67
60
|
* @since v0.1.25
|
|
61
|
+
* @deprecated Use the WHATWG URL API instead.
|
|
68
62
|
* @param urlString The URL string to parse.
|
|
69
63
|
* @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
|
|
70
64
|
* on the returned URL object will be an unparsed, undecoded string.
|
|
@@ -79,15 +73,15 @@ declare module 'url' {
|
|
|
79
73
|
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
80
74
|
*
|
|
81
75
|
* ```js
|
|
82
|
-
* const url = require('url');
|
|
76
|
+
* const url = require('node:url');
|
|
83
77
|
* url.format({
|
|
84
78
|
* protocol: 'https',
|
|
85
79
|
* hostname: 'example.com',
|
|
86
80
|
* pathname: '/some/path',
|
|
87
81
|
* query: {
|
|
88
82
|
* page: 1,
|
|
89
|
-
* format: 'json'
|
|
90
|
-
* }
|
|
83
|
+
* format: 'json',
|
|
84
|
+
* },
|
|
91
85
|
* });
|
|
92
86
|
*
|
|
93
87
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -135,7 +129,7 @@ declare module 'url' {
|
|
|
135
129
|
* string, an `Error` is thrown.
|
|
136
130
|
* * `result` is returned.
|
|
137
131
|
* @since v0.1.25
|
|
138
|
-
* @
|
|
132
|
+
* @legacy Use the WHATWG URL API instead.
|
|
139
133
|
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
|
|
140
134
|
*/
|
|
141
135
|
function format(urlObject: URL, options?: URLFormatOptions): string;
|
|
@@ -199,7 +193,7 @@ declare module 'url' {
|
|
|
199
193
|
* string, an `Error` is thrown.
|
|
200
194
|
* * `result` is returned.
|
|
201
195
|
* @since v0.1.25
|
|
202
|
-
* @
|
|
196
|
+
* @legacy Use the WHATWG URL API instead.
|
|
203
197
|
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
|
|
204
198
|
*/
|
|
205
199
|
function format(urlObject: UrlObject | string): string;
|
|
@@ -208,7 +202,7 @@ declare module 'url' {
|
|
|
208
202
|
* manner similar to that of a web browser resolving an anchor tag.
|
|
209
203
|
*
|
|
210
204
|
* ```js
|
|
211
|
-
* const url = require('url');
|
|
205
|
+
* const url = require('node:url');
|
|
212
206
|
* url.resolve('/one/two/three', 'four'); // '/one/two/four'
|
|
213
207
|
* url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
|
|
214
208
|
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
|
@@ -232,7 +226,7 @@ declare module 'url' {
|
|
|
232
226
|
* resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
|
233
227
|
* ```
|
|
234
228
|
* @since v0.1.25
|
|
235
|
-
* @
|
|
229
|
+
* @legacy Use the WHATWG URL API instead.
|
|
236
230
|
* @param from The base URL to use if `to` is a relative URL.
|
|
237
231
|
* @param to The target URL to resolve.
|
|
238
232
|
*/
|
|
@@ -243,10 +237,8 @@ declare module 'url' {
|
|
|
243
237
|
*
|
|
244
238
|
* It performs the inverse operation to {@link domainToUnicode}.
|
|
245
239
|
*
|
|
246
|
-
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
247
|
-
*
|
|
248
240
|
* ```js
|
|
249
|
-
* import url from 'url';
|
|
241
|
+
* import url from 'node:url';
|
|
250
242
|
*
|
|
251
243
|
* console.log(url.domainToASCII('español.com'));
|
|
252
244
|
* // Prints xn--espaol-zwa.com
|
|
@@ -264,10 +256,8 @@ declare module 'url' {
|
|
|
264
256
|
*
|
|
265
257
|
* It performs the inverse operation to {@link domainToASCII}.
|
|
266
258
|
*
|
|
267
|
-
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
268
|
-
*
|
|
269
259
|
* ```js
|
|
270
|
-
* import url from 'url';
|
|
260
|
+
* import url from 'node:url';
|
|
271
261
|
*
|
|
272
262
|
* console.log(url.domainToUnicode('xn--espaol-zwa.com'));
|
|
273
263
|
* // Prints español.com
|
|
@@ -284,7 +274,7 @@ declare module 'url' {
|
|
|
284
274
|
* well as ensuring a cross-platform valid absolute path string.
|
|
285
275
|
*
|
|
286
276
|
* ```js
|
|
287
|
-
* import { fileURLToPath } from 'url';
|
|
277
|
+
* import { fileURLToPath } from 'node:url';
|
|
288
278
|
*
|
|
289
279
|
* const __filename = fileURLToPath(import.meta.url);
|
|
290
280
|
*
|
|
@@ -310,7 +300,7 @@ declare module 'url' {
|
|
|
310
300
|
* control characters are correctly encoded when converting into a File URL.
|
|
311
301
|
*
|
|
312
302
|
* ```js
|
|
313
|
-
* import { pathToFileURL } from 'url';
|
|
303
|
+
* import { pathToFileURL } from 'node:url';
|
|
314
304
|
*
|
|
315
305
|
* new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
|
|
316
306
|
* pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
|
|
@@ -328,7 +318,7 @@ declare module 'url' {
|
|
|
328
318
|
* expected by the `http.request()` and `https.request()` APIs.
|
|
329
319
|
*
|
|
330
320
|
* ```js
|
|
331
|
-
* import { urlToHttpOptions } from 'url';
|
|
321
|
+
* import { urlToHttpOptions } from 'node:url';
|
|
332
322
|
* const myURL = new URL('https://a:b@測試?abc#foo');
|
|
333
323
|
*
|
|
334
324
|
* console.log(urlToHttpOptions(myURL));
|
|
@@ -376,7 +366,7 @@ declare module 'url' {
|
|
|
376
366
|
* const {
|
|
377
367
|
* Blob,
|
|
378
368
|
* resolveObjectURL,
|
|
379
|
-
* } = require('buffer');
|
|
369
|
+
* } = require('node:buffer');
|
|
380
370
|
*
|
|
381
371
|
* const blob = new Blob(['hello']);
|
|
382
372
|
* const id = URL.createObjectURL(blob);
|
|
@@ -398,7 +388,7 @@ declare module 'url' {
|
|
|
398
388
|
static createObjectURL(blob: NodeBlob): string;
|
|
399
389
|
/**
|
|
400
390
|
* Removes the stored `Blob` identified by the given ID. Attempting to revoke a
|
|
401
|
-
* ID that isn
|
|
391
|
+
* ID that isn't registered will silently fail.
|
|
402
392
|
* @since v16.7.0
|
|
403
393
|
* @experimental
|
|
404
394
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
@@ -449,7 +439,7 @@ declare module 'url' {
|
|
|
449
439
|
* // Prints example.org
|
|
450
440
|
*
|
|
451
441
|
* // Setting the hostname does not change the port
|
|
452
|
-
* myURL.hostname = 'example.com
|
|
442
|
+
* myURL.hostname = 'example.com';
|
|
453
443
|
* console.log(myURL.href);
|
|
454
444
|
* // Prints https://example.com:81/foo
|
|
455
445
|
*
|
|
@@ -512,7 +502,7 @@ declare module 'url' {
|
|
|
512
502
|
*
|
|
513
503
|
* myURL.password = '123';
|
|
514
504
|
* console.log(myURL.href);
|
|
515
|
-
* // Prints https://abc:123@example.com
|
|
505
|
+
* // Prints https://abc:123@example.com/
|
|
516
506
|
* ```
|
|
517
507
|
*
|
|
518
508
|
* Invalid URL characters included in the value assigned to the `password` property
|
|
@@ -656,14 +646,14 @@ declare module 'url' {
|
|
|
656
646
|
* character, while `URLSearchParams` will always encode it:
|
|
657
647
|
*
|
|
658
648
|
* ```js
|
|
659
|
-
* const
|
|
649
|
+
* const myURL = new URL('https://example.org/abc?foo=~bar');
|
|
660
650
|
*
|
|
661
|
-
* console.log(
|
|
651
|
+
* console.log(myURL.search); // prints ?foo=~bar
|
|
662
652
|
*
|
|
663
653
|
* // Modify the URL via searchParams...
|
|
664
|
-
*
|
|
654
|
+
* myURL.searchParams.sort();
|
|
665
655
|
*
|
|
666
|
-
* console.log(
|
|
656
|
+
* console.log(myURL.search); // prints ?foo=%7Ebar
|
|
667
657
|
* ```
|
|
668
658
|
*/
|
|
669
659
|
readonly searchParams: URLSearchParams;
|
|
@@ -758,9 +748,12 @@ declare module 'url' {
|
|
|
758
748
|
*/
|
|
759
749
|
append(name: string, value: string): void;
|
|
760
750
|
/**
|
|
761
|
-
*
|
|
751
|
+
* If `value` is provided, removes all name-value pairs
|
|
752
|
+
* where name is `name` and value is `value`..
|
|
753
|
+
*
|
|
754
|
+
* If `value` is not provided, removes all name-value pairs whose name is `name`.
|
|
762
755
|
*/
|
|
763
|
-
delete(name: string): void;
|
|
756
|
+
delete(name: string, value?: string): void;
|
|
764
757
|
/**
|
|
765
758
|
* Returns an ES6 `Iterator` over each of the name-value pairs in the query.
|
|
766
759
|
* Each item of the iterator is a JavaScript `Array`. The first item of the `Array`is the `name`, the second item of the `Array` is the `value`.
|
|
@@ -796,9 +789,15 @@ declare module 'url' {
|
|
|
796
789
|
*/
|
|
797
790
|
getAll(name: string): string[];
|
|
798
791
|
/**
|
|
799
|
-
*
|
|
792
|
+
* Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument.
|
|
793
|
+
*
|
|
794
|
+
* If `value` is provided, returns `true` when name-value pair with
|
|
795
|
+
* same `name` and `value` exists.
|
|
796
|
+
*
|
|
797
|
+
* If `value` is not provided, returns `true` if there is at least one name-value
|
|
798
|
+
* pair whose name is `name`.
|
|
800
799
|
*/
|
|
801
|
-
has(name: string): boolean;
|
|
800
|
+
has(name: string, value?: string): boolean;
|
|
802
801
|
/**
|
|
803
802
|
* Returns an ES6 `Iterator` over the names of each name-value pair.
|
|
804
803
|
*
|
|
@@ -833,6 +832,11 @@ declare module 'url' {
|
|
|
833
832
|
* ```
|
|
834
833
|
*/
|
|
835
834
|
set(name: string, value: string): void;
|
|
835
|
+
/**
|
|
836
|
+
* The total number of parameter entries.
|
|
837
|
+
* @since v19.8.0
|
|
838
|
+
*/
|
|
839
|
+
readonly size: number;
|
|
836
840
|
/**
|
|
837
841
|
* Sort all existing name-value pairs in-place by their names. Sorting is done
|
|
838
842
|
* with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs
|