@types/node 20.12.7 → 20.12.9

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/process.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  declare module "process" {
2
+ import * as net from "node:net";
3
+ import * as os from "node:os";
2
4
  import * as tty from "node:tty";
3
5
  import { Worker } from "node:worker_threads";
4
6
  global {
@@ -21,10 +23,25 @@ declare module "process" {
21
23
  rss(): number;
22
24
  }
23
25
  interface MemoryUsage {
26
+ /**
27
+ * Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the
28
+ * process, including all C++ and JavaScript objects and code.
29
+ */
24
30
  rss: number;
31
+ /**
32
+ * Refers to V8's memory usage.
33
+ */
25
34
  heapTotal: number;
35
+ /**
36
+ * Refers to V8's memory usage.
37
+ */
26
38
  heapUsed: number;
27
39
  external: number;
40
+ /**
41
+ * Refers to memory allocated for `ArrayBuffer`s and `SharedArrayBuffer`s, including all Node.js Buffers. This is also included
42
+ * in the external value. When Node.js is used as an embedded library, this value may be `0` because allocations for `ArrayBuffer`s
43
+ * may not be tracked in that case.
44
+ */
28
45
  arrayBuffers: number;
29
46
  }
30
47
  interface CpuUsage {
@@ -64,6 +81,7 @@ declare module "process" {
64
81
  | "arm"
65
82
  | "arm64"
66
83
  | "ia32"
84
+ | "loong64"
67
85
  | "mips"
68
86
  | "mipsel"
69
87
  | "ppc"
@@ -143,8 +161,53 @@ declare module "process" {
143
161
  }
144
162
  interface HRTime {
145
163
  (time?: [number, number]): [number, number];
164
+ /**
165
+ * The `bigint` version of the `{@link hrtime()}` method returning the current high-resolution real time in nanoseconds as a `bigint`.
166
+ *
167
+ * Unlike `{@link hrtime()}`, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
168
+ * ```js
169
+ * import { hrtime } from 'node:process';
170
+ *
171
+ * const start = hrtime.bigint();
172
+ * // 191051479007711n
173
+ *
174
+ * setTimeout(() => {
175
+ * const end = hrtime.bigint();
176
+ * // 191052633396993n
177
+ *
178
+ * console.log(`Benchmark took ${end - start} nanoseconds`);
179
+ * // Benchmark took 1154389282 nanoseconds
180
+ * }, 1000);
181
+ * ```
182
+ */
146
183
  bigint(): bigint;
147
184
  }
185
+ interface ProcessPermission {
186
+ /**
187
+ * Verifies that the process is able to access the given scope and reference.
188
+ * If no reference is provided, a global scope is assumed, for instance, `process.permission.has('fs.read')`
189
+ * will check if the process has ALL file system read permissions.
190
+ *
191
+ * The reference has a meaning based on the provided scope. For example, the reference when the scope is File System means files and folders.
192
+ *
193
+ * The available scopes are:
194
+ *
195
+ * * `fs` - All File System
196
+ * * `fs.read` - File System read operations
197
+ * * `fs.write` - File System write operations
198
+ * * `child` - Child process spawning operations
199
+ * * `worker` - Worker thread spawning operation
200
+ *
201
+ * ```js
202
+ * // Check if the process has permission to read the README file
203
+ * process.permission.has('fs.read', './README.md');
204
+ * // Check if the process has read permission operations
205
+ * process.permission.has('fs.read');
206
+ * ```
207
+ * @since v20.0.0
208
+ */
209
+ has(scope: string, reference?: string): boolean;
210
+ }
148
211
  interface ProcessReport {
149
212
  /**
150
213
  * Directory where the report is written.
@@ -306,12 +369,11 @@ declare module "process" {
306
369
  * For more information see `Stream compatibility`.
307
370
  *
308
371
  * In "old" streams mode the `stdin` stream is paused by default, so one
309
- * must call `process.stdin.resume()` to read from it. Note also that calling`process.stdin.resume()` itself would switch stream to "old" mode.
372
+ * must call `process.stdin.resume()` to read from it. Note also that calling `process.stdin.resume()` itself would switch stream to "old" mode.
310
373
  */
311
374
  stdin: ReadStream & {
312
375
  fd: 0;
313
376
  };
314
- openStdin(): Socket;
315
377
  /**
316
378
  * The `process.argv` property returns an array containing the command-line
317
379
  * arguments passed when the Node.js process was launched. The first element will
@@ -453,6 +515,32 @@ declare module "process" {
453
515
  * @since v0.7.2
454
516
  */
455
517
  debugPort: number;
518
+ /**
519
+ * The `process.dlopen()` method allows dynamically loading shared objects. It is primarily used by `require()` to load C++ Addons, and
520
+ * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()`
521
+ * unless there are specific reasons such as custom dlopen flags or loading from ES modules.
522
+ *
523
+ * 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)`
524
+ * documentation for details.
525
+ *
526
+ * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon
527
+ * are then accessible via `module.exports`.
528
+ *
529
+ * The example below shows how to load a C++ Addon, named `local.node`, that exports a `foo` function. All the symbols are loaded before the call returns, by passing the `RTLD_NOW` constant.
530
+ * In this example the constant is assumed to be available.
531
+ *
532
+ * ```js
533
+ * import { dlopen } from 'node:process';
534
+ * import { constants } from 'node:os';
535
+ * import { fileURLToPath } from 'node:url';
536
+ *
537
+ * const module = { exports: {} };
538
+ * dlopen(module, fileURLToPath(new URL('local.node', import.meta.url)),
539
+ * constants.dlopen.RTLD_NOW);
540
+ * module.exports.foo();
541
+ * ```
542
+ */
543
+ dlopen(module: object, filename: string, flags?: number): void;
456
544
  /**
457
545
  * The `process.emitWarning()` method can be used to emit custom or application
458
546
  * specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
@@ -460,17 +548,27 @@ declare module "process" {
460
548
  * ```js
461
549
  * import { emitWarning } from 'node:process';
462
550
  *
463
- * // Emit a warning with a code and additional detail.
464
- * emitWarning('Something happened!', {
465
- * code: 'MY_WARNING',
466
- * detail: 'This is some additional information',
467
- * });
468
- * // Emits:
469
- * // (node:56338) [MY_WARNING] Warning: Something happened!
470
- * // This is some additional information
551
+ * // Emit a warning using a string.
552
+ * emitWarning('Something happened!');
553
+ * // Emits: (node: 56338) Warning: Something happened!
471
554
  * ```
472
555
  *
473
- * In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler.
556
+ * ```js
557
+ * import { emitWarning } from 'node:process';
558
+ *
559
+ * // Emit a warning using a string and a type.
560
+ * emitWarning('Something Happened!', 'CustomWarning');
561
+ * // Emits: (node:56338) CustomWarning: Something Happened!
562
+ * ```
563
+ *
564
+ * ```js
565
+ * import { emitWarning } from 'node:process';
566
+ *
567
+ * emitWarning('Something happened!', 'CustomWarning', 'WARN001');
568
+ * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!
569
+ * ```js
570
+ *
571
+ * In each of the previous examples, an `Error` object is generated internally by `process.emitWarning()` and passed through to the `'warning'` handler.
474
572
  *
475
573
  * ```js
476
574
  * import process from 'node:process';
@@ -484,7 +582,30 @@ declare module "process" {
484
582
  * });
485
583
  * ```
486
584
  *
487
- * If `warning` is passed as an `Error` object, the `options` argument is ignored.
585
+ * If `warning` is passed as an `Error` object, it will be passed through to the `'warning'` event handler
586
+ * unmodified (and the optional `type`, `code` and `ctor` arguments will be ignored):
587
+ *
588
+ * ```js
589
+ * import { emitWarning } from 'node:process';
590
+ *
591
+ * // Emit a warning using an Error object.
592
+ * const myWarning = new Error('Something happened!');
593
+ * // Use the Error name property to specify the type name
594
+ * myWarning.name = 'CustomWarning';
595
+ * myWarning.code = 'WARN001';
596
+ *
597
+ * emitWarning(myWarning);
598
+ * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!
599
+ * ```
600
+ *
601
+ * A `TypeError` is thrown if `warning` is anything other than a string or `Error` object.
602
+ *
603
+ * While process warnings use `Error` objects, the process warning mechanism is not a replacement for normal error handling mechanisms.
604
+ *
605
+ * The following additional handling is implemented if the warning `type` is `'DeprecationWarning'`:
606
+ * * If the `--throw-deprecation` command-line flag is used, the deprecation warning is thrown as an exception rather than being emitted as an event.
607
+ * * If the `--no-deprecation` command-line flag is used, the deprecation warning is suppressed.
608
+ * * If the `--trace-deprecation` command-line flag is used, the deprecation warning is printed to `stderr` along with the full stack trace.
488
609
  * @since v8.0.0
489
610
  * @param warning The warning to emit.
490
611
  */
@@ -572,7 +693,7 @@ declare module "process" {
572
693
  * parent thread's `process.env`, or whatever was specified as the `env` option
573
694
  * to the `Worker` constructor. Changes to `process.env` will not be visible
574
695
  * across `Worker` threads, and only the main thread can make changes that
575
- * are visible to the operating system or to native add-ons. On Windows, a copy of`process.env` on a `Worker` instance operates in a case-sensitive manner
696
+ * are visible to the operating system or to native add-ons. On Windows, a copy of `process.env` on a `Worker` instance operates in a case-sensitive manner
576
697
  * unlike the main thread.
577
698
  * @since v0.1.27
578
699
  */
@@ -596,13 +717,13 @@ declare module "process" {
596
717
  *
597
718
  * Calling `process.exit()` will force the process to exit as quickly as possible
598
719
  * even if there are still asynchronous operations pending that have not yet
599
- * completed fully, including I/O operations to `process.stdout` and`process.stderr`.
720
+ * completed fully, including I/O operations to `process.stdout` and `process.stderr`.
600
721
  *
601
- * In most situations, it is not actually necessary to call `process.exit()`explicitly. The Node.js process will exit on its own _if there is no additional_
722
+ * In most situations, it is not actually necessary to call `process.exit()` explicitly. The Node.js process will exit on its own _if there is no additional_
602
723
  * _work pending_ in the event loop. The `process.exitCode` property can be set to
603
724
  * tell the process which exit code to use when the process exits gracefully.
604
725
  *
605
- * For instance, the following example illustrates a _misuse_ of the`process.exit()` method that could lead to data printed to stdout being
726
+ * For instance, the following example illustrates a _misuse_ of the `process.exit()` method that could lead to data printed to stdout being
606
727
  * truncated and lost:
607
728
  *
608
729
  * ```js
@@ -619,7 +740,7 @@ declare module "process" {
619
740
  * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
620
741
  * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.
621
742
  *
622
- * Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding
743
+ * Rather than calling `process.exit()` directly, the code _should_ set the `process.exitCode` and allow the process to exit naturally by avoiding
623
744
  * scheduling any additional work for the event loop:
624
745
  *
625
746
  * ```js
@@ -642,7 +763,7 @@ declare module "process" {
642
763
  * @since v0.1.13
643
764
  * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
644
765
  */
645
- exit(code?: number): never;
766
+ exit(code?: number | string | null | undefined): never;
646
767
  /**
647
768
  * A number which will be the process exit code, when the process either
648
769
  * exits gracefully, or is exited via {@link exit} without specifying
@@ -650,15 +771,34 @@ declare module "process" {
650
771
  *
651
772
  * Specifying a code to {@link exit} will override any
652
773
  * previous setting of `process.exitCode`.
774
+ * @default undefined
653
775
  * @since v0.11.8
654
776
  */
655
- exitCode?: number | undefined;
777
+ exitCode?: number | string | number | undefined;
778
+ /**
779
+ * The `process.getActiveResourcesInfo()` method returns an array of strings containing
780
+ * the types of the active resources that are currently keeping the event loop alive.
781
+ *
782
+ * ```js
783
+ * import { getActiveResourcesInfo } from 'node:process';
784
+ * import { setTimeout } from 'node:timers';
785
+
786
+ * console.log('Before:', getActiveResourcesInfo());
787
+ * setTimeout(() => {}, 1000);
788
+ * console.log('After:', getActiveResourcesInfo());
789
+ * // Prints:
790
+ * // Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ]
791
+ * // After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]
792
+ * ```
793
+ * @since v17.3.0, v16.14.0
794
+ */
795
+ getActiveResourcesInfo(): string[];
656
796
  /**
657
797
  * The `process.getgid()` method returns the numerical group identity of the
658
798
  * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
659
799
  *
660
800
  * ```js
661
- * import process from 'process';
801
+ * import process from 'node:process';
662
802
  *
663
803
  * if (process.getgid) {
664
804
  * console.log(`Current gid: ${process.getgid()}`);
@@ -677,7 +817,7 @@ declare module "process" {
677
817
  * associated numeric ID.
678
818
  *
679
819
  * ```js
680
- * import process from 'process';
820
+ * import process from 'node:process';
681
821
  *
682
822
  * if (process.getgid && process.setgid) {
683
823
  * console.log(`Current gid: ${process.getgid()}`);
@@ -702,7 +842,7 @@ declare module "process" {
702
842
  * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
703
843
  *
704
844
  * ```js
705
- * import process from 'process';
845
+ * import process from 'node:process';
706
846
  *
707
847
  * if (process.getuid) {
708
848
  * console.log(`Current uid: ${process.getuid()}`);
@@ -721,7 +861,7 @@ declare module "process" {
721
861
  * numeric ID.
722
862
  *
723
863
  * ```js
724
- * import process from 'process';
864
+ * import process from 'node:process';
725
865
  *
726
866
  * if (process.getuid && process.setuid) {
727
867
  * console.log(`Current uid: ${process.getuid()}`);
@@ -745,7 +885,7 @@ declare module "process" {
745
885
  * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
746
886
  *
747
887
  * ```js
748
- * import process from 'process';
888
+ * import process from 'node:process';
749
889
  *
750
890
  * if (process.geteuid) {
751
891
  * console.log(`Current uid: ${process.geteuid()}`);
@@ -764,7 +904,7 @@ declare module "process" {
764
904
  * associated numeric ID.
765
905
  *
766
906
  * ```js
767
- * import process from 'process';
907
+ * import process from 'node:process';
768
908
  *
769
909
  * if (process.geteuid && process.seteuid) {
770
910
  * console.log(`Current uid: ${process.geteuid()}`);
@@ -789,7 +929,7 @@ declare module "process" {
789
929
  * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
790
930
  *
791
931
  * ```js
792
- * import process from 'process';
932
+ * import process from 'node:process';
793
933
  *
794
934
  * if (process.getegid) {
795
935
  * console.log(`Current gid: ${process.getegid()}`);
@@ -808,7 +948,7 @@ declare module "process" {
808
948
  * the associated a numeric ID.
809
949
  *
810
950
  * ```js
811
- * import process from 'process';
951
+ * import process from 'node:process';
812
952
  *
813
953
  * if (process.getegid && process.setegid) {
814
954
  * console.log(`Current gid: ${process.getegid()}`);
@@ -834,7 +974,7 @@ declare module "process" {
834
974
  * Node.js ensures it always is.
835
975
  *
836
976
  * ```js
837
- * import process from 'process';
977
+ * import process from 'node:process';
838
978
  *
839
979
  * if (process.getgroups) {
840
980
  * console.log(process.getgroups()); // [ 16, 21, 297 ]
@@ -854,7 +994,7 @@ declare module "process" {
854
994
  * The `groups` array can contain numeric group IDs, group names, or both.
855
995
  *
856
996
  * ```js
857
- * import process from 'process';
997
+ * import process from 'node:process';
858
998
  *
859
999
  * if (process.getgroups && process.setgroups) {
860
1000
  * try {
@@ -883,7 +1023,7 @@ declare module "process" {
883
1023
  * not abort. Actions configured to take place on exceptions such as report
884
1024
  * generations will be affected too
885
1025
  *
886
- * To unset the capture function,`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this
1026
+ * To unset the capture function, `process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this
887
1027
  * method with a non-`null` argument while another capture function is set will
888
1028
  * throw an error.
889
1029
  *
@@ -906,7 +1046,7 @@ declare module "process" {
906
1046
  * This function enables or disables the [Source Map v3](https://sourcemaps.info/spec.html) support for
907
1047
  * stack traces.
908
1048
  *
909
- * It provides same features as launching Node.js process with commandline options`--enable-source-maps`.
1049
+ * It provides same features as launching Node.js process with commandline options `--enable-source-maps`.
910
1050
  *
911
1051
  * Only source maps in JavaScript files that are loaded after source maps has been
912
1052
  * enabled will be parsed and loaded.
@@ -1090,8 +1230,8 @@ declare module "process" {
1090
1230
  * When a new value is assigned, different platforms will impose different maximum
1091
1231
  * length restrictions on the title. Usually such restrictions are quite limited.
1092
1232
  * For instance, on Linux and macOS, `process.title` is limited to the size of the
1093
- * binary name plus the length of the command-line arguments because setting the`process.title` overwrites the `argv` memory of the process. Node.js v0.8
1094
- * allowed for longer process title strings by also overwriting the `environ`memory but that was potentially insecure and confusing in some (rather obscure)
1233
+ * binary name plus the length of the command-line arguments because setting the `process.title` overwrites the `argv` memory of the process. Node.js v0.8
1234
+ * allowed for longer process title strings by also overwriting the `environ` memory but that was potentially insecure and confusing in some (rather obscure)
1095
1235
  * cases.
1096
1236
  *
1097
1237
  * Assigning a value to `process.title` might not result in an accurate label
@@ -1277,6 +1417,14 @@ declare module "process" {
1277
1417
  * @param args Additional arguments to pass when invoking the `callback`
1278
1418
  */
1279
1419
  nextTick(callback: Function, ...args: any[]): void;
1420
+ /**
1421
+ * This API is available through the [--experimental-permission](https://nodejs.org/api/cli.html#--experimental-permission) flag.
1422
+ *
1423
+ * `process.permission` is an object whose methods are used to manage permissions for the current process.
1424
+ * Additional documentation is available in the [Permission Model](https://nodejs.org/api/permissions.html#permission-model).
1425
+ * @since v20.0.0
1426
+ */
1427
+ permission: ProcessPermission;
1280
1428
  /**
1281
1429
  * The `process.release` property returns an `Object` containing metadata related
1282
1430
  * to the current release, including URLs for the source tarball and headers-only
@@ -1294,7 +1442,7 @@ declare module "process" {
1294
1442
  * }
1295
1443
  * ```
1296
1444
  *
1297
- * In custom builds from non-release versions of the source tree, only the`name` property may be present. The additional properties should not be
1445
+ * In custom builds from non-release versions of the source tree, only the `name` property may be present. The additional properties should not be
1298
1446
  * relied upon to exist.
1299
1447
  * @since v3.0.0
1300
1448
  */
@@ -1313,7 +1461,7 @@ declare module "process" {
1313
1461
  * `process.umask()` returns the Node.js process's file mode creation mask. Child
1314
1462
  * processes inherit the mask from the parent process.
1315
1463
  * @since v0.1.19
1316
- * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential *
1464
+ * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential
1317
1465
  * security vulnerability. There is no safe, cross-platform alternative API.
1318
1466
  */
1319
1467
  umask(): number;
@@ -1357,13 +1505,13 @@ declare module "process" {
1357
1505
  * The message goes through serialization and parsing. The resulting message might
1358
1506
  * not be the same as what is originally sent.
1359
1507
  * @since v0.5.9
1360
- * @param options used to parameterize the sending of certain types of handles.`options` supports the following properties:
1508
+ * @param options used to parameterize the sending of certain types of handles. `options` supports the following properties:
1361
1509
  */
1362
1510
  send?(
1363
1511
  message: any,
1364
1512
  sendHandle?: any,
1365
1513
  options?: {
1366
- swallowErrors?: boolean | undefined;
1514
+ keepOpen?: boolean | undefined;
1367
1515
  },
1368
1516
  callback?: (error: Error | null) => void,
1369
1517
  ): boolean;
@@ -1374,13 +1522,13 @@ declare module "process" {
1374
1522
  *
1375
1523
  * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process.
1376
1524
  *
1377
- * If the Node.js process was not spawned with an IPC channel,`process.disconnect()` will be `undefined`.
1525
+ * If the Node.js process was not spawned with an IPC channel, `process.disconnect()` will be `undefined`.
1378
1526
  * @since v0.7.2
1379
1527
  */
1380
1528
  disconnect(): void;
1381
1529
  /**
1382
- * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return`true` so long as the IPC
1383
- * channel is connected and will return `false` after`process.disconnect()` is called.
1530
+ * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return `true` so long as the IPC
1531
+ * channel is connected and will return `false` after `process.disconnect()` is called.
1384
1532
  *
1385
1533
  * Once `process.connected` is `false`, it is no longer possible to send messages
1386
1534
  * over the IPC channel using `process.send()`.
@@ -1391,11 +1539,11 @@ declare module "process" {
1391
1539
  * The `process.allowedNodeEnvironmentFlags` property is a special,
1392
1540
  * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable.
1393
1541
  *
1394
- * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides`Set.prototype.has` to recognize several different possible flag
1542
+ * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides `Set.prototype.has` to recognize several different possible flag
1395
1543
  * representations. `process.allowedNodeEnvironmentFlags.has()` will
1396
1544
  * return `true` in the following cases:
1397
1545
  *
1398
- * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,`inspect-brk` for `--inspect-brk`, or `r` for `-r`.
1546
+ * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g., `inspect-brk` for `--inspect-brk`, or `r` for `-r`.
1399
1547
  * * Flags passed through to V8 (as listed in `--v8-options`) may replace
1400
1548
  * one or more _non-leading_ dashes for an underscore, or vice-versa;
1401
1549
  * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`,
@@ -1467,7 +1615,30 @@ declare module "process" {
1467
1615
  */
1468
1616
  resourceUsage(): ResourceUsage;
1469
1617
  /**
1470
- * The `process.traceDeprecation` property indicates whether the`--trace-deprecation` flag is set on the current Node.js process. See the
1618
+ * The initial value of `process.throwDeprecation` indicates whether the `--throw-deprecation` flag is set on the current Node.js process. `process.throwDeprecation`
1619
+ * is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the 'warning' event and the emitWarning()
1620
+ * method for more information.
1621
+ *
1622
+ * ```bash
1623
+ * $ node --throw-deprecation -p "process.throwDeprecation"
1624
+ * true
1625
+ * $ node -p "process.throwDeprecation"
1626
+ * undefined
1627
+ * $ node
1628
+ * > process.emitWarning('test', 'DeprecationWarning');
1629
+ * undefined
1630
+ * > (node:26598) DeprecationWarning: test
1631
+ * > process.throwDeprecation = true;
1632
+ * true
1633
+ * > process.emitWarning('test', 'DeprecationWarning');
1634
+ * Thrown:
1635
+ * [DeprecationWarning: test] { name: 'DeprecationWarning' }
1636
+ * ```
1637
+ * @since v0.9.12
1638
+ */
1639
+ throwDeprecation: boolean;
1640
+ /**
1641
+ * The `process.traceDeprecation` property indicates whether the `--trace-deprecation` flag is set on the current Node.js process. See the
1471
1642
  * documentation for the `'warning' event` and the `emitWarning() method` for more information about this
1472
1643
  * flag's behavior.
1473
1644
  * @since v0.8.0
node/punycode.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users
2
+ * **The version of the punycode module bundled in Node.js is being deprecated. **In a future major version of Node.js this module will be removed. Users
3
3
  * currently depending on the `punycode` module should switch to using the
4
4
  * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
5
5
  * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
@@ -15,8 +15,8 @@
15
15
  * primarily intended for use in Internationalized Domain Names. Because host
16
16
  * names in URLs are limited to ASCII characters only, Domain Names that contain
17
17
  * non-ASCII characters must be converted into ASCII using the Punycode scheme.
18
- * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
19
- * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`.
18
+ * For instance, the Japanese character that translates into the English word, `'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
19
+ * to `'example.com'`) is represented by Punycode as the ASCII string `'xn--fsq.com'`.
20
20
  *
21
21
  * The `punycode` module provides a simple implementation of the Punycode standard.
22
22
  *
@@ -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.2.0/lib/punycode.js)
27
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/punycode.js)
28
28
  */
29
29
  declare module "punycode" {
30
30
  /**
node/querystring.d.ts CHANGED
@@ -9,14 +9,26 @@
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.2.0/lib/querystring.js)
12
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/querystring.js)
13
13
  */
14
14
  declare module "querystring" {
15
15
  interface StringifyOptions {
16
+ /**
17
+ * The function to use when converting URL-unsafe characters to percent-encoding in the query string.
18
+ * @default `querystring.escape()`
19
+ */
16
20
  encodeURIComponent?: ((str: string) => string) | undefined;
17
21
  }
18
22
  interface ParseOptions {
23
+ /**
24
+ * Specifies the maximum number of keys to parse. Specify `0` to remove key counting limitations.
25
+ * @default 1000
26
+ */
19
27
  maxKeys?: number | undefined;
28
+ /**
29
+ * The function to use when decoding percent-encoded characters in the query string.
30
+ * @default `querystring.unescape()`
31
+ */
20
32
  decodeURIComponent?: ((str: string) => string) | undefined;
21
33
  }
22
34
  interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
@@ -35,7 +47,7 @@ declare module "querystring" {
35
47
  * The `querystring.stringify()` method produces a URL query string from a
36
48
  * given `obj` by iterating through the object's "own properties".
37
49
  *
38
- * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
50
+ * It serializes the following types of values passed in `obj`: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
39
51
  * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
40
52
  * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
41
53
  * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
@@ -54,7 +66,7 @@ declare module "querystring" {
54
66
  * ```
55
67
  *
56
68
  * By default, characters requiring percent-encoding within the query string will
57
- * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified:
69
+ * be encoded as UTF-8\. If an alternative encoding is required, then an alternative `encodeURIComponent` option will need to be specified:
58
70
  *
59
71
  * ```js
60
72
  * // Assuming gbkEncodeURIComponent function already exists,
@@ -81,7 +93,7 @@ declare module "querystring" {
81
93
  * }
82
94
  * ```
83
95
  *
84
- * 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()`,
96
+ * 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()`,
85
97
  * `obj.hasOwnProperty()`, and others
86
98
  * are not defined and _will not work_.
87
99
  *
@@ -98,7 +110,7 @@ declare module "querystring" {
98
110
  * @since v0.1.25
99
111
  * @param str The URL query string to parse
100
112
  * @param [sep='&'] The substring used to delimit key and value pairs in the query string.
101
- * @param [eq='='] . The substring used to delimit keys and values in the query string.
113
+ * @param [eq='='] The substring used to delimit keys and values in the query string.
102
114
  */
103
115
  function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
104
116
  /**
@@ -110,7 +122,7 @@ declare module "querystring" {
110
122
  */
111
123
  const decode: typeof parse;
112
124
  /**
113
- * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL
125
+ * The `querystring.escape()` method performs URL percent-encoding on the given `str` in a manner that is optimized for the specific requirements of URL
114
126
  * query strings.
115
127
  *
116
128
  * The `querystring.escape()` method is used by `querystring.stringify()` and is