@types/node 18.19.52 → 18.19.54

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 (47) hide show
  1. node v18.19/README.md +1 -1
  2. node v18.19/buffer.buffer.d.ts +385 -0
  3. node v18.19/buffer.d.ts +10 -384
  4. node v18.19/child_process.d.ts +35 -30
  5. node v18.19/cluster.d.ts +1 -1
  6. node v18.19/console.d.ts +2 -2
  7. node v18.19/crypto.d.ts +1 -1
  8. node v18.19/dns/promises.d.ts +6 -5
  9. node v18.19/dns.d.ts +5 -5
  10. node v18.19/domain.d.ts +2 -2
  11. node v18.19/events.d.ts +13 -13
  12. node v18.19/fs/promises.d.ts +2 -2
  13. node v18.19/fs.d.ts +1 -1
  14. node v18.19/globals.d.ts +0 -14
  15. node v18.19/globals.typedarray.d.ts +21 -0
  16. node v18.19/http.d.ts +4 -4
  17. node v18.19/http2.d.ts +24 -24
  18. node v18.19/https.d.ts +9 -9
  19. node v18.19/index.d.ts +5 -1
  20. node v18.19/inspector.d.ts +1 -1
  21. node v18.19/module.d.ts +3 -3
  22. node v18.19/net.d.ts +2 -2
  23. node v18.19/os.d.ts +1 -1
  24. node v18.19/package.json +9 -2
  25. node v18.19/path.d.ts +1 -1
  26. node v18.19/perf_hooks.d.ts +11 -11
  27. node v18.19/punycode.d.ts +1 -1
  28. node v18.19/querystring.d.ts +1 -1
  29. node v18.19/readline/promises.d.ts +1 -1
  30. node v18.19/readline.d.ts +18 -18
  31. node v18.19/repl.d.ts +4 -4
  32. node v18.19/stream.d.ts +21 -21
  33. node v18.19/string_decoder.d.ts +3 -3
  34. node v18.19/timers/promises.d.ts +1 -1
  35. node v18.19/timers.d.ts +1 -1
  36. node v18.19/tls.d.ts +5 -5
  37. node v18.19/trace_events.d.ts +3 -3
  38. node v18.19/ts5.6/buffer.buffer.d.ts +385 -0
  39. node v18.19/ts5.6/globals.typedarray.d.ts +19 -0
  40. node v18.19/ts5.6/index.d.ts +91 -0
  41. node v18.19/tty.d.ts +1 -1
  42. node v18.19/url.d.ts +7 -7
  43. node v18.19/util.d.ts +41 -41
  44. node v18.19/v8.d.ts +12 -12
  45. node v18.19/vm.d.ts +11 -12
  46. node v18.19/worker_threads.d.ts +22 -22
  47. node v18.19/zlib.d.ts +8 -8
