@types/node 20.19.25 → 24.10.3

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.
Files changed (79) hide show
  1. {node v20.19 → node v24.10}/README.md +3 -3
  2. node v24.10/assert/strict.d.ts +111 -0
  3. {node v20.19 → node v24.10}/assert.d.ts +150 -97
  4. {node v20.19 → node v24.10}/async_hooks.d.ts +27 -9
  5. {node v20.19 → node v24.10}/buffer.buffer.d.ts +2 -1
  6. {node v20.19 → node v24.10}/buffer.d.ts +6 -8
  7. {node v20.19 → node v24.10}/child_process.d.ts +11 -10
  8. {node v20.19 → node v24.10}/cluster.d.ts +16 -15
  9. {node v20.19 → node v24.10}/console.d.ts +19 -18
  10. {node v20.19 → node v24.10}/crypto.d.ts +1120 -293
  11. {node v20.19 → node v24.10}/dgram.d.ts +5 -2
  12. {node v20.19 → node v24.10}/diagnostics_channel.d.ts +1 -3
  13. {node v20.19 → node v24.10}/dns/promises.d.ts +30 -6
  14. {node v20.19 → node v24.10}/dns.d.ts +69 -17
  15. {node v20.19 → node v24.10}/domain.d.ts +1 -1
  16. {node v20.19 → node v24.10}/events.d.ts +1 -2
  17. {node v20.19 → node v24.10}/fs/promises.d.ts +85 -38
  18. {node v20.19 → node v24.10}/fs.d.ts +387 -48
  19. {node v20.19 → node v24.10}/globals.d.ts +2 -4
  20. {node v20.19 → node v24.10}/globals.typedarray.d.ts +3 -0
  21. {node v20.19 → node v24.10}/http.d.ts +90 -5
  22. {node v20.19 → node v24.10}/http2.d.ts +166 -41
  23. {node v20.19 → node v24.10}/https.d.ts +4 -3
  24. {node v20.19 → node v24.10}/index.d.ts +13 -5
  25. node v24.10/inspector.d.ts +277 -0
  26. {node v20.19 → node v24.10}/inspector.generated.d.ts +1096 -829
  27. {node v20.19 → node v24.10}/module.d.ts +403 -48
  28. {node v20.19 → node v24.10}/net.d.ts +62 -20
  29. {node v20.19 → node v24.10}/os.d.ts +8 -7
  30. {node v20.19 → node v24.10}/package.json +18 -3
  31. {node v20.19 → node v24.10}/path.d.ts +3 -3
  32. {node v20.19 → node v24.10}/perf_hooks.d.ts +37 -16
  33. {node v20.19 → node v24.10}/process.d.ts +133 -16
  34. {node v20.19 → node v24.10}/punycode.d.ts +1 -1
  35. {node v20.19 → node v24.10}/querystring.d.ts +1 -1
  36. {node v20.19 → node v24.10}/readline/promises.d.ts +0 -1
  37. {node v20.19 → node v24.10}/readline.d.ts +19 -14
  38. {node v20.19 → node v24.10}/repl.d.ts +25 -17
  39. {node v20.19 → node v24.10}/sea.d.ts +11 -2
  40. node v24.10/sqlite.d.ts +937 -0
  41. {node v20.19 → node v24.10}/stream/web.d.ts +85 -45
  42. {node v20.19 → node v24.10}/stream.d.ts +36 -28
  43. {node v20.19 → node v24.10}/string_decoder.d.ts +1 -1
  44. {node v20.19 → node v24.10}/test.d.ts +587 -35
  45. {node v20.19 → node v24.10}/timers/promises.d.ts +1 -1
  46. {node v20.19 → node v24.10}/timers.d.ts +4 -5
  47. {node v20.19 → node v24.10}/tls.d.ts +62 -48
  48. {node v20.19 → node v24.10}/trace_events.d.ts +6 -6
  49. node v24.10/ts5.6/compatibility/float16array.d.ts +71 -0
  50. {node v20.19 → node v24.10}/ts5.6/globals.typedarray.d.ts +2 -0
  51. {node v20.19 → node v24.10}/ts5.6/index.d.ts +15 -5
  52. node v24.10/ts5.7/compatibility/float16array.d.ts +72 -0
  53. node v24.10/ts5.7/index.d.ts +103 -0
  54. {node v20.19 → node v24.10}/tty.d.ts +1 -1
  55. {node v20.19 → node v24.10}/url.d.ts +128 -35
  56. {node v20.19 → node v24.10}/util.d.ts +384 -390
  57. {node v20.19 → node v24.10}/v8.d.ts +175 -32
  58. {node v20.19 → node v24.10}/vm.d.ts +246 -67
  59. {node v20.19 → node v24.10}/wasi.d.ts +23 -2
  60. node v24.10/web-globals/crypto.d.ts +32 -0
  61. {node v20.19 → node v24.10}/web-globals/fetch.d.ts +4 -0
  62. node v24.10/web-globals/navigator.d.ts +25 -0
  63. node v24.10/web-globals/storage.d.ts +24 -0
  64. node v24.10/web-globals/streams.d.ts +22 -0
  65. {node v20.19 → node v24.10}/worker_threads.d.ts +205 -24
  66. {node v20.19 → node v24.10}/zlib.d.ts +185 -44
  67. node v20.19/assert/strict.d.ts +0 -8
  68. node v20.19/compatibility/disposable.d.ts +0 -16
  69. node v20.19/compatibility/index.d.ts +0 -9
  70. node v20.19/compatibility/indexable.d.ts +0 -20
  71. {node v20.19 → node v24.10}/LICENSE +0 -0
  72. {node v20.19 → node v24.10}/compatibility/iterators.d.ts +0 -0
  73. {node v20.19 → node v24.10}/constants.d.ts +0 -0
  74. {node v20.19 → node v24.10}/stream/consumers.d.ts +0 -0
  75. {node v20.19 → node v24.10}/stream/promises.d.ts +0 -0
  76. {node v20.19 → node v24.10}/ts5.6/buffer.buffer.d.ts +0 -0
  77. {node v20.19 → node v24.10}/web-globals/abortcontroller.d.ts +0 -0
  78. {node v20.19 → node v24.10}/web-globals/domexception.d.ts +0 -0
  79. {node v20.19 → node v24.10}/web-globals/events.d.ts +0 -0
