@types/node 20.12.6 → 20.12.8

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 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.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 09 Apr 2024 04:08:23 GMT
11
+ * Last updated: Wed, 01 May 2024 18:36:06 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/assert.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The `node:assert` module provides a set of assertion functions for verifying
3
3
  * invariants.
4
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js)
4
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/assert.js)
5
5
  */
6
6
  declare module "assert" {
7
7
  /**
@@ -12,7 +12,7 @@ declare module "assert" {
12
12
  function assert(value: unknown, message?: string | Error): asserts value;
13
13
  namespace assert {
14
14
  /**
15
- * Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class.
15
+ * Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
16
16
  */
17
17
  class AssertionError extends Error {
18
18
  /**
@@ -76,7 +76,7 @@ declare module "assert" {
76
76
  * @since v14.2.0, v12.19.0
77
77
  * @param [fn='A no-op function']
78
78
  * @param [exact=1]
79
- * @return that wraps `fn`.
79
+ * @return A function that wraps `fn`.
80
80
  */
81
81
  calls(exact?: number): () => void;
82
82
  calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
@@ -96,8 +96,7 @@ declare module "assert" {
96
96
  * [{ thisArg: undefined, arguments: [1, 2, 3] }]);
97
97
  * ```
98
98
  * @since v18.8.0, v16.18.0
99
- * @param fn
100
- * @return An Array with all the calls to a tracked function.
99
+ * @return An array with all the calls to a tracked function.
101
100
  */
102
101
  getCalls(fn: Function): CallTrackerCall[];
103
102
  /**
@@ -130,12 +129,11 @@ declare module "assert" {
130
129
  * // ]
131
130
  * ```
132
131
  * @since v14.2.0, v12.19.0
133
- * @return An Array of objects containing information about the wrapper functions returned by `calls`.
132
+ * @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
134
133
  */
135
134
  report(): CallTrackerReportInformation[];
136
135
  /**
137
- * Reset calls of the call tracker.
138
- * If a tracked function is passed as an argument, the calls will be reset for it.
136
+ * Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
139
137
  * If no arguments are passed, all tracked functions will be reset.
140
138
  *
141
139
  * ```js
@@ -158,7 +156,7 @@ declare module "assert" {
158
156
  */
159
157
  reset(fn?: Function): void;
160
158
  /**
161
- * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
159
+ * Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
162
160
  * have not been called the expected number of times.
163
161
  *
164
162
  * ```js
@@ -232,10 +230,10 @@ declare module "assert" {
232
230
  stackStartFn?: Function,
233
231
  ): never;
234
232
  /**
235
- * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
233
+ * Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
236
234
  *
237
- * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
238
- * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
235
+ * If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
236
+ * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
239
237
  * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
240
238
  *
241
239
  * Be aware that in the `repl` the error message will be different to the one
@@ -317,8 +315,8 @@ declare module "assert" {
317
315
  * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
318
316
  * ```
319
317
  *
320
- * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
321
- * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
318
+ * If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
319
+ * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
322
320
  * @since v0.1.21
323
321
  */
324
322
  function equal(actual: unknown, expected: unknown, message?: string | Error): void;
@@ -347,8 +345,8 @@ declare module "assert" {
347
345
  * // AssertionError: 1 != '1'
348
346
  * ```
349
347
  *
350
- * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
351
- * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
348
+ * If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
349
+ * message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
352
350
  * @since v0.1.21
353
351
  */
354
352
  function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
@@ -414,8 +412,8 @@ declare module "assert" {
414
412
  * // OK
415
413
  * ```
416
414
  *
417
- * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
418
- * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
415
+ * If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
416
+ * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
419
417
  * instead of the `AssertionError`.
420
418
  * @since v0.1.21
421
419
  */
@@ -452,8 +450,8 @@ declare module "assert" {
452
450
  * // TypeError: Inputs are not identical
453
451
  * ```
454
452
  *
455
- * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
456
- * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
453
+ * If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
454
+ * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
457
455
  * instead of the `AssertionError`.
458
456
  * @since v0.1.21
459
457
  */
@@ -477,8 +475,8 @@ declare module "assert" {
477
475
  * // OK
478
476
  * ```
479
477
  *
480
- * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
481
- * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
478
+ * If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
479
+ * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
482
480
  * instead of the `AssertionError`.
483
481
  * @since v0.1.21
484
482
  */
@@ -519,7 +517,7 @@ declare module "assert" {
519
517
  * using an object, it is also possible to use a regular expression, when
520
518
  * validating against a string property. See below for examples.
521
519
  *
522
- * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
520
+ * If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
523
521
  * fails.
524
522
  *
525
523
  * Custom validation object/error instance:
@@ -649,8 +647,8 @@ declare module "assert" {
649
647
  * ```
650
648
  *
651
649
  * `error` cannot be a string. If a string is provided as the second
652
- * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
653
- * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
650
+ * argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
651
+ * message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
654
652
  * a string as the second argument gets considered:
655
653
  *
656
654
  * ```js
@@ -703,9 +701,9 @@ declare module "assert" {
703
701
  * adding a comment next to the specific code path that should not throw and keep
704
702
  * error messages as expressive as possible.
705
703
  *
706
- * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
704
+ * When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
707
705
  *
708
- * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
706
+ * If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
709
707
  * different type, or if the `error` parameter is undefined, the error is
710
708
  * propagated back to the caller.
711
709
  *
@@ -741,7 +739,7 @@ declare module "assert" {
741
739
  * );
742
740
  * ```
743
741
  *
744
- * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
742
+ * If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message:
745
743
  *
746
744
  * ```js
747
745
  * import assert from 'node:assert/strict';
@@ -762,7 +760,7 @@ declare module "assert" {
762
760
  /**
763
761
  * Throws `value` if `value` is not `undefined` or `null`. This is useful when
764
762
  * testing the `error` argument in callbacks. The stack trace contains all frames
765
- * from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
763
+ * from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
766
764
  *
767
765
  * ```js
768
766
  * import assert from 'node:assert/strict';
@@ -797,18 +795,18 @@ declare module "assert" {
797
795
  * calls the function and awaits the returned promise to complete. It will then
798
796
  * check that the promise is rejected.
799
797
  *
800
- * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
801
- * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
802
- * handler is skipped.
798
+ * If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
799
+ * function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value)
800
+ * error. In both cases the error handler is skipped.
803
801
  *
804
802
  * Besides the async nature to await the completion behaves identically to {@link throws}.
805
803
  *
806
804
  * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
807
805
  * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
808
806
  * an object where each property will be tested for, or an instance of error where
809
- * each property will be tested for including the non-enumerable `message` and`name` properties.
807
+ * each property will be tested for including the non-enumerable `message` and `name` properties.
810
808
  *
811
- * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
809
+ * If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
812
810
  *
813
811
  * ```js
814
812
  * import assert from 'node:assert/strict';
@@ -850,10 +848,9 @@ declare module "assert" {
850
848
  * });
851
849
  * ```
852
850
  *
853
- * `error` cannot be a string. If a string is provided as the second
854
- * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
855
- * example in {@link throws} carefully if using a string as the second
856
- * argument gets considered.
851
+ * `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
852
+ * be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
853
+ * example in {@link throws} carefully if using a string as the second argument gets considered.
857
854
  * @since v10.0.0
858
855
  */
859
856
  function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
@@ -867,9 +864,9 @@ declare module "assert" {
867
864
  * calls the function and awaits the returned promise to complete. It will then
868
865
  * check that the promise is not rejected.
869
866
  *
870
- * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
867
+ * If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
871
868
  * the function does not return a promise, `assert.doesNotReject()` will return a
872
- * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
869
+ * rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value) error. In both cases
873
870
  * the error handler is skipped.
874
871
  *
875
872
  * Using `assert.doesNotReject()` is actually not useful because there is little
@@ -929,10 +926,10 @@ declare module "assert" {
929
926
  * // OK
930
927
  * ```
931
928
  *
932
- * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
929
+ * If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
933
930
  * to the value of the `message` parameter. If the `message` parameter is
934
931
  * undefined, a default error message is assigned. If the `message` parameter is an
935
- * instance of an `Error` then it will be thrown instead of the `AssertionError`.
932
+ * instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
936
933
  * @since v13.6.0, v12.16.0
937
934
  */
938
935
  function match(value: string, regExp: RegExp, message?: string | Error): void;
@@ -952,13 +949,60 @@ declare module "assert" {
952
949
  * // OK
953
950
  * ```
954
951
  *
955
- * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
952
+ * If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
956
953
  * to the value of the `message` parameter. If the `message` parameter is
957
954
  * undefined, a default error message is assigned. If the `message` parameter is an
958
- * instance of an `Error` then it will be thrown instead of the `AssertionError`.
955
+ * instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
959
956
  * @since v13.6.0, v12.16.0
960
957
  */
961
958
  function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
959
+ /**
960
+ * In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
961
+ * {@link deepEqual} will behave like {@link deepStrictEqual}.
962
+ *
963
+ * In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
964
+ * messages for objects display the objects, often truncated.
965
+ *
966
+ * To use strict assertion mode:
967
+ *
968
+ * ```js
969
+ * import { strict as assert } from 'node:assert';COPY
970
+ * import assert from 'node:assert/strict';
971
+ * ```
972
+ *
973
+ * Example error diff:
974
+ *
975
+ * ```js
976
+ * import { strict as assert } from 'node:assert';
977
+ *
978
+ * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
979
+ * // AssertionError: Expected inputs to be strictly deep-equal:
980
+ * // + actual - expected ... Lines skipped
981
+ * //
982
+ * // [
983
+ * // [
984
+ * // ...
985
+ * // 2,
986
+ * // + 3
987
+ * // - '3'
988
+ * // ],
989
+ * // ...
990
+ * // 5
991
+ * // ]
992
+ * ```
993
+ *
994
+ * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
995
+ * deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
996
+ * `getColorDepth()` documentation.
997
+ *
998
+ * @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
999
+ */
1000
+ namespace strict {
1001
+ type AssertionError = assert.AssertionError;
1002
+ type AssertPredicate = assert.AssertPredicate;
1003
+ type CallTrackerCall = assert.CallTrackerCall;
1004
+ type CallTrackerReportInformation = assert.CallTrackerReportInformation;
1005
+ }
962
1006
  const strict:
963
1007
  & Omit<
964
1008
  typeof assert,
node/async_hooks.d.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * We strongly discourage the use of the `async_hooks` API.
3
3
  * Other APIs that can cover most of its use cases include:
4
4
  *
5
- * * `AsyncLocalStorage` tracks async context
6
- * * `process.getActiveResourcesInfo()` tracks active resources
5
+ * * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v20.x/api/async_context.html#class-asynclocalstorage) tracks async context
6
+ * * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
7
7
  *
8
8
  * The `node:async_hooks` module provides an API to track asynchronous resources.
9
9
  * It can be accessed using:
@@ -12,7 +12,7 @@
12
12
  * import async_hooks from 'node:async_hooks';
13
13
  * ```
14
14
  * @experimental
15
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js)
15
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/async_hooks.js)
16
16
  */
17
17
  declare module "async_hooks" {
18
18
  /**
@@ -44,7 +44,7 @@ declare module "async_hooks" {
44
44
  * ```
45
45
  *
46
46
  * Promise contexts may not get precise `executionAsyncIds` by default.
47
- * See the section on `promise execution tracking`.
47
+ * See the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
48
48
  * @since v8.1.0
49
49
  * @return The `asyncId` of the current execution context. Useful to track when something calls.
50
50
  */
@@ -117,17 +117,17 @@ declare module "async_hooks" {
117
117
  * ```
118
118
  *
119
119
  * Promise contexts may not get valid `triggerAsyncId`s by default. See
120
- * the section on `promise execution tracking`.
120
+ * the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
121
121
  * @return The ID of the resource responsible for calling the callback that is currently being executed.
122
122
  */
123
123
  function triggerAsyncId(): number;
124
124
  interface HookCallbacks {
125
125
  /**
126
126
  * Called when a class is constructed that has the possibility to emit an asynchronous event.
127
- * @param asyncId a unique ID for the async resource
128
- * @param type the type of the async resource
129
- * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
130
- * @param resource reference to the resource representing the async operation, needs to be released during destroy
127
+ * @param asyncId A unique ID for the async resource
128
+ * @param type The type of the async resource
129
+ * @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
130
+ * @param resource Reference to the resource representing the async operation, needs to be released during destroy
131
131
  */
132
132
  init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
133
133
  /**
@@ -137,7 +137,9 @@ declare module "async_hooks" {
137
137
  */
138
138
  before?(asyncId: number): void;
139
139
  /**
140
- * Called immediately after the callback specified in before is completed.
140
+ * Called immediately after the callback specified in `before` is completed.
141
+ *
142
+ * If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
141
143
  * @param asyncId the unique identifier assigned to the resource which has executed the callback.
142
144
  */
143
145
  after?(asyncId: number): void;
@@ -321,7 +323,7 @@ declare module "async_hooks" {
321
323
  /**
322
324
  * This class creates stores that stay coherent through asynchronous operations.
323
325
  *
324
- * While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory
326
+ * While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
325
327
  * safe implementation that involves significant optimizations that are non-obvious
326
328
  * to implement.
327
329
  *
@@ -407,12 +409,12 @@ declare module "async_hooks" {
407
409
  static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
408
410
  /**
409
411
  * Disables the instance of `AsyncLocalStorage`. All subsequent calls
410
- * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
412
+ * to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
411
413
  *
412
414
  * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
413
415
  * instance will be exited.
414
416
  *
415
- * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
417
+ * Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
416
418
  * provided by the `asyncLocalStorage`, as those objects are garbage collected
417
419
  * along with the corresponding async resources.
418
420
  *
@@ -465,7 +467,7 @@ declare module "async_hooks" {
465
467
  /**
466
468
  * Runs a function synchronously outside of a context and returns its
467
469
  * return value. The store is not accessible within the callback function or
468
- * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
470
+ * the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
469
471
  *
470
472
  * The optional `args` are passed to the callback function.
471
473
  *
@@ -511,7 +513,7 @@ declare module "async_hooks" {
511
513
  * This transition will continue for the _entire_ synchronous execution.
512
514
  * This means that if, for example, the context is entered within an event
513
515
  * handler subsequent event handlers will also run within that context unless
514
- * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
516
+ * specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
515
517
  * to use the latter method.
516
518
  *
517
519
  * ```js
node/buffer.d.ts CHANGED
@@ -41,7 +41,7 @@
41
41
  * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
42
42
  * const buf7 = Buffer.from('tést', 'latin1');
43
43
  * ```
44
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js)
44
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/buffer.js)
45
45
  */
46
46
  declare module "buffer" {
47
47
  import { BinaryLike } from "node:crypto";
@@ -311,12 +311,12 @@ declare module "buffer" {
311
311
  *
312
312
  * If `array` is an `Array`\-like object (that is, one with a `length` property of
313
313
  * type `number`), it is treated as if it is an array, unless it is a `Buffer` or
314
- * a `Uint8Array`. This means all other `TypedArray` variants get treated as an`Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
314
+ * a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
315
315
  *
316
316
  * A `TypeError` will be thrown if `array` is not an `Array` or another type
317
317
  * appropriate for `Buffer.from()` variants.
318
318
  *
319
- * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
319
+ * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
320
320
  * @since v5.10.0
321
321
  */
322
322
  from(
@@ -420,9 +420,9 @@ declare module "buffer" {
420
420
  encoding?: BufferEncoding,
421
421
  ): number;
422
422
  /**
423
- * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
423
+ * Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
424
424
  *
425
- * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned.
425
+ * If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
426
426
  *
427
427
  * If `totalLength` is not provided, it is calculated from the `Buffer` instances
428
428
  * in `list` by adding their lengths.
@@ -476,7 +476,7 @@ declare module "buffer" {
476
476
  */
477
477
  copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
478
478
  /**
479
- * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
479
+ * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
480
480
  *
481
481
  * ```js
482
482
  * import { Buffer } from 'node:buffer';
@@ -2098,7 +2098,7 @@ declare module "buffer" {
2098
2098
  * // Prints: 6
2099
2099
  * ```
2100
2100
  *
2101
- * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
2101
+ * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
2102
2102
  * an integer between 0 and 255.
2103
2103
  *
2104
2104
  * If `byteOffset` is not a number, it will be coerced to a number. If the result
node/child_process.d.ts CHANGED
@@ -63,7 +63,7 @@
63
63
  * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
64
64
  * the synchronous methods can have significant impact on performance due to
65
65
  * stalling the event loop while spawned processes complete.
66
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/child_process.js)
66
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/child_process.js)
67
67
  */
68
68
  declare module "child_process" {
69
69
  import { ObjectEncodingOptions } from "node:fs";
node/cluster.d.ts CHANGED
@@ -50,7 +50,7 @@
50
50
  * ```
51
51
  *
52
52
  * On Windows, it is not yet possible to set up a named pipe server in a worker.
53
- * @see [source](https://github.com/nodejs/node/blob/v20.11.1/lib/cluster.js)
53
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/cluster.js)
54
54
  */
55
55
  declare module "cluster" {
56
56
  import * as child from "node:child_process";
node/console.d.ts CHANGED
@@ -54,7 +54,7 @@
54
54
  * myConsole.warn(`Danger ${name}! Danger!`);
55
55
  * // Prints: Danger Will Robinson! Danger!, to err
56
56
  * ```
57
- * @see [source](https://github.com/nodejs/node/blob/v20.12.1/lib/console.js)
57
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/console.js)
58
58
  */
59
59
  declare module "console" {
60
60
  import console = require("node:console");
node/crypto.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * // Prints:
15
15
  * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
16
16
  * ```
17
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js)
17
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/crypto.js)
18
18
  */
19
19
  declare module "crypto" {
20
20
  import * as stream from "node:stream";
@@ -27,7 +27,7 @@ declare module "crypto" {
27
27
  * should not use this element anymore.
28
28
  *
29
29
  * The `node:crypto` module provides the `Certificate` class for working with SPKAC
30
- * data. The most common usage is handling output generated by the HTML5`<keygen>` element. Node.js uses [OpenSSL's SPKAC
30
+ * data. The most common usage is handling output generated by the HTML5 `<keygen>` element. Node.js uses [OpenSSL's SPKAC
31
31
  * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally.
32
32
  * @since v0.11.8
33
33
  */
@@ -3344,7 +3344,7 @@ declare module "crypto" {
3344
3344
  callback: (error: Error | null, data: Buffer) => void,
3345
3345
  ): void;
3346
3346
  /**
3347
- * Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
3347
+ * Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
3348
3348
  * key type (especially Ed25519 and Ed448).
3349
3349
  *
3350
3350
  * If `key` is not a `KeyObject`, this function behaves as if `key` had been
@@ -3378,6 +3378,41 @@ declare module "crypto" {
3378
3378
  * @since v13.9.0, v12.17.0
3379
3379
  */
3380
3380
  function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
3381
+ /**
3382
+ * A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data
3383
+ * (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm`
3384
+ * is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases
3385
+ * of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms.
3386
+ *
3387
+ * Example:
3388
+ *
3389
+ * ```js
3390
+ * const crypto = require('node:crypto');
3391
+ * const { Buffer } = require('node:buffer');
3392
+ *
3393
+ * // Hashing a string and return the result as a hex-encoded string.
3394
+ * const string = 'Node.js';
3395
+ * // 10b3493287f831e81a438811a1ffba01f8cec4b7
3396
+ * console.log(crypto.hash('sha1', string));
3397
+ *
3398
+ * // Encode a base64-encoded string into a Buffer, hash it and return
3399
+ * // the result as a buffer.
3400
+ * const base64 = 'Tm9kZS5qcw==';
3401
+ * // <Buffer 10 b3 49 32 87 f8 31 e8 1a 43 88 11 a1 ff ba 01 f8 ce c4 b7>
3402
+ * console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer'));
3403
+ * ```
3404
+ * @since v21.7.0, v20.12.0
3405
+ * @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user
3406
+ * could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead.
3407
+ * @param [outputEncoding='hex'] [Encoding](https://nodejs.org/docs/latest-v20.x/api/buffer.html#buffers-and-character-encodings) used to encode the returned digest.
3408
+ */
3409
+ function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
3410
+ function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): Buffer;
3411
+ function hash(
3412
+ algorithm: string,
3413
+ data: BinaryLike,
3414
+ outputEncoding?: BinaryToTextEncoding | "buffer",
3415
+ ): string | Buffer;
3381
3416
  type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
3382
3417
  interface CipherInfoOptions {
3383
3418
  /**