@types/node 16.4.2 → 16.4.6

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/punycode.d.ts CHANGED
@@ -1,41 +1,81 @@
1
1
  /**
2
- * @deprecated since v7.0.0
3
- * The version of the punycode module bundled in Node.js is being deprecated.
4
- * In a future major version of Node.js this module will be removed.
5
- * Users currently depending on the punycode module should switch to using
6
- * the userland-provided Punycode.js module instead.
2
+ * **The version of the punycode module bundled in Node.js is being deprecated**.
3
+ * In a future major version of Node.js this module will be removed. Users
4
+ * currently depending on the `punycode` module should switch to using the
5
+ * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
6
+ * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
7
+ *
8
+ * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It
9
+ * can be accessed using:
10
+ *
11
+ * ```js
12
+ * const punycode = require('punycode');
13
+ * ```
14
+ *
15
+ * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is
16
+ * primarily intended for use in Internationalized Domain Names. Because host
17
+ * names in URLs are limited to ASCII characters only, Domain Names that contain
18
+ * non-ASCII characters must be converted into ASCII using the Punycode scheme.
19
+ * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
20
+ * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`.
21
+ *
22
+ * The `punycode` module provides a simple implementation of the Punycode standard.
23
+ *
24
+ * The `punycode` module is a third-party dependency used by Node.js and
25
+ * made available to developers as a convenience. Fixes or other modifications to
26
+ * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
27
+ * @deprecated Since v7.0.0 - Deprecated
28
+ * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/punycode.js)
7
29
  */
8
30
  declare module 'punycode' {
9
31
  /**
10
- * @deprecated since v7.0.0
11
- * The version of the punycode module bundled in Node.js is being deprecated.
12
- * In a future major version of Node.js this module will be removed.
13
- * Users currently depending on the punycode module should switch to using
14
- * the userland-provided Punycode.js module instead.
32
+ * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only
33
+ * characters to the equivalent string of Unicode codepoints.
34
+ *
35
+ * ```js
36
+ * punycode.decode('maana-pta'); // 'mañana'
37
+ * punycode.decode('--dqo34k'); // '☃-⌘'
38
+ * ```
39
+ * @since v0.5.1
15
40
  */
16
41
  function decode(string: string): string;
17
42
  /**
18
- * @deprecated since v7.0.0
19
- * The version of the punycode module bundled in Node.js is being deprecated.
20
- * In a future major version of Node.js this module will be removed.
21
- * Users currently depending on the punycode module should switch to using
22
- * the userland-provided Punycode.js module instead.
43
+ * The `punycode.encode()` method converts a string of Unicode codepoints to a[Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.
44
+ *
45
+ * ```js
46
+ * punycode.encode('mañana'); // 'maana-pta'
47
+ * punycode.encode('☃-⌘'); // '--dqo34k'
48
+ * ```
49
+ * @since v0.5.1
23
50
  */
24
51
  function encode(string: string): string;
25
52
  /**
26
- * @deprecated since v7.0.0
27
- * The version of the punycode module bundled in Node.js is being deprecated.
28
- * In a future major version of Node.js this module will be removed.
29
- * Users currently depending on the punycode module should switch to using
30
- * the userland-provided Punycode.js module instead.
53
+ * The `punycode.toUnicode()` method converts a string representing a domain name
54
+ * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492)encoded parts of the domain name are be
55
+ * converted.
56
+ *
57
+ * ```js
58
+ * // decode domain names
59
+ * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com'
60
+ * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com'
61
+ * punycode.toUnicode('example.com'); // 'example.com'
62
+ * ```
63
+ * @since v0.6.1
31
64
  */
32
65
  function toUnicode(domain: string): string;
33
66
  /**
34
- * @deprecated since v7.0.0
35
- * The version of the punycode module bundled in Node.js is being deprecated.
36
- * In a future major version of Node.js this module will be removed.
37
- * Users currently depending on the punycode module should switch to using
38
- * the userland-provided Punycode.js module instead.
67
+ * The `punycode.toASCII()` method converts a Unicode string representing an
68
+ * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the
69
+ * domain name will be converted. Calling `punycode.toASCII()` on a string that
70
+ * already only contains ASCII characters will have no effect.
71
+ *
72
+ * ```js
73
+ * // encode domain names
74
+ * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com'
75
+ * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com'
76
+ * punycode.toASCII('example.com'); // 'example.com'
77
+ * ```
78
+ * @since v0.6.1
39
79
  */
40
80
  function toASCII(domain: string): string;
41
81
  /**
@@ -73,7 +113,6 @@ declare module 'punycode' {
73
113
  */
74
114
  const version: string;
75
115
  }
76
-
77
116
  declare module 'node:punycode' {
78
117
  export * from 'punycode';
79
118
  }