@@ -0,0 +1,91 @@
1
+ /**
2
+ * License for programmatically and manually incorporated
3
+ * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
4
+ *
5
+ * Copyright Node.js contributors. All rights reserved.
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to
8
+ * deal in the Software without restriction, including without limitation the
9
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
+ * sell copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22
+ * IN THE SOFTWARE.
23
+ */
24
+
25
+ // NOTE: These definitions support NodeJS and TypeScript 4.9 through 5.6.
26
+
27
+ // Reference required types from the default lib:
28
+ /// <reference lib="es2020" />
29
+ /// <reference lib="esnext.asynciterable" />
30
+ /// <reference lib="esnext.intl" />
31
+ /// <reference lib="esnext.bigint" />
32
+
33
+ // Definitions specific to TypeScript 4.9 through 5.6
34
+ /// <reference path="./globals.typedarray.d.ts" />
35
+ /// <reference path="./buffer.buffer.d.ts" />
36
+
37
+ // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
38
+ /// <reference path="../assert.d.ts" />
39
+ /// <reference path="../assert/strict.d.ts" />
40
+ /// <reference path="../globals.d.ts" />
41
+ /// <reference path="../async_hooks.d.ts" />
42
+ /// <reference path="../buffer.d.ts" />
43
+ /// <reference path="../child_process.d.ts" />
44
+ /// <reference path="../cluster.d.ts" />
45
+ /// <reference path="../console.d.ts" />
46
+ /// <reference path="../constants.d.ts" />
47
+ /// <reference path="../crypto.d.ts" />
48
+ /// <reference path="../dgram.d.ts" />
49
+ /// <reference path="../diagnostics_channel.d.ts" />
50
+ /// <reference path="../dns.d.ts" />
51
+ /// <reference path="../dns/promises.d.ts" />
52
+ /// <reference path="../dns/promises.d.ts" />
53
+ /// <reference path="../domain.d.ts" />
54
+ /// <reference path="../dom-events.d.ts" />
55
+ /// <reference path="../events.d.ts" />
56
+ /// <reference path="../fs.d.ts" />
57
+ /// <reference path="../fs/promises.d.ts" />
58
+ /// <reference path="../http.d.ts" />
59
+ /// <reference path="../http2.d.ts" />
60
+ /// <reference path="../https.d.ts" />
61
+ /// <reference path="../inspector.d.ts" />
62
+ /// <reference path="../module.d.ts" />
63
+ /// <reference path="../net.d.ts" />
64
+ /// <reference path="../os.d.ts" />
65
+ /// <reference path="../path.d.ts" />
66
+ /// <reference path="../perf_hooks.d.ts" />
67
+ /// <reference path="../process.d.ts" />
68
+ /// <reference path="../punycode.d.ts" />
69
+ /// <reference path="../querystring.d.ts" />
70
+ /// <reference path="../readline.d.ts" />
71
+ /// <reference path="../readline/promises.d.ts" />
72
+ /// <reference path="../repl.d.ts" />
73
+ /// <reference path="../stream.d.ts" />
74
+ /// <reference path="../stream/promises.d.ts" />
75
+ /// <reference path="../stream/consumers.d.ts" />
76
+ /// <reference path="../stream/web.d.ts" />
77
+ /// <reference path="../string_decoder.d.ts" />
78
+ /// <reference path="../test.d.ts" />
79
+ /// <reference path="../timers.d.ts" />
80
+ /// <reference path="../timers/promises.d.ts" />
81
+ /// <reference path="../tls.d.ts" />
82
+ /// <reference path="../trace_events.d.ts" />
83
+ /// <reference path="../tty.d.ts" />
84
+ /// <reference path="../url.d.ts" />
85
+ /// <reference path="../util.d.ts" />
86
+ /// <reference path="../v8.d.ts" />
87
+ /// <reference path="../vm.d.ts" />
88
+ /// <reference path="../wasi.d.ts" />
89
+ /// <reference path="../worker_threads.d.ts" />
90
+ /// <reference path="../zlib.d.ts" />
91
+ /// <reference path="../globals.global.d.ts" />
node v18.19/tty.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * However, it can be accessed using:
5
5
  *
6
6
  * ```js
7
- * const tty = require('tty');
7
+ * import tty from 'node:tty';
8
8
  * ```
9
9
  *
10
10
  * When Node.js detects that it is being run with a text terminal ("TTY")