@@ -76,6 +76,7 @@ declare module "process" {
76
76
  "repl": typeof import("repl");
77
77
  "node:repl": typeof import("node:repl");
78
78
  "node:sea": typeof import("node:sea");
79
+ "node:sqlite": typeof import("node:sqlite");
79
80
  "stream": typeof import("stream");
80
81
  "node:stream": typeof import("node:stream");
81
82
  "stream/consumers": typeof import("stream/consumers");
@@ -117,7 +118,6 @@ declare module "process" {
117
118
  "zlib": typeof import("zlib");
118
119
  "node:zlib": typeof import("node:zlib");
119
120
  }
120
-
121
121
  global {
122
122
  var process: NodeJS.Process;
123
123
  namespace NodeJS {
@@ -188,13 +188,16 @@ declare module "process" {
188
188
  readonly inspector: boolean;
189
189
  /**
190
190
  * A boolean value that is `true` if the current Node.js build includes support for IPv6.
191
+ *
192
+ * Since all Node.js builds have IPv6 support, this value is always `true`.
191
193
  * @since v0.5.3
194
+ * @deprecated This property is always true, and any checks based on it are redundant.
192
195
  */
193
196
  readonly ipv6: boolean;
194
197
  /**
195
198
  * A boolean value that is `true` if the current Node.js build supports
196
- * [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v20.x/api/modules.html#loading-ecmascript-modules-using-require).
197
- * @since v20.19.0
199
+ * [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v24.x/api/modules.md#loading-ecmascript-modules-using-require).
200
+ * @since v22.10.0
198
201
  */
199
202
  readonly require_module: boolean;
200
203
  /**
@@ -204,22 +207,44 @@ declare module "process" {
204
207
  readonly tls: boolean;
205
208
  /**
206
209
  * A boolean value that is `true` if the current Node.js build includes support for ALPN in TLS.
210
+ *
211
+ * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional ALPN support.
212
+ * This value is therefore identical to that of `process.features.tls`.
207
213
  * @since v4.8.0
214
+ * @deprecated Use `process.features.tls` instead.
208
215
  */
209
216
  readonly tls_alpn: boolean;
210
217
  /**
211
218
  * A boolean value that is `true` if the current Node.js build includes support for OCSP in TLS.
219
+ *
220
+ * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional OCSP support.
221
+ * This value is therefore identical to that of `process.features.tls`.
212
222
  * @since v0.11.13
223
+ * @deprecated Use `process.features.tls` instead.
213
224
  */
214
225
  readonly tls_ocsp: boolean;
215
226
  /**
216
227
  * A boolean value that is `true` if the current Node.js build includes support for SNI in TLS.
228
+ *
229
+ * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional SNI support.
230
+ * This value is therefore identical to that of `process.features.tls`.
217
231
  * @since v0.5.3
232
+ * @deprecated Use `process.features.tls` instead.
218
233
  */
219
234
  readonly tls_sni: boolean;
235
+ /**
236
+ * A value that is `"strip"` by default,
237
+ * `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
238
+ * Node.js is run with `--no-experimental-strip-types`.
239
+ * @since v22.10.0
240
+ */
241
+ readonly typescript: "strip" | "transform" | false;
220
242
  /**
221
243
  * A boolean value that is `true` if the current Node.js build includes support for libuv.
244
+ *
245
+ * Since it's not possible to build Node.js without libuv, this value is always `true`.
222
246
  * @since v0.5.3
247
+ * @deprecated This property is always true, and any checks based on it are redundant.
223
248
  */
224
249
  readonly uv: boolean;
225
250
  }
@@ -252,10 +277,8 @@ declare module "process" {
252
277
  | "loong64"
253
278
  | "mips"
254
279
  | "mipsel"
255
- | "ppc"
256
280
  | "ppc64"
257
281
  | "riscv64"
258
- | "s390"
259
282
  | "s390x"
260
283
  | "x64";
261
284
  type Signals =
@@ -726,7 +749,7 @@ declare module "process" {
726
749
  * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()`
727
750
  * unless there are specific reasons such as custom dlopen flags or loading from ES modules.
728
751
  *
729
- * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v20.x/api/os.html#dlopen-constants)`
752
+ * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v24.x/api/os.html#dlopen-constants)`
730
753
  * documentation for details.
731
754
  *
732
755
  * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon
@@ -980,7 +1003,41 @@ declare module "process" {
980
1003
  * @default undefined
981
1004
  * @since v0.11.8
982
1005
  */
983
- exitCode: number | string | number | undefined;
1006
+ exitCode: number | string | null | undefined;
1007
+ finalization: {
1008
+ /**
1009
+ * This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected.
1010
+ * If the object `ref` was garbage collected before the `exit` event is emitted, the callback will be removed from the finalization registry, and it will not be called on process exit.
1011
+ *
1012
+ * Inside the callback you can release the resources allocated by the `ref` object.
1013
+ * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function,
1014
+ * this means that there is a possibility that the callback will not be called under special circumstances.
1015
+ *
1016
+ * The idea of ​​this function is to help you free up resources when the starts process exiting, but also let the object be garbage collected if it is no longer being used.
1017
+ * @param ref The reference to the resource that is being tracked.
1018
+ * @param callback The callback function to be called when the resource is finalized.
1019
+ * @since v22.5.0
1020
+ * @experimental
1021
+ */
1022
+ register<T extends object>(ref: T, callback: (ref: T, event: "exit") => void): void;
1023
+ /**
1024
+ * This function behaves exactly like the `register`, except that the callback will be called when the process emits the `beforeExit` event if `ref` object was not garbage collected.
1025
+ *
1026
+ * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function, this means that there is a possibility that the callback will not be called under special circumstances.
1027
+ * @param ref The reference to the resource that is being tracked.
1028
+ * @param callback The callback function to be called when the resource is finalized.
1029
+ * @since v22.5.0
1030
+ * @experimental
1031
+ */
1032
+ registerBeforeExit<T extends object>(ref: T, callback: (ref: T, event: "beforeExit") => void): void;
1033
+ /**
1034
+ * This function remove the register of the object from the finalization registry, so the callback will not be called anymore.
1035
+ * @param ref The reference to the resource that was registered previously.
1036
+ * @since v22.5.0
1037
+ * @experimental
1038
+ */
1039
+ unregister(ref: object): void;
1040
+ };
984
1041
  /**
985
1042
  * The `process.getActiveResourcesInfo()` method returns an array of strings containing
986
1043
  * the types of the active resources that are currently keeping the event loop alive.
@@ -1002,7 +1059,6 @@ declare module "process" {
1002
1059
  /**
1003
1060
  * Provides a way to load built-in modules in a globally available function.
1004
1061
  * @param id ID of the built-in module being requested.
1005
- * @since v20.16.0
1006
1062
  */
1007
1063
  getBuiltinModule<ID extends keyof BuiltInModule>(id: ID): BuiltInModule[ID];
1008
1064
  getBuiltinModule(id: string): object | undefined;
@@ -1435,6 +1491,18 @@ declare module "process" {
1435
1491
  * @since v9.2.0, v8.10.0, v6.13.0
1436
1492
  */
1437
1493
  readonly ppid: number;
1494
+ /**
1495
+ * The `process.threadCpuUsage()` method returns the user and system CPU time usage of
1496
+ * the current worker thread, in an object with properties `user` and `system`, whose
1497
+ * values are microsecond values (millionth of a second).
1498
+ *
1499
+ * The result of a previous call to `process.threadCpuUsage()` can be passed as the
1500
+ * argument to the function, to get a diff reading.
1501
+ * @since v23.9.0
1502
+ * @param previousValue A previous return value from calling
1503
+ * `process.threadCpuUsage()`
1504
+ */
1505
+ threadCpuUsage(previousValue?: CpuUsage): CpuUsage;
1438
1506
  /**
1439
1507
  * The `process.title` property returns the current process title (i.e. returns
1440
1508
  * the current value of `ps`). Assigning a new value to `process.title` modifies
@@ -1455,7 +1523,8 @@ declare module "process" {
1455
1523
  title: string;
1456
1524
  /**
1457
1525
  * The operating system CPU architecture for which the Node.js binary was compiled.
1458
- * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.
1526
+ * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`,
1527
+ * `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`.
1459
1528
  *
1460
1529
  * ```js
1461
1530
  * import { arch } from 'node:process';
@@ -1511,13 +1580,11 @@ declare module "process" {
1511
1580
  * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
1512
1581
  * information.
1513
1582
  * @since v19.6.0, v18.15.0
1514
- * @experimental
1515
1583
  */
1516
1584
  constrainedMemory(): number;
1517
1585
  /**
1518
1586
  * Gets the amount of free memory that is still available to the process (in bytes).
1519
- * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v20.x/api/process.html#processavailablememory) for more information.
1520
- * @experimental
1587
+ * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v24.x/api/process.html#processavailablememory) for more information.
1521
1588
  * @since v20.13.0
1522
1589
  */
1523
1590
  availableMemory(): number;
@@ -1638,7 +1705,7 @@ declare module "process" {
1638
1705
  */
1639
1706
  nextTick(callback: Function, ...args: any[]): void;
1640
1707
  /**
1641
- * This API is available through the [--experimental-permission](https://nodejs.org/api/cli.html#--experimental-permission) flag.
1708
+ * This API is available through the [--permission](https://nodejs.org/api/cli.html#--permission) flag.
1642
1709
  *
1643
1710
  * `process.permission` is an object whose methods are used to manage permissions for the current process.
1644
1711
  * Additional documentation is available in the [Permission Model](https://nodejs.org/api/permissions.html#permission-model).
@@ -1777,7 +1844,7 @@ declare module "process" {
1777
1844
  allowedNodeEnvironmentFlags: ReadonlySet<string>;
1778
1845
  /**
1779
1846
  * `process.report` is an object whose methods are used to generate diagnostic reports for the current process.
1780
- * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v20.x/api/report.html).
1847
+ * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v24.x/api/report.html).
1781
1848
  * @since v11.8.0
1782
1849
  */
1783
1850
  report: ProcessReport;
@@ -1842,6 +1909,56 @@ declare module "process" {
1842
1909
  * @since v0.8.0
1843
1910
  */
1844
1911
  traceDeprecation: boolean;
1912
+ /**
1913
+ * An object is "refable" if it implements the Node.js "Refable protocol".
1914
+ * Specifically, this means that the object implements the `Symbol.for('nodejs.ref')`
1915
+ * and `Symbol.for('nodejs.unref')` methods. "Ref'd" objects will keep the Node.js
1916
+ * event loop alive, while "unref'd" objects will not. Historically, this was
1917
+ * implemented by using `ref()` and `unref()` methods directly on the objects.
1918
+ * This pattern, however, is being deprecated in favor of the "Refable protocol"
1919
+ * in order to better support Web Platform API types whose APIs cannot be modified
1920
+ * to add `ref()` and `unref()` methods but still need to support that behavior.
1921
+ * @since v22.14.0
1922
+ * @experimental
1923
+ * @param maybeRefable An object that may be "refable".
1924
+ */
1925
+ ref(maybeRefable: any): void;
1926
+ /**
1927
+ * An object is "unrefable" if it implements the Node.js "Refable protocol".
1928
+ * Specifically, this means that the object implements the `Symbol.for('nodejs.ref')`
1929
+ * and `Symbol.for('nodejs.unref')` methods. "Ref'd" objects will keep the Node.js
1930
+ * event loop alive, while "unref'd" objects will not. Historically, this was
1931
+ * implemented by using `ref()` and `unref()` methods directly on the objects.
1932
+ * This pattern, however, is being deprecated in favor of the "Refable protocol"
1933
+ * in order to better support Web Platform API types whose APIs cannot be modified
1934
+ * to add `ref()` and `unref()` methods but still need to support that behavior.
1935
+ * @since v22.14.0
1936
+ * @experimental
1937
+ * @param maybeRefable An object that may be "unref'd".
1938
+ */
1939
+ unref(maybeRefable: any): void;
1940
+ /**
1941
+ * Replaces the current process with a new process.
1942
+ *
1943
+ * This is achieved by using the `execve` POSIX function and therefore no memory or other
1944
+ * resources from the current process are preserved, except for the standard input,
1945
+ * standard output and standard error file descriptor.
1946
+ *
1947
+ * All other resources are discarded by the system when the processes are swapped, without triggering
1948
+ * any exit or close events and without running any cleanup handler.
1949
+ *
1950
+ * This function will never return, unless an error occurred.
1951
+ *
1952
+ * This function is not available on Windows or IBM i.
1953
+ * @since v22.15.0
1954
+ * @experimental
1955
+ * @param file The name or path of the executable file to run.
1956
+ * @param args List of string arguments. No argument can contain a null-byte (`\u0000`).
1957
+ * @param env Environment key-value pairs.
1958
+ * No key or value can contain a null-byte (`\u0000`).
1959
+ * **Default:** `process.env`.
1960
+ */
1961
+ execve?(file: string, args?: readonly string[], env?: ProcessEnv): never;
1845
1962
  /* EventEmitter */
1846
1963
  addListener(event: "beforeExit", listener: BeforeExitListener): this;
1847
1964
  addListener(event: "disconnect", listener: DisconnectListener): this;
@@ -1883,10 +2000,10 @@ declare module "process" {
1883
2000
  on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1884
2001
  on(event: "warning", listener: WarningListener): this;
1885
2002
  on(event: "message", listener: MessageListener): this;
1886
- on(event: "workerMessage", listener: (value: any, source: number) => void): this;
1887
2003
  on(event: Signals, listener: SignalsListener): this;
1888
2004
  on(event: "multipleResolves", listener: MultipleResolveListener): this;
1889
2005
  on(event: "worker", listener: WorkerListener): this;
2006
+ on(event: "workerMessage", listener: (value: any, source: number) => void): this;
1890
2007
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1891
2008
  once(event: "beforeExit", listener: BeforeExitListener): this;
1892
2009
  once(event: "disconnect", listener: DisconnectListener): this;
@@ -1897,10 +2014,10 @@ declare module "process" {
1897
2014
  once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1898
2015
  once(event: "warning", listener: WarningListener): this;
1899
2016
  once(event: "message", listener: MessageListener): this;
1900
- once(event: "workerMessage", listener: (value: any, source: number) => void): this;
1901
2017
  once(event: Signals, listener: SignalsListener): this;
1902
2018
  once(event: "multipleResolves", listener: MultipleResolveListener): this;
1903
2019
  once(event: "worker", listener: WorkerListener): this;
2020
+ once(event: "workerMessage", listener: (value: any, source: number) => void): this;
1904
2021
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1905
2022
  prependListener(event: "beforeExit", listener: BeforeExitListener): this;
1906
2023
  prependListener(event: "disconnect", listener: DisconnectListener): this;
@@ -24,7 +24,7 @@
24
24
  * made available to developers as a convenience. Fixes or other modifications to
25
25
  * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
26
26
  * @deprecated Since v7.0.0 - Deprecated
27
- * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/punycode.js)
27
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/punycode.js)
28
28
  */
29
29
  declare module "punycode" {
30
30
  /**
@@ -9,7 +9,7 @@
9
9
  * `querystring` is more performant than `URLSearchParams` but is not a
10
10
  * standardized API. Use `URLSearchParams` when performance is not critical or
11
11
  * when compatibility with browser code is desirable.
12
- * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/querystring.js)
12
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/querystring.js)
13
13
  */
14
14
  declare module "querystring" {
15
15
  interface StringifyOptions {
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * @since v17.0.0
3
- * @experimental
4
3
  */
5
4
  declare module "readline/promises" {
6
5
  import { Abortable } from "node:events";
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream
3
- * (such as [`process.stdin`](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/process.html#processstdin)) one line at a time.
2
+ * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream
3
+ * (such as [`process.stdin`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdin)) one line at a time.
4
4
  *
5
5
  * To use the promise-based APIs:
6
6
  *
@@ -31,7 +31,7 @@
31
31
  *
32
32
  * Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be
33
33
  * received on the `input` stream.
34
- * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/readline.js)
34
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/readline.js)
35
35
  */
36
36
  declare module "readline" {
37
37
  import { Abortable, EventEmitter } from "node:events";
@@ -46,12 +46,12 @@ declare module "readline" {
46
46
  }
47
47
  /**
48
48
  * Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a
49
- * single `input` [Readable](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/stream.html#writable-streams) stream.
49
+ * single `input` [Readable](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v24.x/api/stream.html#writable-streams) stream.
50
50
  * The `output` stream is used to print prompts for user input that arrives on,
51
51
  * and is read from, the `input` stream.
52
52
  * @since v0.1.104
53
53
  */
54
- export class Interface extends EventEmitter {
54
+ export class Interface extends EventEmitter implements Disposable {
55
55
  readonly terminal: boolean;
56
56
  /**
57
57
  * The current input data being processed by node.
@@ -100,7 +100,7 @@ declare module "readline" {
100
100
  * > Instances of the `readline.Interface` class are constructed using the
101
101
  * > `readline.createInterface()` method.
102
102
  *
103
- * @see https://nodejs.org/docs/latest-v20.x/api/readline.html#class-interfaceconstructor
103
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#class-interfaceconstructor
104
104
  */
105
105
  protected constructor(
106
106
  input: NodeJS.ReadableStream,
@@ -114,7 +114,7 @@ declare module "readline" {
114
114
  * > Instances of the `readline.Interface` class are constructed using the
115
115
  * > `readline.createInterface()` method.
116
116
  *
117
- * @see https://nodejs.org/docs/latest-v20.x/api/readline.html#class-interfaceconstructor
117
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#class-interfaceconstructor
118
118
  */
119
119
  protected constructor(options: ReadLineOptions);
120
120
  /**
@@ -208,6 +208,11 @@ declare module "readline" {
208
208
  * @since v0.1.98
209
209
  */
210
210
  close(): void;
211
+ /**
212
+ * Alias for `rl.close()`.
213
+ * @since v22.15.0
214
+ */
215
+ [Symbol.dispose](): void;
211
216
  /**
212
217
  * The `rl.write()` method will write either `data` or a key sequence identified
213
218
  * by `key` to the `output`. The `key` argument is supported only if `output` is
@@ -315,11 +320,11 @@ declare module "readline" {
315
320
  export type CompleterResult = [string[], string];
316
321
  export interface ReadLineOptions {
317
322
  /**
318
- * The [`Readable`](https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream to listen to
323
+ * The [`Readable`](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream to listen to
319
324
  */
320
325
  input: NodeJS.ReadableStream;
321
326
  /**
322
- * The [`Writable`](https://nodejs.org/docs/latest-v20.x/api/stream.html#writable-streams) stream to write readline data to.
327
+ * The [`Writable`](https://nodejs.org/docs/latest-v24.x/api/stream.html#writable-streams) stream to write readline data to.
323
328
  */
324
329
  output?: NodeJS.WritableStream | undefined;
325
330
  /**
@@ -364,7 +369,7 @@ declare module "readline" {
364
369
  * `crlfDelay` will be coerced to a number no less than `100`.
365
370
  * It can be set to `Infinity`, in which case
366
371
  * `\r` followed by `\n` will always be considered a single newline
367
- * (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v20.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter).
372
+ * (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v24.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter).
368
373
  * @default 100
369
374
  */
370
375
  crlfDelay?: number | undefined;
@@ -552,7 +557,7 @@ declare module "readline" {
552
557
  cols: number;
553
558
  }
554
559
  /**
555
- * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) stream
560
+ * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) stream
556
561
  * in a specified direction identified by `dir`.
557
562
  * @since v0.7.7
558
563
  * @param callback Invoked once the operation completes.
@@ -560,7 +565,7 @@ declare module "readline" {
560
565
  */
561
566
  export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
562
567
  /**
563
- * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) stream from
568
+ * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) stream from
564
569
  * the current position of the cursor down.
565
570
  * @since v0.7.7
566
571
  * @param callback Invoked once the operation completes.
@@ -569,7 +574,7 @@ declare module "readline" {
569
574
  export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
570
575
  /**
571
576
  * The `readline.cursorTo()` method moves cursor to the specified position in a
572
- * given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) `stream`.
577
+ * given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) `stream`.
573
578
  * @since v0.7.7
574
579
  * @param callback Invoked once the operation completes.
575
580
  * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
@@ -577,7 +582,7 @@ declare module "readline" {
577
582
  export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
578
583
  /**
579
584
  * The `readline.moveCursor()` method moves the cursor _relative_ to its current
580
- * position in a given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) `stream`.
585
+ * position in a given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) `stream`.
581
586
  * @since v0.7.7
582
587
  * @param callback Invoked once the operation completes.
583
588
  * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
@@ -6,7 +6,7 @@
6
6
  * ```js
7
7
  * import repl from 'node:repl';
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/repl.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/repl.js)
10
10
  */
11
11
  declare module "repl" {
12
12
  import { AsyncCompleter, Completer, Interface } from "node:readline";
@@ -37,12 +37,10 @@ declare module "repl" {
37
37
  terminal?: boolean | undefined;
38
38
  /**
39
39
  * The function to be used when evaluating each given line of input.
40
- * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
40
+ * **Default:** an async wrapper for the JavaScript `eval()` function. An `eval` function can
41
41
  * error with `repl.Recoverable` to indicate the input was incomplete and prompt for
42
- * additional lines.
43
- *
44
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_default_evaluation
45
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_custom_evaluation_functions
42
+ * additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#custom-evaluation-functions)
43
+ * section for more details.
46
44
  */
47
45
  eval?: REPLEval | undefined;
48
46
  /**
@@ -74,13 +72,13 @@ declare module "repl" {
74
72
  * The function to invoke to format the output of each command before writing to `output`.
75
73
  * @default a wrapper for `util.inspect`
76
74
  *
77
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output
75
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_customizing_repl_output
78
76
  */
79
77
  writer?: REPLWriter | undefined;
80
78
  /**
81
79
  * An optional function used for custom Tab auto completion.
82
80
  *
83
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function
81
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#readline_use_of_the_completer_function
84
82
  */
85
83
  completer?: Completer | AsyncCompleter | undefined;
86
84
  /**
@@ -125,6 +123,12 @@ declare module "repl" {
125
123
  */
126
124
  action: REPLCommandAction;
127
125
  }
126
+ interface REPLServerSetupHistoryOptions {
127
+ filePath?: string | undefined;
128
+ size?: number | undefined;
129
+ removeHistoryDuplicates?: boolean | undefined;
130
+ onHistoryFileLoaded?: ((err: Error | null, repl: REPLServer) => void) | undefined;
131
+ }
128
132
  /**
129
133
  * Instances of `repl.REPLServer` are created using the {@link start} method
130
134
  * or directly using the JavaScript `new` keyword.
@@ -168,33 +172,33 @@ declare module "repl" {
168
172
  /**
169
173
  * A value indicating whether the REPL is currently in "editor mode".
170
174
  *
171
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys
175
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_commands_and_special_keys
172
176
  */
173
177
  readonly editorMode: boolean;
174
178
  /**
175
179
  * A value indicating whether the `_` variable has been assigned.
176
180
  *
177
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
181
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
178
182
  */
179
183
  readonly underscoreAssigned: boolean;
180
184
  /**
181
185
  * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
182
186
  *
183
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
187
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
184
188
  */
185
189
  readonly last: any;
186
190
  /**
187
191
  * A value indicating whether the `_error` variable has been assigned.
188
192
  *
189
193
  * @since v9.8.0
190
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
194
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
191
195
  */
192
196
  readonly underscoreErrAssigned: boolean;
193
197
  /**
194
198
  * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
195
199
  *
196
200
  * @since v9.8.0
197
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
201
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
198
202
  */
199
203
  readonly lastError: any;
200
204
  /**
@@ -246,7 +250,7 @@ declare module "repl" {
246
250
  *
247
251
  * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
248
252
  *
249
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver
253
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_class_replserver
250
254
  */
251
255
  private constructor();
252
256
  /**
@@ -291,7 +295,7 @@ declare module "repl" {
291
295
  * The `replServer.displayPrompt()` method readies the REPL instance for input
292
296
  * from the user, printing the configured `prompt` to a new line in the `output` and resuming the `input` to accept new input.
293
297
  *
294
- * When multi-line input is being entered, an ellipsis is printed rather than the
298
+ * When multi-line input is being entered, a pipe `'|'` is printed rather than the
295
299
  * 'prompt'.
296
300
  *
297
301
  * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`.
@@ -318,7 +322,11 @@ declare module "repl" {
318
322
  * @param historyPath the path to the history file
319
323
  * @param callback called when history writes are ready or upon error
320
324
  */
321
- setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void;
325
+ setupHistory(historyPath: string, callback: (err: Error | null, repl: this) => void): void;
326
+ setupHistory(
327
+ historyConfig?: REPLServerSetupHistoryOptions,
328
+ callback?: (err: Error | null, repl: this) => void,
329
+ ): void;
322
330
  /**
323
331
  * events.EventEmitter
324
332
  * 1. close - inherited from `readline.Interface`
@@ -418,7 +426,7 @@ declare module "repl" {
418
426
  /**
419
427
  * Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
420
428
  *
421
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors
429
+ * @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_recoverable_errors
422
430
  */
423
431
  class Recoverable extends SyntaxError {
424
432
  err: Error;
@@ -111,7 +111,7 @@
111
111
  * ```
112
112
  * @since v19.7.0, v18.16.0
113
113
  * @experimental
114
- * @see [source](https://github.com/nodejs/node/blob/v20.12.0/src/node_sea.cc)
114
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/src/node_sea.cc)
115
115
  */
116
116
  declare module "node:sea" {
117
117
  type AssetKey = string;
@@ -149,5 +149,14 @@ declare module "node:sea" {
149
149
  * writes to the returned array buffer is likely to result in a crash.
150
150
  * @since v20.12.0
151
151
  */
152
- function getRawAsset(key: AssetKey): string | ArrayBuffer;
152
+ function getRawAsset(key: AssetKey): ArrayBuffer;
153
+ /**
154
+ * This method can be used to retrieve an array of all the keys of assets
155
+ * embedded into the single-executable application.
156
+ * An error is thrown when not running inside a single-executable application.
157
+ * @since v24.8.0
158
+ * @returns An array containing all the keys of the assets
159
+ * embedded in the executable. If no assets are embedded, returns an empty array.
160
+ */
161
+ function getAssetKeys(): string[];
153
162
  }