node/querystring.d.ts CHANGED
@@ -1,19 +1,95 @@
1
+ /**
2
+ * The `querystring` module provides utilities for parsing and formatting URL
3
+ * query strings. It can be accessed using:
4
+ *
5
+ * ```js
6
+ * const querystring = require('querystring');
7
+ * ```
8
+ *
9
+ * The `querystring` API is considered Legacy. While it is still maintained,
10
+ * new code should use the `<URLSearchParams>` API instead.
11
+ * @deprecated Legacy
12
+ * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/querystring.js)
13
+ */
1
14
  declare module 'querystring' {
2
15
  interface StringifyOptions {
3
16
  encodeURIComponent?: ((str: string) => string) | undefined;
4
17
  }
5
-
6
18
  interface ParseOptions {
7
19
  maxKeys?: number | undefined;
8
20
  decodeURIComponent?: ((str: string) => string) | undefined;
9
21
  }
10
-
11
- interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> { }
12
-
13
- interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {
14
- }
15
-
22
+ interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
23
+ interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
24
+ /**
25
+ * The `querystring.stringify()` method produces a URL query string from a
26
+ * given `obj` by iterating through the object's "own properties".
27
+ *
28
+ * It serializes the following types of values passed in `obj`:[&lt;string&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
29
+ * [&lt;number&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
30
+ * [&lt;bigint&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
31
+ * [&lt;boolean&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
32
+ * [&lt;string\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
33
+ * [&lt;number\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
34
+ * [&lt;bigint\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
35
+ * [&lt;boolean\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)The numeric values must be finite. Any other input values will be coerced to
36
+ * empty strings.
37
+ *
38
+ * ```js
39
+ * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
40
+ * // Returns 'foo=bar&#x26;baz=qux&#x26;baz=quux&#x26;corge='
41
+ *
42
+ * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
43
+ * // Returns 'foo:bar;baz:qux'
44
+ * ```
45
+ *
46
+ * By default, characters requiring percent-encoding within the query string will
47
+ * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified:
48
+ *
49
+ * ```js
50
+ * // Assuming gbkEncodeURIComponent function already exists,
51
+ *
52
+ * querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
53
+ * { encodeURIComponent: gbkEncodeURIComponent });
54
+ * ```
55
+ * @since v0.1.25
56
+ * @param obj The object to serialize into a URL query string
57
+ * @param sep The substring used to delimit key and value pairs in the query string.
58
+ * @param eq . The substring used to delimit keys and values in the query string.
59
+ */
16
60
  function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
61
+ /**
62
+ * The `querystring.parse()` method parses a URL query string (`str`) into a
63
+ * collection of key and value pairs.
64
+ *
65
+ * For example, the query string `'foo=bar&#x26;abc=xyz&#x26;abc=123'` is parsed into:
66
+ *
67
+ * ```js
68
+ * {
69
+ * foo: 'bar',
70
+ * abc: ['xyz', '123']
71
+ * }
72
+ * ```
73
+ *
74
+ * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`,
75
+ * `obj.hasOwnProperty()`, and others
76
+ * are not defined and _will not work_.
77
+ *
78
+ * By default, percent-encoded characters within the query string will be assumed
79
+ * to use UTF-8 encoding. If an alternative character encoding is used, then an
80
+ * alternative `decodeURIComponent` option will need to be specified:
81
+ *
82
+ * ```js
83
+ * // Assuming gbkDecodeURIComponent function already exists...
84
+ *
85
+ * querystring.parse('w=%D6%D0%CE%C4&#x26;foo=bar', null, null,
86
+ * { decodeURIComponent: gbkDecodeURIComponent });
87
+ * ```
88
+ * @since v0.1.25
89
+ * @param str The URL query string to parse
90
+ * @param sep The substring used to delimit key and value pairs in the query string.
91
+ * @param eq . The substring used to delimit keys and values in the query string.
92
+ */
17
93
  function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
18
94
  /**
19
95
  * The querystring.encode() function is an alias for querystring.stringify().
@@ -23,10 +99,33 @@ declare module 'querystring' {
23
99
  * The querystring.decode() function is an alias for querystring.parse().
24
100
  */
25
101
  const decode: typeof parse;
102
+ /**
103
+ * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL
104
+ * query strings.
105
+ *
106
+ * The `querystring.escape()` method is used by `querystring.stringify()` and is
107
+ * generally not expected to be used directly. It is exported primarily to allow
108
+ * application code to provide a replacement percent-encoding implementation if
109
+ * necessary by assigning `querystring.escape` to an alternative function.
110
+ * @since v0.1.25
111
+ */
26
112
  function escape(str: string): string;
113
+ /**
114
+ * The `querystring.unescape()` method performs decoding of URL percent-encoded
115
+ * characters on the given `str`.
116
+ *
117
+ * The `querystring.unescape()` method is used by `querystring.parse()` and is
118
+ * generally not expected to be used directly. It is exported primarily to allow
119
+ * application code to provide a replacement decoding implementation if
120
+ * necessary by assigning `querystring.unescape` to an alternative function.
121
+ *
122
+ * By default, the `querystring.unescape()` method will attempt to use the
123
+ * JavaScript built-in `decodeURIComponent()` method to decode. If that fails,
124
+ * a safer equivalent that does not throw on malformed URLs will be used.
125
+ * @since v0.1.25
126
+ */
27
127
  function unescape(str: string): string;
28
128
  }
29
-
30
129
  declare module 'node:querystring' {
31
130
  export * from 'querystring';
32
131
  }