node v18.19/url.d.ts CHANGED
@@ -83,7 +83,7 @@ declare module "url" {
83
83
  * The `url.format()` method returns a formatted URL string derived from `urlObject`.
84
84
  *
85
85
  * ```js
86
- * const url = require('node:url');
86
+ * import url from 'node:url';
87
87
  * url.format({
88
88
  * protocol: 'https',
89
89
  * hostname: 'example.com',
@@ -147,7 +147,7 @@ declare module "url" {
147
147
  * The `url.format()` method returns a formatted URL string derived from `urlObject`.
148
148
  *
149
149
  * ```js
150
- * const url = require('node:url');
150
+ * import url from 'node:url';
151
151
  * url.format({
152
152
  * protocol: 'https',
153
153
  * hostname: 'example.com',
@@ -212,7 +212,7 @@ declare module "url" {
212
212
  * manner similar to that of a web browser resolving an anchor tag.
213
213
  *
214
214
  * ```js
215
- * const url = require('url');
215
+ * import url from 'node:url';
216
216
  * url.resolve('/one/two/three', 'four'); // '/one/two/four'
217
217
  * url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
218
218
  * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
@@ -394,10 +394,10 @@ declare module "url" {
394
394
  * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
395
395
  *
396
396
  * ```js
397
- * const {
397
+ * import {
398
398
  * Blob,
399
399
  * resolveObjectURL,
400
- * } = require('buffer');
400
+ * } from 'node:buffer';
401
401
  *
402
402
  * const blob = new Blob(['hello']);
403
403
  * const id = URL.createObjectURL(blob);
@@ -928,7 +928,7 @@ declare module "url" {
928
928
  URLSearchParams: typeof _URLSearchParams;
929
929
  }
930
930
  /**
931
- * `URL` class is a global reference for `require('url').URL`
931
+ * `URL` class is a global reference for `import { URL } from 'node:url'`
932
932
  * https://nodejs.org/api/url.html#the-whatwg-url-api
933
933
  * @since v10.0.0
934
934
  */
@@ -938,7 +938,7 @@ declare module "url" {
938
938
  } ? T
939
939
  : typeof _URL;
940
940
  /**
941
- * `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
941
+ * `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'`
942
942
  * https://nodejs.org/api/url.html#class-urlsearchparams
943
943
  * @since v10.0.0
944
944
  */
node v18.19/util.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * it:
5
5
  *
6
6
  * ```js
7
- * const util = require('util');
7
+ * import util from 'node:util';
8
8
  * ```
9
9
  * @see [source](https://github.com/nodejs/node/blob/v18.x/lib/util.js)
10
10
  */
@@ -200,7 +200,7 @@ declare module "util" {
200
200
  * timestamp.
201
201
  *
202
202
  * ```js
203
- * const util = require('util');
203
+ * import util from 'node:util';
204
204
  *
205
205
  * util.log('Timestamped message.');
206
206
  * ```
@@ -268,7 +268,7 @@ declare module "util" {
268
268
  * Circular references point to their anchor by using a reference index:
269
269
  *
270
270
  * ```js
271
- * const { inspect } = require('util');
271
+ * import { inspect } from 'node:util';
272
272
  *
273
273
  * const obj = {};
274
274
  * obj.a = [obj];
@@ -286,7 +286,7 @@ declare module "util" {
286
286
  * The following example inspects all properties of the `util` object:
287
287
  *
288
288
  * ```js
289
- * const util = require('util');
289
+ * import util from 'node:util';
290
290
  *
291
291
  * console.log(util.inspect(util, { showHidden: true, depth: null }));
292
292
  * ```
@@ -294,7 +294,7 @@ declare module "util" {
294
294
  * The following example highlights the effect of the `compact` option:
295
295
  *
296
296
  * ```js
297
- * const util = require('util');
297
+ * import util from 'node:util';
298
298
  *
299
299
  * const o = {
300
300
  * a: [1, 2, [[
@@ -351,7 +351,7 @@ declare module "util" {
351
351
  * with no remaining strong references may be garbage collected at any time.
352
352
  *
353
353
  * ```js
354
- * const { inspect } = require('util');
354
+ * import { inspect } from 'node:util';
355
355
  *
356
356
  * const obj = { a: 1 };
357
357
  * const obj2 = { b: 2 };
@@ -365,8 +365,8 @@ declare module "util" {
365
365
  * impact the result of `util.inspect()`.
366
366
  *
367
367
  * ```js
368
- * const { inspect } = require('util');
369
- * const assert = require('assert');
368
+ * import { inspect } from 'node:util';
369
+ * import assert from 'node:assert';
370
370
  *
371
371
  * const o1 = {
372
372
  * b: [2, 3, 1],
@@ -393,7 +393,7 @@ declare module "util" {
393
393
  * numbers.
394
394
  *
395
395
  * ```js
396
- * const { inspect } = require('util');
396
+ * import { inspect } from 'node:util';
397
397
  *
398
398
  * const thousand = 1_000;
399
399
  * const million = 1_000_000;
@@ -434,7 +434,7 @@ declare module "util" {
434
434
  * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`.
435
435
  *
436
436
  * ```js
437
- * const util = require('util');
437
+ * import util from 'node:util';
438
438
  *
439
439
  * util.isArray([]);
440
440
  * // Returns: true
@@ -451,7 +451,7 @@ declare module "util" {
451
451
  * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
452
452
  *
453
453
  * ```js
454
- * const util = require('util');
454
+ * import util from 'node:util';
455
455
  *
456
456
  * util.isRegExp(/some regexp/);
457
457
  * // Returns: true
@@ -468,7 +468,7 @@ declare module "util" {
468
468
  * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
469
469
  *
470
470
  * ```js
471
- * const util = require('util');
471
+ * import util from 'node:util';
472
472
  *
473
473
  * util.isDate(new Date());
474
474
  * // Returns: true
@@ -485,7 +485,7 @@ declare module "util" {
485
485
  * Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`.
486
486
  *
487
487
  * ```js
488
- * const util = require('util');
488
+ * import util from 'node:util';
489
489
  *
490
490
  * util.isError(new Error());
491
491
  * // Returns: true
@@ -499,7 +499,7 @@ declare module "util" {
499
499
  * possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`.
500
500
  *
501
501
  * ```js
502
- * const util = require('util');
502
+ * import util from 'node:util';
503
503
  * const obj = { name: 'Error', message: 'an error occurred' };
504
504
  *
505
505
  * util.isError(obj);
@@ -524,8 +524,8 @@ declare module "util" {
524
524
  * through the `constructor.super_` property.
525
525
  *
526
526
  * ```js
527
- * const util = require('util');
528
- * const EventEmitter = require('events');
527
+ * import util from 'node:util';
528
+ * import EventEmitter from 'node:events';
529
529
  *
530
530
  * function MyStream() {
531
531
  * EventEmitter.call(this);
@@ -551,7 +551,7 @@ declare module "util" {
551
551
  * ES6 example using `class` and `extends`:
552
552
  *
553
553
  * ```js
554
- * const EventEmitter = require('events');
554
+ * import EventEmitter from 'node:events';
555
555
  *
556
556
  * class MyStream extends EventEmitter {
557
557
  * write(data) {
@@ -580,7 +580,7 @@ declare module "util" {
580
580
  * environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op.
581
581
  *
582
582
  * ```js
583
- * const util = require('util');
583
+ * import util from 'node:util';
584
584
  * const debuglog = util.debuglog('foo');
585
585
  *
586
586
  * debuglog('hello from foo [%d]', 123);
@@ -599,7 +599,7 @@ declare module "util" {
599
599
  * The `section` supports wildcard also:
600
600
  *
601
601
  * ```js
602
- * const util = require('util');
602
+ * import util from 'node:util';
603
603
  * const debuglog = util.debuglog('foo-bar');
604
604
  *
605
605
  * debuglog('hi there, it\'s foo-bar [%d]', 2333);
@@ -619,7 +619,7 @@ declare module "util" {
619
619
  * unnecessary wrapping.
620
620
  *
621
621
  * ```js
622
- * const util = require('util');
622
+ * import util from 'node:util';
623
623
  * let debuglog = util.debuglog('internals', (debug) => {
624
624
  * // Replace with a logging function that optimizes out
625
625
  * // testing if the section is enabled
@@ -637,7 +637,7 @@ declare module "util" {
637
637
  * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
638
638
  *
639
639
  * ```js
640
- * const util = require('util');
640
+ * import util from 'node:util';
641
641
  *
642
642
  * util.isBoolean(1);
643
643
  * // Returns: false
@@ -654,7 +654,7 @@ declare module "util" {
654
654
  * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
655
655
  *
656
656
  * ```js
657
- * const util = require('util');
657
+ * import util from 'node:util';
658
658
  *
659
659
  * util.isBuffer({ length: 0 });
660
660
  * // Returns: false
@@ -671,7 +671,7 @@ declare module "util" {
671
671
  * Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`.
672
672
  *
673
673
  * ```js
674
- * const util = require('util');
674
+ * import util from 'node:util';
675
675
  *
676
676
  * function Foo() {}
677
677
  * const Bar = () => {};
@@ -691,7 +691,7 @@ declare module "util" {
691
691
  * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
692
692
  *
693
693
  * ```js
694
- * const util = require('util');
694
+ * import util from 'node:util';
695
695
  *
696
696
  * util.isNull(0);
697
697
  * // Returns: false
@@ -709,7 +709,7 @@ declare module "util" {
709
709
  * returns `false`.
710
710
  *
711
711
  * ```js
712
- * const util = require('util');
712
+ * import util from 'node:util';
713
713
  *
714
714
  * util.isNullOrUndefined(0);
715
715
  * // Returns: false
@@ -726,7 +726,7 @@ declare module "util" {
726
726
  * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
727
727
  *
728
728
  * ```js
729
- * const util = require('util');
729
+ * import util from 'node:util';
730
730
  *
731
731
  * util.isNumber(false);
732
732
  * // Returns: false
@@ -746,7 +746,7 @@ declare module "util" {
746
746
  * Otherwise, returns `false`.
747
747
  *
748
748
  * ```js
749
- * const util = require('util');
749
+ * import util from 'node:util';
750
750
  *
751
751
  * util.isObject(5);
752
752
  * // Returns: false
@@ -765,7 +765,7 @@ declare module "util" {
765
765
  * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
766
766
  *
767
767
  * ```js
768
- * const util = require('util');
768
+ * import util from 'node:util';
769
769
  *
770
770
  * util.isPrimitive(5);
771
771
  * // Returns: true
@@ -794,7 +794,7 @@ declare module "util" {
794
794
  * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
795
795
  *
796
796
  * ```js
797
- * const util = require('util');
797
+ * import util from 'node:util';
798
798
  *
799
799
  * util.isString('');
800
800
  * // Returns: true
@@ -813,7 +813,7 @@ declare module "util" {
813
813
  * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
814
814
  *
815
815
  * ```js
816
- * const util = require('util');
816
+ * import util from 'node:util';
817
817
  *
818
818
  * util.isSymbol(5);
819
819
  * // Returns: false
@@ -830,7 +830,7 @@ declare module "util" {
830
830
  * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
831
831
  *
832
832
  * ```js
833
- * const util = require('util');
833
+ * import util from 'node:util';
834
834
  *
835
835
  * const foo = undefined;
836
836
  * util.isUndefined(5);
@@ -849,7 +849,7 @@ declare module "util" {
849
849
  * such a way that it is marked as deprecated.
850
850
  *
851
851
  * ```js
852
- * const util = require('util');
852
+ * import util from 'node:util';
853
853
  *
854
854
  * exports.obsoleteFunction = util.deprecate(() => {
855
855
  * // Do something here.
@@ -865,7 +865,7 @@ declare module "util" {
865
865
  * the warning will be emitted only once for that `code`.
866
866
  *
867
867
  * ```js
868
- * const util = require('util');
868
+ * import util from 'node:util';
869
869
  *
870
870
  * const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
871
871
  * const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
@@ -919,7 +919,7 @@ declare module "util" {
919
919
  * first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value.
920
920
  *
921
921
  * ```js
922
- * const util = require('util');
922
+ * import util from 'node:util';
923
923
  *
924
924
  * async function fn() {
925
925
  * return 'hello world';
@@ -1045,8 +1045,8 @@ declare module "util" {
1045
1045
  * that returns promises.
1046
1046
  *
1047
1047
  * ```js
1048
- * const util = require('util');
1049
- * const fs = require('fs');
1048
+ * import util from 'node:util';
1049
+ * import fs from 'node:fs';
1050
1050
  *
1051
1051
  * const stat = util.promisify(fs.stat);
1052
1052
  * stat('.').then((stats) => {
@@ -1059,8 +1059,8 @@ declare module "util" {
1059
1059
  * Or, equivalently using `async function`s:
1060
1060
  *
1061
1061
  * ```js
1062
- * const util = require('util');
1063
- * const fs = require('fs');
1062
+ * import util from 'node:util';
1063
+ * import fs from 'node:fs';
1064
1064
  *
1065
1065
  * const stat = util.promisify(fs.stat);
1066
1066
  *
@@ -1081,7 +1081,7 @@ declare module "util" {
1081
1081
  * work as expected unless handled specially:
1082
1082
  *
1083
1083
  * ```js
1084
- * const util = require('util');
1084
+ * import util from 'node:util';
1085
1085
  *
1086
1086
  * class Foo {
1087
1087
  * constructor() {
@@ -1248,7 +1248,7 @@ declare module "util" {
1248
1248
  import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
1249
1249
  global {
1250
1250
  /**
1251
- * `TextDecoder` class is a global reference for `require('util').TextDecoder`
1251
+ * `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'`
1252
1252
  * https://nodejs.org/api/globals.html#textdecoder
1253
1253
  * @since v11.0.0
1254
1254
  */
@@ -1259,7 +1259,7 @@ declare module "util" {
1259
1259
  : typeof _TextDecoder;
1260
1260
 
1261
1261
  /**
1262
- * `TextEncoder` class is a global reference for `require('util').TextEncoder`
1262
+ * `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'`
1263
1263
  * https://nodejs.org/api/globals.html#textencoder
1264
1264
  * @since v11.0.0
1265
1265
  */
node v18.19/v8.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
3
3
  *
4
4
  * ```js
5
- * const v8 = require('node:v8');
5
+ * import v8 from 'node:v8';
6
6
  * ```
7
7
  * @see [source](https://github.com/nodejs/node/blob/v18.19.0/lib/v8.js)
8
8
  */
@@ -164,7 +164,7 @@ declare module "v8" {
164
164
  *
165
165
  * ```js
166
166
  * // Print GC events to stdout for one minute.
167
- * const v8 = require('node:v8');
167
+ * import v8 from 'node:v8';
168
168
  * v8.setFlagsFromString('--trace_gc');
169
169
  * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
170
170
  * ```
@@ -187,7 +187,7 @@ declare module "v8" {
187
187
  *
188
188
  * ```js
189
189
  * // Print heap snapshot to the console
190
- * const v8 = require('node:v8');
190
+ * import v8 from 'node:v8';
191
191
  * const stream = v8.getHeapSnapshot();
192
192
  * stream.pipe(process.stdout);
193
193
  * ```
@@ -212,12 +212,12 @@ declare module "v8" {
212
212
  * for a duration depending on the heap size.
213
213
  *
214
214
  * ```js
215
- * const { writeHeapSnapshot } = require('node:v8');
216
- * const {
215
+ * import { writeHeapSnapshot } from 'node:v8';
216
+ * import {
217
217
  * Worker,
218
218
  * isMainThread,
219
219
  * parentPort,
220
- * } = require('node:worker_threads');
220
+ * } from 'node:worker_threads';
221
221
  *
222
222
  * if (isMainThread) {
223
223
  * const worker = new Worker(__filename);
@@ -494,7 +494,7 @@ declare module "v8" {
494
494
  * Here's an example.
495
495
  *
496
496
  * ```js
497
- * const { GCProfiler } = require('v8');
497
+ * import { GCProfiler } from 'node:v8';
498
498
  * const profiler = new GCProfiler();
499
499
  * profiler.start();
500
500
  * setTimeout(() => {
@@ -681,12 +681,12 @@ declare module "v8" {
681
681
  * ```js
682
682
  * 'use strict';
683
683
  *
684
- * const fs = require('node:fs');
685
- * const zlib = require('node:zlib');
686
- * const path = require('node:path');
687
- * const assert = require('node:assert');
684
+ * import fs from 'node:fs';
685
+ * import zlib from 'node:zlib';
686
+ * import path from 'node:path';
687
+ * import assert from 'node:assert';
688
688
  *
689
- * const v8 = require('node:v8');
689
+ * import v8 from 'node:v8';
690
690
  *
691
691
  * class BookShelf {
692
692
  * storage = new Map();
node v18.19/vm.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * code are reflected in the context object.
18
18
  *
19
19
  * ```js
20
- * const vm = require('vm');
20
+ * import vm from 'node:vm';
21
21
  *
22
22
  * const x = 1;
23
23
  *
@@ -201,7 +201,7 @@ declare module "vm" {
201
201
  * The globals are contained in the `context` object.
202
202
  *
203
203
  * ```js
204
- * const vm = require('vm');
204
+ * import vm from 'node:vm';
205
205
  *
206
206
  * const context = {
207
207
  * animal: 'cat',
@@ -237,7 +237,7 @@ declare module "vm" {
237
237
  * contained within each individual `context`.
238
238
  *
239
239
  * ```js
240
- * const vm = require('vm');
240
+ * import vm from 'node:vm';
241
241
  *
242
242
  * const script = new vm.Script('globalVar = "set"');
243
243
  *
@@ -262,7 +262,7 @@ declare module "vm" {
262
262
  * executes that code multiple times:
263
263
  *
264
264
  * ```js
265
- * const vm = require('vm');
265
+ * import vm from 'node:vm';
266
266
  *
267
267
  * global.globalVar = 0;
268
268
  *
@@ -319,7 +319,7 @@ declare module "vm" {
319
319
  * will remain unchanged.
320
320
  *
321
321
  * ```js
322
- * const vm = require('vm');
322
+ * import vm from 'node:vm';
323
323
  *
324
324
  * global.globalVar = 3;
325
325
  *
@@ -366,7 +366,7 @@ declare module "vm" {
366
366
  * The following example compiles and executes different scripts using a single `contextified` object:
367
367
  *
368
368
  * ```js
369
- * const vm = require('vm');
369
+ * import vm from 'node:vm';
370
370
  *
371
371
  * const contextObject = { globalVar: 1 };
372
372
  * vm.createContext(contextObject);
@@ -395,7 +395,7 @@ declare module "vm" {
395
395
  * variable and sets a new one. These globals are contained in the `contextObject`.
396
396
  *
397
397
  * ```js
398
- * const vm = require('vm');
398
+ * import vm from 'node:vm';
399
399
  *
400
400
  * const contextObject = {
401
401
  * animal: 'cat',
@@ -427,7 +427,7 @@ declare module "vm" {
427
427
  * the JavaScript [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) function to run the same code:
428
428
  *
429
429
  * ```js
430
- * const vm = require('vm');
430
+ * import vm from 'node:vm';
431
431
  * let localVar = 'initial value';
432
432
  *
433
433
  * const vmResult = vm.runInThisContext('localVar = "vm";');
@@ -454,12 +454,11 @@ declare module "vm" {
454
454
  *
455
455
  * ```js
456
456
  * 'use strict';
457
- * const vm = require('vm');
457
+ * import vm from 'node:vm';
458
458
  *
459
459
  * const code = `
460
460
  * ((require) => {
461
- * const http = require('http');
462
- *
461
+ * const http = require('node:http');
463
462
  * http.createServer((request, response) => {
464
463
  * response.writeHead(200, { 'Content-Type': 'text/plain' });
465
464
  * response.end('Hello World\\n');
@@ -509,7 +508,7 @@ declare module "vm" {
509
508
  * the memory occupied by each heap space in the current V8 instance.
510
509
  *
511
510
  * ```js
512
- * const vm = require('vm');
511
+ * import vm from 'node:vm';
513
512
  * // Measure the memory used by the main context.
514
513
  * vm.measureMemory({ mode: 'summary' })
515
514
  * // This is the same as vm.measureMemory()