@types/node 18.19.15 → 18.19.16
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 v18.19/README.md +1 -1
- node v18.19/package.json +2 -2
- node v18.19/ts4.8/url.d.ts +62 -45
- node v18.19/url.d.ts +62 -45
node v18.19/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated: Thu,
|
|
11
|
+
* Last updated: Thu, 15 Feb 2024 10:07:24 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
node v18.19/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.19.
|
|
3
|
+
"version": "18.19.16",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -229,6 +229,6 @@
|
|
|
229
229
|
"dependencies": {
|
|
230
230
|
"undici-types": "~5.26.4"
|
|
231
231
|
},
|
|
232
|
-
"typesPublisherContentHash": "
|
|
232
|
+
"typesPublisherContentHash": "fc779caf4c4851e599ce7c1f13b85e3f32d200cafac091a78d5f58ff82591bee",
|
|
233
233
|
"typeScriptVersion": "4.6"
|
|
234
234
|
}
|
node v18.19/ts4.8/url.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* ```js
|
|
6
6
|
* import url from 'url';
|
|
7
7
|
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/v18.
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.19.0/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module "url" {
|
|
11
11
|
import { Blob as NodeBlob } from "node:buffer";
|
|
@@ -80,18 +80,18 @@ declare module "url" {
|
|
|
80
80
|
function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
|
|
81
81
|
function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
|
|
82
82
|
/**
|
|
83
|
-
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
83
|
+
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
|
84
84
|
*
|
|
85
85
|
* ```js
|
|
86
|
-
* const url = require('url');
|
|
86
|
+
* const url = require('node:url');
|
|
87
87
|
* url.format({
|
|
88
88
|
* protocol: 'https',
|
|
89
89
|
* hostname: 'example.com',
|
|
90
90
|
* pathname: '/some/path',
|
|
91
91
|
* query: {
|
|
92
92
|
* page: 1,
|
|
93
|
-
* format: 'json'
|
|
94
|
-
* }
|
|
93
|
+
* format: 'json',
|
|
94
|
+
* },
|
|
95
95
|
* });
|
|
96
96
|
*
|
|
97
97
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -106,33 +106,33 @@ declare module "url" {
|
|
|
106
106
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
|
107
107
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
|
108
108
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
|
109
|
-
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
|
|
109
|
+
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
|
110
110
|
* * `urlObject.slashes` property is true;
|
|
111
|
-
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
|
|
112
|
-
* * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
|
|
113
|
-
* and appended to `result`followed by the literal string `@`.
|
|
111
|
+
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
|
112
|
+
* * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string
|
|
113
|
+
* and appended to `result` followed by the literal string `@`.
|
|
114
114
|
* * If the `urlObject.host` property is `undefined` then:
|
|
115
115
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
|
116
116
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
|
117
117
|
* an `Error` is thrown.
|
|
118
|
-
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
|
|
118
|
+
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
|
119
119
|
* * The literal string `:` is appended to `result`, and
|
|
120
|
-
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
|
|
121
|
-
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
|
|
120
|
+
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
|
121
|
+
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
|
122
122
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
|
123
|
-
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
|
|
123
|
+
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
|
124
124
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
|
125
125
|
* * The value of `urlObject.pathname` is appended to `result`.
|
|
126
126
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
|
127
|
-
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
|
|
128
|
-
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
|
|
127
|
+
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the
|
|
128
|
+
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
|
129
129
|
* * Otherwise, if `urlObject.search` is a string:
|
|
130
|
-
* * If the value of `urlObject.search`_does not start_ with the ASCII question
|
|
130
|
+
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
|
131
131
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
|
132
132
|
* * The value of `urlObject.search` is appended to `result`.
|
|
133
133
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
|
134
134
|
* * If the `urlObject.hash` property is a string:
|
|
135
|
-
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
|
|
135
|
+
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
|
136
136
|
* character, the literal string `#` is appended to `result`.
|
|
137
137
|
* * The value of `urlObject.hash` is appended to `result`.
|
|
138
138
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
|
@@ -144,18 +144,18 @@ declare module "url" {
|
|
|
144
144
|
*/
|
|
145
145
|
function format(urlObject: URL, options?: URLFormatOptions): string;
|
|
146
146
|
/**
|
|
147
|
-
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
147
|
+
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
|
148
148
|
*
|
|
149
149
|
* ```js
|
|
150
|
-
* const url = require('url');
|
|
150
|
+
* const url = require('node:url');
|
|
151
151
|
* url.format({
|
|
152
152
|
* protocol: 'https',
|
|
153
153
|
* hostname: 'example.com',
|
|
154
154
|
* pathname: '/some/path',
|
|
155
155
|
* query: {
|
|
156
156
|
* page: 1,
|
|
157
|
-
* format: 'json'
|
|
158
|
-
* }
|
|
157
|
+
* format: 'json',
|
|
158
|
+
* },
|
|
159
159
|
* });
|
|
160
160
|
*
|
|
161
161
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -170,33 +170,33 @@ declare module "url" {
|
|
|
170
170
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
|
171
171
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
|
172
172
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
|
173
|
-
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
|
|
173
|
+
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
|
174
174
|
* * `urlObject.slashes` property is true;
|
|
175
|
-
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
|
|
176
|
-
* * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
|
|
177
|
-
* and appended to `result`followed by the literal string `@`.
|
|
175
|
+
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
|
176
|
+
* * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string
|
|
177
|
+
* and appended to `result` followed by the literal string `@`.
|
|
178
178
|
* * If the `urlObject.host` property is `undefined` then:
|
|
179
179
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
|
180
180
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
|
181
181
|
* an `Error` is thrown.
|
|
182
|
-
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
|
|
182
|
+
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
|
183
183
|
* * The literal string `:` is appended to `result`, and
|
|
184
|
-
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
|
|
185
|
-
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
|
|
184
|
+
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
|
185
|
+
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
|
186
186
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
|
187
|
-
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
|
|
187
|
+
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
|
188
188
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
|
189
189
|
* * The value of `urlObject.pathname` is appended to `result`.
|
|
190
190
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
|
191
|
-
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
|
|
192
|
-
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
|
|
191
|
+
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the
|
|
192
|
+
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
|
193
193
|
* * Otherwise, if `urlObject.search` is a string:
|
|
194
|
-
* * If the value of `urlObject.search`_does not start_ with the ASCII question
|
|
194
|
+
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
|
195
195
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
|
196
196
|
* * The value of `urlObject.search` is appended to `result`.
|
|
197
197
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
|
198
198
|
* * If the `urlObject.hash` property is a string:
|
|
199
|
-
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
|
|
199
|
+
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
|
200
200
|
* character, the literal string `#` is appended to `result`.
|
|
201
201
|
* * The value of `urlObject.hash` is appended to `result`.
|
|
202
202
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
|
@@ -355,9 +355,26 @@ declare module "url" {
|
|
|
355
355
|
*/
|
|
356
356
|
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
|
357
357
|
interface URLFormatOptions {
|
|
358
|
+
/**
|
|
359
|
+
* `true` if the serialized URL string should include the username and password, `false` otherwise.
|
|
360
|
+
* @default true
|
|
361
|
+
*/
|
|
358
362
|
auth?: boolean | undefined;
|
|
363
|
+
/**
|
|
364
|
+
* `true` if the serialized URL string should include the fragment, `false` otherwise.
|
|
365
|
+
* @default true
|
|
366
|
+
*/
|
|
359
367
|
fragment?: boolean | undefined;
|
|
368
|
+
/**
|
|
369
|
+
* `true` if the serialized URL string should include the search query, `false` otherwise.
|
|
370
|
+
* @default true
|
|
371
|
+
*/
|
|
360
372
|
search?: boolean | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to
|
|
375
|
+
* being Punycode encoded.
|
|
376
|
+
* @default false
|
|
377
|
+
*/
|
|
361
378
|
unicode?: boolean | undefined;
|
|
362
379
|
}
|
|
363
380
|
/**
|
|
@@ -367,7 +384,7 @@ declare module "url" {
|
|
|
367
384
|
*
|
|
368
385
|
* In accordance with browser conventions, all properties of `URL` objects
|
|
369
386
|
* are implemented as getters and setters on the class prototype, rather than as
|
|
370
|
-
* data properties on the object itself. Thus, unlike `legacy urlObject`
|
|
387
|
+
* data properties on the object itself. Thus, unlike `legacy urlObject`s,
|
|
371
388
|
* using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
|
|
372
389
|
* return `true`.
|
|
373
390
|
* @since v7.0.0, v6.13.0
|
|
@@ -391,7 +408,7 @@ declare module "url" {
|
|
|
391
408
|
* console.log(otherBlob.size);
|
|
392
409
|
* ```
|
|
393
410
|
*
|
|
394
|
-
* The data stored by the registered `Blob` will be retained in memory until`URL.revokeObjectURL()` is called to remove it.
|
|
411
|
+
* The data stored by the registered `Blob` will be retained in memory until `URL.revokeObjectURL()` is called to remove it.
|
|
395
412
|
*
|
|
396
413
|
* `Blob` objects are registered within the current thread. If using Worker
|
|
397
414
|
* Threads, `Blob` objects registered within one Worker will not be available
|
|
@@ -407,7 +424,7 @@ declare module "url" {
|
|
|
407
424
|
* @experimental
|
|
408
425
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
409
426
|
*/
|
|
410
|
-
static revokeObjectURL(
|
|
427
|
+
static revokeObjectURL(id: string): void;
|
|
411
428
|
/**
|
|
412
429
|
* Checks if an `input` relative to the `base` can be parsed to a `URL`.
|
|
413
430
|
*
|
|
@@ -422,7 +439,7 @@ declare module "url" {
|
|
|
422
439
|
* @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
|
|
423
440
|
*/
|
|
424
441
|
static canParse(input: string, base?: string): boolean;
|
|
425
|
-
constructor(input: string, base?: string | URL);
|
|
442
|
+
constructor(input: string | { toString: () => string }, base?: string | URL);
|
|
426
443
|
/**
|
|
427
444
|
* Gets and sets the fragment portion of the URL.
|
|
428
445
|
*
|
|
@@ -551,14 +568,14 @@ declare module "url" {
|
|
|
551
568
|
* // Prints https://example.org/abcdef?123
|
|
552
569
|
* ```
|
|
553
570
|
*
|
|
554
|
-
* Invalid URL characters included in the value assigned to the `pathname`property are `percent-encoded`. The selection of which characters
|
|
571
|
+
* Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters
|
|
555
572
|
* to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
556
573
|
*/
|
|
557
574
|
pathname: string;
|
|
558
575
|
/**
|
|
559
576
|
* Gets and sets the port portion of the URL.
|
|
560
577
|
*
|
|
561
|
-
* The port value may be a number or a string containing a number in the range`0` to `65535` (inclusive). Setting the value to the default port of the`URL` objects given `protocol` will
|
|
578
|
+
* The port value may be a number or a string containing a number in the range `0` to `65535` (inclusive). Setting the value to the default port of the `URL` objects given `protocol` will
|
|
562
579
|
* result in the `port` value becoming
|
|
563
580
|
* the empty string (`''`).
|
|
564
581
|
*
|
|
@@ -698,7 +715,7 @@ declare module "url" {
|
|
|
698
715
|
* // Prints https://123:xyz@example.com/
|
|
699
716
|
* ```
|
|
700
717
|
*
|
|
701
|
-
* Any invalid URL characters appearing in the value assigned the `username`property will be `percent-encoded`. The selection of which
|
|
718
|
+
* Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which
|
|
702
719
|
* characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
703
720
|
*/
|
|
704
721
|
username: string;
|
|
@@ -726,7 +743,7 @@ declare module "url" {
|
|
|
726
743
|
toJSON(): string;
|
|
727
744
|
}
|
|
728
745
|
/**
|
|
729
|
-
* The `URLSearchParams` API provides read and write access to the query of a`URL`. The `URLSearchParams` class can also be used standalone with one of the
|
|
746
|
+
* The `URLSearchParams` API provides read and write access to the query of a `URL`. The `URLSearchParams` class can also be used standalone with one of the
|
|
730
747
|
* four following constructors.
|
|
731
748
|
* The `URLSearchParams` class is also available on the global object.
|
|
732
749
|
*
|
|
@@ -784,14 +801,14 @@ declare module "url" {
|
|
|
784
801
|
append(name: string, value: string): void;
|
|
785
802
|
/**
|
|
786
803
|
* If `value` is provided, removes all name-value pairs
|
|
787
|
-
* where name is `name` and value is `value
|
|
804
|
+
* where name is `name` and value is `value`.
|
|
788
805
|
*
|
|
789
806
|
* If `value` is not provided, removes all name-value pairs whose name is `name`.
|
|
790
807
|
*/
|
|
791
808
|
delete(name: string, value?: string): void;
|
|
792
809
|
/**
|
|
793
810
|
* Returns an ES6 `Iterator` over each of the name-value pairs in the query.
|
|
794
|
-
* 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`.
|
|
811
|
+
* 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`.
|
|
795
812
|
*
|
|
796
813
|
* Alias for `urlSearchParams[@@iterator]()`.
|
|
797
814
|
*/
|
|
@@ -812,7 +829,7 @@ declare module "url" {
|
|
|
812
829
|
* @param thisArg To be used as `this` value for when `fn` is called
|
|
813
830
|
*/
|
|
814
831
|
forEach<TThis = this>(
|
|
815
|
-
|
|
832
|
+
fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
|
|
816
833
|
thisArg?: TThis,
|
|
817
834
|
): void;
|
|
818
835
|
/**
|
|
@@ -827,7 +844,7 @@ declare module "url" {
|
|
|
827
844
|
*/
|
|
828
845
|
getAll(name: string): string[];
|
|
829
846
|
/**
|
|
830
|
-
* Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument.
|
|
847
|
+
* Checks if the `URLSearchParams` object contains key-value pair(s) based on `name` and an optional `value` argument.
|
|
831
848
|
*
|
|
832
849
|
* If `value` is provided, returns `true` when name-value pair with
|
|
833
850
|
* same `name` and `value` exists.
|
node v18.19/url.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* ```js
|
|
6
6
|
* import url from 'url';
|
|
7
7
|
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/v18.
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.19.0/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module "url" {
|
|
11
11
|
import { Blob as NodeBlob } from "node:buffer";
|
|
@@ -80,18 +80,18 @@ declare module "url" {
|
|
|
80
80
|
function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
|
|
81
81
|
function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
|
|
82
82
|
/**
|
|
83
|
-
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
83
|
+
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
|
84
84
|
*
|
|
85
85
|
* ```js
|
|
86
|
-
* const url = require('url');
|
|
86
|
+
* const url = require('node:url');
|
|
87
87
|
* url.format({
|
|
88
88
|
* protocol: 'https',
|
|
89
89
|
* hostname: 'example.com',
|
|
90
90
|
* pathname: '/some/path',
|
|
91
91
|
* query: {
|
|
92
92
|
* page: 1,
|
|
93
|
-
* format: 'json'
|
|
94
|
-
* }
|
|
93
|
+
* format: 'json',
|
|
94
|
+
* },
|
|
95
95
|
* });
|
|
96
96
|
*
|
|
97
97
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -106,33 +106,33 @@ declare module "url" {
|
|
|
106
106
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
|
107
107
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
|
108
108
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
|
109
|
-
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
|
|
109
|
+
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
|
110
110
|
* * `urlObject.slashes` property is true;
|
|
111
|
-
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
|
|
112
|
-
* * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
|
|
113
|
-
* and appended to `result`followed by the literal string `@`.
|
|
111
|
+
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
|
112
|
+
* * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string
|
|
113
|
+
* and appended to `result` followed by the literal string `@`.
|
|
114
114
|
* * If the `urlObject.host` property is `undefined` then:
|
|
115
115
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
|
116
116
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
|
117
117
|
* an `Error` is thrown.
|
|
118
|
-
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
|
|
118
|
+
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
|
119
119
|
* * The literal string `:` is appended to `result`, and
|
|
120
|
-
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
|
|
121
|
-
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
|
|
120
|
+
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
|
121
|
+
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
|
122
122
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
|
123
|
-
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
|
|
123
|
+
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
|
124
124
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
|
125
125
|
* * The value of `urlObject.pathname` is appended to `result`.
|
|
126
126
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
|
127
|
-
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
|
|
128
|
-
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
|
|
127
|
+
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the
|
|
128
|
+
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
|
129
129
|
* * Otherwise, if `urlObject.search` is a string:
|
|
130
|
-
* * If the value of `urlObject.search`_does not start_ with the ASCII question
|
|
130
|
+
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
|
131
131
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
|
132
132
|
* * The value of `urlObject.search` is appended to `result`.
|
|
133
133
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
|
134
134
|
* * If the `urlObject.hash` property is a string:
|
|
135
|
-
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
|
|
135
|
+
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
|
136
136
|
* character, the literal string `#` is appended to `result`.
|
|
137
137
|
* * The value of `urlObject.hash` is appended to `result`.
|
|
138
138
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
|
@@ -144,18 +144,18 @@ declare module "url" {
|
|
|
144
144
|
*/
|
|
145
145
|
function format(urlObject: URL, options?: URLFormatOptions): string;
|
|
146
146
|
/**
|
|
147
|
-
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
147
|
+
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
|
148
148
|
*
|
|
149
149
|
* ```js
|
|
150
|
-
* const url = require('url');
|
|
150
|
+
* const url = require('node:url');
|
|
151
151
|
* url.format({
|
|
152
152
|
* protocol: 'https',
|
|
153
153
|
* hostname: 'example.com',
|
|
154
154
|
* pathname: '/some/path',
|
|
155
155
|
* query: {
|
|
156
156
|
* page: 1,
|
|
157
|
-
* format: 'json'
|
|
158
|
-
* }
|
|
157
|
+
* format: 'json',
|
|
158
|
+
* },
|
|
159
159
|
* });
|
|
160
160
|
*
|
|
161
161
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -170,33 +170,33 @@ declare module "url" {
|
|
|
170
170
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
|
171
171
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
|
172
172
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
|
173
|
-
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
|
|
173
|
+
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
|
174
174
|
* * `urlObject.slashes` property is true;
|
|
175
|
-
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
|
|
176
|
-
* * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
|
|
177
|
-
* and appended to `result`followed by the literal string `@`.
|
|
175
|
+
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
|
176
|
+
* * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string
|
|
177
|
+
* and appended to `result` followed by the literal string `@`.
|
|
178
178
|
* * If the `urlObject.host` property is `undefined` then:
|
|
179
179
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
|
180
180
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
|
181
181
|
* an `Error` is thrown.
|
|
182
|
-
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
|
|
182
|
+
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
|
183
183
|
* * The literal string `:` is appended to `result`, and
|
|
184
|
-
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
|
|
185
|
-
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
|
|
184
|
+
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
|
185
|
+
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
|
186
186
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
|
187
|
-
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
|
|
187
|
+
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
|
188
188
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
|
189
189
|
* * The value of `urlObject.pathname` is appended to `result`.
|
|
190
190
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
|
191
|
-
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
|
|
192
|
-
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
|
|
191
|
+
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the
|
|
192
|
+
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
|
193
193
|
* * Otherwise, if `urlObject.search` is a string:
|
|
194
|
-
* * If the value of `urlObject.search`_does not start_ with the ASCII question
|
|
194
|
+
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
|
195
195
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
|
196
196
|
* * The value of `urlObject.search` is appended to `result`.
|
|
197
197
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
|
198
198
|
* * If the `urlObject.hash` property is a string:
|
|
199
|
-
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
|
|
199
|
+
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
|
200
200
|
* character, the literal string `#` is appended to `result`.
|
|
201
201
|
* * The value of `urlObject.hash` is appended to `result`.
|
|
202
202
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
|
@@ -355,9 +355,26 @@ declare module "url" {
|
|
|
355
355
|
*/
|
|
356
356
|
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
|
357
357
|
interface URLFormatOptions {
|
|
358
|
+
/**
|
|
359
|
+
* `true` if the serialized URL string should include the username and password, `false` otherwise.
|
|
360
|
+
* @default true
|
|
361
|
+
*/
|
|
358
362
|
auth?: boolean | undefined;
|
|
363
|
+
/**
|
|
364
|
+
* `true` if the serialized URL string should include the fragment, `false` otherwise.
|
|
365
|
+
* @default true
|
|
366
|
+
*/
|
|
359
367
|
fragment?: boolean | undefined;
|
|
368
|
+
/**
|
|
369
|
+
* `true` if the serialized URL string should include the search query, `false` otherwise.
|
|
370
|
+
* @default true
|
|
371
|
+
*/
|
|
360
372
|
search?: boolean | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to
|
|
375
|
+
* being Punycode encoded.
|
|
376
|
+
* @default false
|
|
377
|
+
*/
|
|
361
378
|
unicode?: boolean | undefined;
|
|
362
379
|
}
|
|
363
380
|
/**
|
|
@@ -367,7 +384,7 @@ declare module "url" {
|
|
|
367
384
|
*
|
|
368
385
|
* In accordance with browser conventions, all properties of `URL` objects
|
|
369
386
|
* are implemented as getters and setters on the class prototype, rather than as
|
|
370
|
-
* data properties on the object itself. Thus, unlike `legacy urlObject`
|
|
387
|
+
* data properties on the object itself. Thus, unlike `legacy urlObject`s,
|
|
371
388
|
* using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
|
|
372
389
|
* return `true`.
|
|
373
390
|
* @since v7.0.0, v6.13.0
|
|
@@ -391,7 +408,7 @@ declare module "url" {
|
|
|
391
408
|
* console.log(otherBlob.size);
|
|
392
409
|
* ```
|
|
393
410
|
*
|
|
394
|
-
* The data stored by the registered `Blob` will be retained in memory until`URL.revokeObjectURL()` is called to remove it.
|
|
411
|
+
* The data stored by the registered `Blob` will be retained in memory until `URL.revokeObjectURL()` is called to remove it.
|
|
395
412
|
*
|
|
396
413
|
* `Blob` objects are registered within the current thread. If using Worker
|
|
397
414
|
* Threads, `Blob` objects registered within one Worker will not be available
|
|
@@ -407,7 +424,7 @@ declare module "url" {
|
|
|
407
424
|
* @experimental
|
|
408
425
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
409
426
|
*/
|
|
410
|
-
static revokeObjectURL(
|
|
427
|
+
static revokeObjectURL(id: string): void;
|
|
411
428
|
/**
|
|
412
429
|
* Checks if an `input` relative to the `base` can be parsed to a `URL`.
|
|
413
430
|
*
|
|
@@ -422,7 +439,7 @@ declare module "url" {
|
|
|
422
439
|
* @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
|
|
423
440
|
*/
|
|
424
441
|
static canParse(input: string, base?: string): boolean;
|
|
425
|
-
constructor(input: string, base?: string | URL);
|
|
442
|
+
constructor(input: string | { toString: () => string }, base?: string | URL);
|
|
426
443
|
/**
|
|
427
444
|
* Gets and sets the fragment portion of the URL.
|
|
428
445
|
*
|
|
@@ -551,14 +568,14 @@ declare module "url" {
|
|
|
551
568
|
* // Prints https://example.org/abcdef?123
|
|
552
569
|
* ```
|
|
553
570
|
*
|
|
554
|
-
* Invalid URL characters included in the value assigned to the `pathname`property are `percent-encoded`. The selection of which characters
|
|
571
|
+
* Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters
|
|
555
572
|
* to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
556
573
|
*/
|
|
557
574
|
pathname: string;
|
|
558
575
|
/**
|
|
559
576
|
* Gets and sets the port portion of the URL.
|
|
560
577
|
*
|
|
561
|
-
* The port value may be a number or a string containing a number in the range`0` to `65535` (inclusive). Setting the value to the default port of the`URL` objects given `protocol` will
|
|
578
|
+
* The port value may be a number or a string containing a number in the range `0` to `65535` (inclusive). Setting the value to the default port of the `URL` objects given `protocol` will
|
|
562
579
|
* result in the `port` value becoming
|
|
563
580
|
* the empty string (`''`).
|
|
564
581
|
*
|
|
@@ -698,7 +715,7 @@ declare module "url" {
|
|
|
698
715
|
* // Prints https://123:xyz@example.com/
|
|
699
716
|
* ```
|
|
700
717
|
*
|
|
701
|
-
* Any invalid URL characters appearing in the value assigned the `username`property will be `percent-encoded`. The selection of which
|
|
718
|
+
* Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which
|
|
702
719
|
* characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
703
720
|
*/
|
|
704
721
|
username: string;
|
|
@@ -726,7 +743,7 @@ declare module "url" {
|
|
|
726
743
|
toJSON(): string;
|
|
727
744
|
}
|
|
728
745
|
/**
|
|
729
|
-
* The `URLSearchParams` API provides read and write access to the query of a`URL`. The `URLSearchParams` class can also be used standalone with one of the
|
|
746
|
+
* The `URLSearchParams` API provides read and write access to the query of a `URL`. The `URLSearchParams` class can also be used standalone with one of the
|
|
730
747
|
* four following constructors.
|
|
731
748
|
* The `URLSearchParams` class is also available on the global object.
|
|
732
749
|
*
|
|
@@ -784,14 +801,14 @@ declare module "url" {
|
|
|
784
801
|
append(name: string, value: string): void;
|
|
785
802
|
/**
|
|
786
803
|
* If `value` is provided, removes all name-value pairs
|
|
787
|
-
* where name is `name` and value is `value
|
|
804
|
+
* where name is `name` and value is `value`.
|
|
788
805
|
*
|
|
789
806
|
* If `value` is not provided, removes all name-value pairs whose name is `name`.
|
|
790
807
|
*/
|
|
791
808
|
delete(name: string, value?: string): void;
|
|
792
809
|
/**
|
|
793
810
|
* Returns an ES6 `Iterator` over each of the name-value pairs in the query.
|
|
794
|
-
* 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`.
|
|
811
|
+
* 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`.
|
|
795
812
|
*
|
|
796
813
|
* Alias for `urlSearchParams[@@iterator]()`.
|
|
797
814
|
*/
|
|
@@ -812,7 +829,7 @@ declare module "url" {
|
|
|
812
829
|
* @param thisArg To be used as `this` value for when `fn` is called
|
|
813
830
|
*/
|
|
814
831
|
forEach<TThis = this>(
|
|
815
|
-
|
|
832
|
+
fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
|
|
816
833
|
thisArg?: TThis,
|
|
817
834
|
): void;
|
|
818
835
|
/**
|
|
@@ -827,7 +844,7 @@ declare module "url" {
|
|
|
827
844
|
*/
|
|
828
845
|
getAll(name: string): string[];
|
|
829
846
|
/**
|
|
830
|
-
* Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument.
|
|
847
|
+
* Checks if the `URLSearchParams` object contains key-value pair(s) based on `name` and an optional `value` argument.
|
|
831
848
|
*
|
|
832
849
|
* If `value` is provided, returns `true` when name-value pair with
|
|
833
850
|
* same `name` and `value` exists.
|