@types/node 16.18.80 → 16.18.81
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 v16.18/README.md +1 -1
- node v16.18/package.json +2 -2
- node v16.18/ts4.8/url.d.ts +48 -31
- node v16.18/url.d.ts +48 -31
node v16.18/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/v16.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated: Thu,
|
|
11
|
+
* Last updated: Thu, 15 Feb 2024 10:07:24 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
node v16.18/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "16.18.
|
|
3
|
+
"version": "16.18.81",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -222,6 +222,6 @@
|
|
|
222
222
|
},
|
|
223
223
|
"scripts": {},
|
|
224
224
|
"dependencies": {},
|
|
225
|
-
"typesPublisherContentHash": "
|
|
225
|
+
"typesPublisherContentHash": "ae03b227c3d602f42dd30296514410e0f03c04128303e667d569752dad86921f",
|
|
226
226
|
"typeScriptVersion": "4.6"
|
|
227
227
|
}
|
node v16.18/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/v16.
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.20.2/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module "url" {
|
|
11
11
|
import { Blob } from "node:buffer";
|
|
@@ -104,18 +104,18 @@ declare module "url" {
|
|
|
104
104
|
*/
|
|
105
105
|
function format(urlObject: URL, options?: URLFormatOptions): string;
|
|
106
106
|
/**
|
|
107
|
-
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
107
|
+
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
|
108
108
|
*
|
|
109
109
|
* ```js
|
|
110
|
-
* const url = require('url');
|
|
110
|
+
* const url = require('node:url');
|
|
111
111
|
* url.format({
|
|
112
112
|
* protocol: 'https',
|
|
113
113
|
* hostname: 'example.com',
|
|
114
114
|
* pathname: '/some/path',
|
|
115
115
|
* query: {
|
|
116
116
|
* page: 1,
|
|
117
|
-
* format: 'json'
|
|
118
|
-
* }
|
|
117
|
+
* format: 'json',
|
|
118
|
+
* },
|
|
119
119
|
* });
|
|
120
120
|
*
|
|
121
121
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -130,33 +130,33 @@ declare module "url" {
|
|
|
130
130
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
|
131
131
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
|
132
132
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
|
133
|
-
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
|
|
133
|
+
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
|
134
134
|
* * `urlObject.slashes` property is true;
|
|
135
|
-
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
|
|
136
|
-
* * 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
|
|
137
|
-
* and appended to `result`followed by the literal string `@`.
|
|
135
|
+
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
|
136
|
+
* * 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
|
|
137
|
+
* and appended to `result` followed by the literal string `@`.
|
|
138
138
|
* * If the `urlObject.host` property is `undefined` then:
|
|
139
139
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
|
140
140
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
|
141
141
|
* an `Error` is thrown.
|
|
142
|
-
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
|
|
142
|
+
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
|
143
143
|
* * The literal string `:` is appended to `result`, and
|
|
144
|
-
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
|
|
145
|
-
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
|
|
144
|
+
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
|
145
|
+
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
|
146
146
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
|
147
|
-
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
|
|
147
|
+
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
|
148
148
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
|
149
149
|
* * The value of `urlObject.pathname` is appended to `result`.
|
|
150
150
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
|
151
|
-
* * 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
|
|
152
|
-
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
|
|
151
|
+
* * 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
|
|
152
|
+
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
|
153
153
|
* * Otherwise, if `urlObject.search` is a string:
|
|
154
|
-
* * If the value of `urlObject.search`_does not start_ with the ASCII question
|
|
154
|
+
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
|
155
155
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
|
156
156
|
* * The value of `urlObject.search` is appended to `result`.
|
|
157
157
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
|
158
158
|
* * If the `urlObject.hash` property is a string:
|
|
159
|
-
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
|
|
159
|
+
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
|
160
160
|
* character, the literal string `#` is appended to `result`.
|
|
161
161
|
* * The value of `urlObject.hash` is appended to `result`.
|
|
162
162
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
|
@@ -172,7 +172,7 @@ declare module "url" {
|
|
|
172
172
|
* manner similar to that of a Web browser resolving an anchor tag HREF.
|
|
173
173
|
*
|
|
174
174
|
* ```js
|
|
175
|
-
* const url = require('url');
|
|
175
|
+
* const url = require('node:url');
|
|
176
176
|
* url.resolve('/one/two/three', 'four'); // '/one/two/four'
|
|
177
177
|
* url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
|
|
178
178
|
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
|
@@ -210,7 +210,7 @@ declare module "url" {
|
|
|
210
210
|
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
211
211
|
*
|
|
212
212
|
* ```js
|
|
213
|
-
* import url from 'url';
|
|
213
|
+
* import url from 'node:url';
|
|
214
214
|
*
|
|
215
215
|
* console.log(url.domainToASCII('español.com'));
|
|
216
216
|
* // Prints xn--espaol-zwa.com
|
|
@@ -231,7 +231,7 @@ declare module "url" {
|
|
|
231
231
|
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
232
232
|
*
|
|
233
233
|
* ```js
|
|
234
|
-
* import url from 'url';
|
|
234
|
+
* import url from 'node:url';
|
|
235
235
|
*
|
|
236
236
|
* console.log(url.domainToUnicode('xn--espaol-zwa.com'));
|
|
237
237
|
* // Prints español.com
|
|
@@ -248,7 +248,7 @@ declare module "url" {
|
|
|
248
248
|
* well as ensuring a cross-platform valid absolute path string.
|
|
249
249
|
*
|
|
250
250
|
* ```js
|
|
251
|
-
* import { fileURLToPath } from 'url';
|
|
251
|
+
* import { fileURLToPath } from 'node:url';
|
|
252
252
|
*
|
|
253
253
|
* const __filename = fileURLToPath(import.meta.url);
|
|
254
254
|
*
|
|
@@ -274,7 +274,7 @@ declare module "url" {
|
|
|
274
274
|
* control characters are correctly encoded when converting into a File URL.
|
|
275
275
|
*
|
|
276
276
|
* ```js
|
|
277
|
-
* import { pathToFileURL } from 'url';
|
|
277
|
+
* import { pathToFileURL } from 'node:url';
|
|
278
278
|
*
|
|
279
279
|
* new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
|
|
280
280
|
* pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
|
|
@@ -292,7 +292,7 @@ declare module "url" {
|
|
|
292
292
|
* expected by the `http.request()` and `https.request()` APIs.
|
|
293
293
|
*
|
|
294
294
|
* ```js
|
|
295
|
-
* import { urlToHttpOptions } from 'url';
|
|
295
|
+
* import { urlToHttpOptions } from 'node:url';
|
|
296
296
|
* const myURL = new URL('https://a:b@測試?abc#foo');
|
|
297
297
|
*
|
|
298
298
|
* console.log(urlToHttpOptions(myURL));
|
|
@@ -315,9 +315,26 @@ declare module "url" {
|
|
|
315
315
|
*/
|
|
316
316
|
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
|
317
317
|
interface URLFormatOptions {
|
|
318
|
+
/**
|
|
319
|
+
* `true` if the serialized URL string should include the username and password, `false` otherwise.
|
|
320
|
+
* @default true
|
|
321
|
+
*/
|
|
318
322
|
auth?: boolean | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* `true` if the serialized URL string should include the fragment, `false` otherwise.
|
|
325
|
+
* @default true
|
|
326
|
+
*/
|
|
319
327
|
fragment?: boolean | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* `true` if the serialized URL string should include the search query, `false` otherwise.
|
|
330
|
+
* @default true
|
|
331
|
+
*/
|
|
320
332
|
search?: boolean | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to
|
|
335
|
+
* being Punycode encoded.
|
|
336
|
+
* @default false
|
|
337
|
+
*/
|
|
321
338
|
unicode?: boolean | undefined;
|
|
322
339
|
}
|
|
323
340
|
/**
|
|
@@ -340,7 +357,7 @@ declare module "url" {
|
|
|
340
357
|
* const {
|
|
341
358
|
* Blob,
|
|
342
359
|
* resolveObjectURL,
|
|
343
|
-
* } = require('buffer');
|
|
360
|
+
* } = require('node:buffer');
|
|
344
361
|
*
|
|
345
362
|
* const blob = new Blob(['hello']);
|
|
346
363
|
* const id = URL.createObjectURL(blob);
|
|
@@ -366,8 +383,8 @@ declare module "url" {
|
|
|
366
383
|
* @experimental
|
|
367
384
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
368
385
|
*/
|
|
369
|
-
static revokeObjectURL(
|
|
370
|
-
constructor(input: string, base?: string | URL);
|
|
386
|
+
static revokeObjectURL(id: string): void;
|
|
387
|
+
constructor(input: string | { toString: () => string }, base?: string | URL);
|
|
371
388
|
/**
|
|
372
389
|
* Gets and sets the fragment portion of the URL.
|
|
373
390
|
*
|
|
@@ -496,14 +513,14 @@ declare module "url" {
|
|
|
496
513
|
* // Prints https://example.org/abcdef?123
|
|
497
514
|
* ```
|
|
498
515
|
*
|
|
499
|
-
* Invalid URL characters included in the value assigned to the `pathname`property are `percent-encoded`. The selection of which characters
|
|
516
|
+
* Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters
|
|
500
517
|
* to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
501
518
|
*/
|
|
502
519
|
pathname: string;
|
|
503
520
|
/**
|
|
504
521
|
* Gets and sets the port portion of the URL.
|
|
505
522
|
*
|
|
506
|
-
* 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
|
|
523
|
+
* 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
|
|
507
524
|
* result in the `port` value becoming
|
|
508
525
|
* the empty string (`''`).
|
|
509
526
|
*
|
|
@@ -643,7 +660,7 @@ declare module "url" {
|
|
|
643
660
|
* // Prints https://123:xyz@example.com/
|
|
644
661
|
* ```
|
|
645
662
|
*
|
|
646
|
-
* Any invalid URL characters appearing in the value assigned the `username`property will be `percent-encoded`. The selection of which
|
|
663
|
+
* Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which
|
|
647
664
|
* characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
648
665
|
*/
|
|
649
666
|
username: string;
|
|
@@ -671,7 +688,7 @@ declare module "url" {
|
|
|
671
688
|
toJSON(): string;
|
|
672
689
|
}
|
|
673
690
|
/**
|
|
674
|
-
* 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
|
|
691
|
+
* 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
|
|
675
692
|
* four following constructors.
|
|
676
693
|
* The `URLSearchParams` class is also available on the global object.
|
|
677
694
|
*
|
|
@@ -755,7 +772,7 @@ declare module "url" {
|
|
|
755
772
|
* @param thisArg To be used as `this` value for when `fn` is called
|
|
756
773
|
*/
|
|
757
774
|
forEach<TThis = this>(
|
|
758
|
-
|
|
775
|
+
fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
|
|
759
776
|
thisArg?: TThis,
|
|
760
777
|
): void;
|
|
761
778
|
/**
|
node v16.18/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/v16.
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.20.2/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module "url" {
|
|
11
11
|
import { Blob } from "node:buffer";
|
|
@@ -104,18 +104,18 @@ declare module "url" {
|
|
|
104
104
|
*/
|
|
105
105
|
function format(urlObject: URL, options?: URLFormatOptions): string;
|
|
106
106
|
/**
|
|
107
|
-
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
107
|
+
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
|
108
108
|
*
|
|
109
109
|
* ```js
|
|
110
|
-
* const url = require('url');
|
|
110
|
+
* const url = require('node:url');
|
|
111
111
|
* url.format({
|
|
112
112
|
* protocol: 'https',
|
|
113
113
|
* hostname: 'example.com',
|
|
114
114
|
* pathname: '/some/path',
|
|
115
115
|
* query: {
|
|
116
116
|
* page: 1,
|
|
117
|
-
* format: 'json'
|
|
118
|
-
* }
|
|
117
|
+
* format: 'json',
|
|
118
|
+
* },
|
|
119
119
|
* });
|
|
120
120
|
*
|
|
121
121
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -130,33 +130,33 @@ declare module "url" {
|
|
|
130
130
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
|
131
131
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
|
132
132
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
|
133
|
-
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
|
|
133
|
+
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
|
134
134
|
* * `urlObject.slashes` property is true;
|
|
135
|
-
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
|
|
136
|
-
* * 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
|
|
137
|
-
* and appended to `result`followed by the literal string `@`.
|
|
135
|
+
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
|
136
|
+
* * 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
|
|
137
|
+
* and appended to `result` followed by the literal string `@`.
|
|
138
138
|
* * If the `urlObject.host` property is `undefined` then:
|
|
139
139
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
|
140
140
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
|
141
141
|
* an `Error` is thrown.
|
|
142
|
-
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
|
|
142
|
+
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
|
143
143
|
* * The literal string `:` is appended to `result`, and
|
|
144
|
-
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
|
|
145
|
-
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
|
|
144
|
+
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
|
145
|
+
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
|
146
146
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
|
147
|
-
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
|
|
147
|
+
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
|
148
148
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
|
149
149
|
* * The value of `urlObject.pathname` is appended to `result`.
|
|
150
150
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
|
151
|
-
* * 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
|
|
152
|
-
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
|
|
151
|
+
* * 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
|
|
152
|
+
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
|
153
153
|
* * Otherwise, if `urlObject.search` is a string:
|
|
154
|
-
* * If the value of `urlObject.search`_does not start_ with the ASCII question
|
|
154
|
+
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
|
155
155
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
|
156
156
|
* * The value of `urlObject.search` is appended to `result`.
|
|
157
157
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
|
158
158
|
* * If the `urlObject.hash` property is a string:
|
|
159
|
-
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
|
|
159
|
+
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
|
160
160
|
* character, the literal string `#` is appended to `result`.
|
|
161
161
|
* * The value of `urlObject.hash` is appended to `result`.
|
|
162
162
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
|
@@ -172,7 +172,7 @@ declare module "url" {
|
|
|
172
172
|
* manner similar to that of a Web browser resolving an anchor tag HREF.
|
|
173
173
|
*
|
|
174
174
|
* ```js
|
|
175
|
-
* const url = require('url');
|
|
175
|
+
* const url = require('node:url');
|
|
176
176
|
* url.resolve('/one/two/three', 'four'); // '/one/two/four'
|
|
177
177
|
* url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
|
|
178
178
|
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
|
@@ -210,7 +210,7 @@ declare module "url" {
|
|
|
210
210
|
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
211
211
|
*
|
|
212
212
|
* ```js
|
|
213
|
-
* import url from 'url';
|
|
213
|
+
* import url from 'node:url';
|
|
214
214
|
*
|
|
215
215
|
* console.log(url.domainToASCII('español.com'));
|
|
216
216
|
* // Prints xn--espaol-zwa.com
|
|
@@ -231,7 +231,7 @@ declare module "url" {
|
|
|
231
231
|
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
232
232
|
*
|
|
233
233
|
* ```js
|
|
234
|
-
* import url from 'url';
|
|
234
|
+
* import url from 'node:url';
|
|
235
235
|
*
|
|
236
236
|
* console.log(url.domainToUnicode('xn--espaol-zwa.com'));
|
|
237
237
|
* // Prints español.com
|
|
@@ -248,7 +248,7 @@ declare module "url" {
|
|
|
248
248
|
* well as ensuring a cross-platform valid absolute path string.
|
|
249
249
|
*
|
|
250
250
|
* ```js
|
|
251
|
-
* import { fileURLToPath } from 'url';
|
|
251
|
+
* import { fileURLToPath } from 'node:url';
|
|
252
252
|
*
|
|
253
253
|
* const __filename = fileURLToPath(import.meta.url);
|
|
254
254
|
*
|
|
@@ -274,7 +274,7 @@ declare module "url" {
|
|
|
274
274
|
* control characters are correctly encoded when converting into a File URL.
|
|
275
275
|
*
|
|
276
276
|
* ```js
|
|
277
|
-
* import { pathToFileURL } from 'url';
|
|
277
|
+
* import { pathToFileURL } from 'node:url';
|
|
278
278
|
*
|
|
279
279
|
* new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
|
|
280
280
|
* pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
|
|
@@ -292,7 +292,7 @@ declare module "url" {
|
|
|
292
292
|
* expected by the `http.request()` and `https.request()` APIs.
|
|
293
293
|
*
|
|
294
294
|
* ```js
|
|
295
|
-
* import { urlToHttpOptions } from 'url';
|
|
295
|
+
* import { urlToHttpOptions } from 'node:url';
|
|
296
296
|
* const myURL = new URL('https://a:b@測試?abc#foo');
|
|
297
297
|
*
|
|
298
298
|
* console.log(urlToHttpOptions(myURL));
|
|
@@ -315,9 +315,26 @@ declare module "url" {
|
|
|
315
315
|
*/
|
|
316
316
|
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
|
317
317
|
interface URLFormatOptions {
|
|
318
|
+
/**
|
|
319
|
+
* `true` if the serialized URL string should include the username and password, `false` otherwise.
|
|
320
|
+
* @default true
|
|
321
|
+
*/
|
|
318
322
|
auth?: boolean | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* `true` if the serialized URL string should include the fragment, `false` otherwise.
|
|
325
|
+
* @default true
|
|
326
|
+
*/
|
|
319
327
|
fragment?: boolean | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* `true` if the serialized URL string should include the search query, `false` otherwise.
|
|
330
|
+
* @default true
|
|
331
|
+
*/
|
|
320
332
|
search?: boolean | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to
|
|
335
|
+
* being Punycode encoded.
|
|
336
|
+
* @default false
|
|
337
|
+
*/
|
|
321
338
|
unicode?: boolean | undefined;
|
|
322
339
|
}
|
|
323
340
|
/**
|
|
@@ -340,7 +357,7 @@ declare module "url" {
|
|
|
340
357
|
* const {
|
|
341
358
|
* Blob,
|
|
342
359
|
* resolveObjectURL,
|
|
343
|
-
* } = require('buffer');
|
|
360
|
+
* } = require('node:buffer');
|
|
344
361
|
*
|
|
345
362
|
* const blob = new Blob(['hello']);
|
|
346
363
|
* const id = URL.createObjectURL(blob);
|
|
@@ -366,8 +383,8 @@ declare module "url" {
|
|
|
366
383
|
* @experimental
|
|
367
384
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
368
385
|
*/
|
|
369
|
-
static revokeObjectURL(
|
|
370
|
-
constructor(input: string, base?: string | URL);
|
|
386
|
+
static revokeObjectURL(id: string): void;
|
|
387
|
+
constructor(input: string | { toString: () => string }, base?: string | URL);
|
|
371
388
|
/**
|
|
372
389
|
* Gets and sets the fragment portion of the URL.
|
|
373
390
|
*
|
|
@@ -496,14 +513,14 @@ declare module "url" {
|
|
|
496
513
|
* // Prints https://example.org/abcdef?123
|
|
497
514
|
* ```
|
|
498
515
|
*
|
|
499
|
-
* Invalid URL characters included in the value assigned to the `pathname`property are `percent-encoded`. The selection of which characters
|
|
516
|
+
* Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters
|
|
500
517
|
* to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
501
518
|
*/
|
|
502
519
|
pathname: string;
|
|
503
520
|
/**
|
|
504
521
|
* Gets and sets the port portion of the URL.
|
|
505
522
|
*
|
|
506
|
-
* 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
|
|
523
|
+
* 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
|
|
507
524
|
* result in the `port` value becoming
|
|
508
525
|
* the empty string (`''`).
|
|
509
526
|
*
|
|
@@ -643,7 +660,7 @@ declare module "url" {
|
|
|
643
660
|
* // Prints https://123:xyz@example.com/
|
|
644
661
|
* ```
|
|
645
662
|
*
|
|
646
|
-
* Any invalid URL characters appearing in the value assigned the `username`property will be `percent-encoded`. The selection of which
|
|
663
|
+
* Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which
|
|
647
664
|
* characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
|
|
648
665
|
*/
|
|
649
666
|
username: string;
|
|
@@ -671,7 +688,7 @@ declare module "url" {
|
|
|
671
688
|
toJSON(): string;
|
|
672
689
|
}
|
|
673
690
|
/**
|
|
674
|
-
* 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
|
|
691
|
+
* 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
|
|
675
692
|
* four following constructors.
|
|
676
693
|
* The `URLSearchParams` class is also available on the global object.
|
|
677
694
|
*
|
|
@@ -755,7 +772,7 @@ declare module "url" {
|
|
|
755
772
|
* @param thisArg To be used as `this` value for when `fn` is called
|
|
756
773
|
*/
|
|
757
774
|
forEach<TThis = this>(
|
|
758
|
-
|
|
775
|
+
fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
|
|
759
776
|
thisArg?: TThis,
|
|
760
777
|
): void;
|
|
761
778
|
/**
|