@types/node 16.18.110 → 16.18.111
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 v16.18/README.md +1 -1
- node v16.18/buffer.d.ts +1 -1
- node v16.18/child_process.d.ts +34 -29
- node v16.18/cluster.d.ts +1 -1
- node v16.18/console.d.ts +2 -2
- node v16.18/crypto.d.ts +1 -1
- node v16.18/dns/promises.d.ts +6 -5
- node v16.18/dns.d.ts +5 -5
- node v16.18/domain.d.ts +2 -2
- node v16.18/events.d.ts +13 -13
- node v16.18/fs/promises.d.ts +2 -2
- node v16.18/fs.d.ts +1 -1
- node v16.18/http.d.ts +2 -2
- node v16.18/http2.d.ts +24 -24
- node v16.18/https.d.ts +9 -9
- node v16.18/inspector.d.ts +1 -1
- node v16.18/module.d.ts +3 -3
- node v16.18/net.d.ts +2 -2
- node v16.18/os.d.ts +1 -1
- node v16.18/package.json +2 -2
- node v16.18/path.d.ts +1 -1
- node v16.18/perf_hooks.d.ts +11 -11
- node v16.18/punycode.d.ts +1 -1
- node v16.18/querystring.d.ts +1 -1
- node v16.18/readline.d.ts +12 -12
- node v16.18/repl.d.ts +4 -4
- node v16.18/stream.d.ts +18 -18
- node v16.18/string_decoder.d.ts +3 -3
- node v16.18/timers/promises.d.ts +1 -1
- node v16.18/timers.d.ts +1 -1
- node v16.18/tls.d.ts +5 -5
- node v16.18/trace_events.d.ts +3 -3
- node v16.18/tty.d.ts +1 -1
- node v16.18/url.d.ts +6 -6
- node v16.18/util.d.ts +40 -40
- node v16.18/v8.d.ts +11 -11
- node v16.18/vm.d.ts +11 -12
- node v16.18/worker_threads.d.ts +19 -19
- node v16.18/zlib.d.ts +8 -8
node v16.18/string_decoder.d.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* characters. It can be accessed using:
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
|
-
*
|
|
7
|
+
* import { StringDecoder } from 'node:string_decoder';
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
10
|
* The following example shows the basic use of the `StringDecoder` class.
|
|
11
11
|
*
|
|
12
12
|
* ```js
|
|
13
|
-
*
|
|
13
|
+
* import { StringDecoder } from 'node:string_decoder';
|
|
14
14
|
* const decoder = new StringDecoder('utf8');
|
|
15
15
|
*
|
|
16
16
|
* const cent = Buffer.from([0xC2, 0xA2]);
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* symbol (`€`) are written over three separate operations:
|
|
30
30
|
*
|
|
31
31
|
* ```js
|
|
32
|
-
*
|
|
32
|
+
* import { StringDecoder } from 'node:string_decoder';
|
|
33
33
|
* const decoder = new StringDecoder('utf8');
|
|
34
34
|
*
|
|
35
35
|
* decoder.write(Buffer.from([0xE2]));
|
node v16.18/timers/promises.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
|
-
* that return `Promise` objects. The API is accessible via`
|
|
3
|
+
* that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`.
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
6
|
* import {
|
node v16.18/timers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timer` module exposes a global API for scheduling functions to
|
|
3
3
|
* be called at some future period of time. Because the timer functions are
|
|
4
|
-
* globals, there is no need to
|
|
4
|
+
* globals, there is no need to import `node:timers` to use the API.
|
|
5
5
|
*
|
|
6
6
|
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
7
|
* provided by Web Browsers but use a different internal implementation that is
|
node v16.18/tls.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The module can be accessed using:
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
|
-
*
|
|
7
|
+
* import tls from 'node:tls';
|
|
8
8
|
* ```
|
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tls.js)
|
|
10
10
|
*/
|
|
@@ -905,8 +905,8 @@ declare module "tls" {
|
|
|
905
905
|
* The following illustrates a simple echo server:
|
|
906
906
|
*
|
|
907
907
|
* ```js
|
|
908
|
-
*
|
|
909
|
-
*
|
|
908
|
+
* import tls from 'node:tls';
|
|
909
|
+
* import fs from 'node:fs';
|
|
910
910
|
*
|
|
911
911
|
* const options = {
|
|
912
912
|
* key: fs.readFileSync('server-key.pem'),
|
|
@@ -951,8 +951,8 @@ declare module "tls" {
|
|
|
951
951
|
*
|
|
952
952
|
* ```js
|
|
953
953
|
* // Assumes an echo server that is listening on port 8000.
|
|
954
|
-
*
|
|
955
|
-
*
|
|
954
|
+
* import tls from 'node:tls';
|
|
955
|
+
* import fs from 'node:fs';
|
|
956
956
|
*
|
|
957
957
|
* const options = {
|
|
958
958
|
* // Necessary only if the server requires client certificate authentication.
|
node v16.18/trace_events.d.ts
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* Alternatively, trace events may be enabled using the `trace_events` module:
|
|
47
47
|
*
|
|
48
48
|
* ```js
|
|
49
|
-
*
|
|
49
|
+
* import trace_events from 'node:trace_events';
|
|
50
50
|
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
|
51
51
|
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
|
52
52
|
*
|
|
@@ -122,7 +122,7 @@ declare module "trace_events" {
|
|
|
122
122
|
* Creates and returns a `Tracing` object for the given set of `categories`.
|
|
123
123
|
*
|
|
124
124
|
* ```js
|
|
125
|
-
*
|
|
125
|
+
* import trace_events from 'node:trace_events';
|
|
126
126
|
* const categories = ['node.perf', 'node.async_hooks'];
|
|
127
127
|
* const tracing = trace_events.createTracing({ categories });
|
|
128
128
|
* tracing.enable();
|
|
@@ -142,7 +142,7 @@ declare module "trace_events" {
|
|
|
142
142
|
* Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
|
|
143
143
|
*
|
|
144
144
|
* ```js
|
|
145
|
-
*
|
|
145
|
+
* import trace_events from 'node:trace_events';
|
|
146
146
|
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
|
|
147
147
|
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
|
|
148
148
|
* const t3 = trace_events.createTracing({ categories: ['v8'] });
|
node v16.18/tty.d.ts
CHANGED
node v16.18/url.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ declare module "url" {
|
|
|
107
107
|
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
|
108
108
|
*
|
|
109
109
|
* ```js
|
|
110
|
-
*
|
|
110
|
+
* import url from 'node:url';
|
|
111
111
|
* url.format({
|
|
112
112
|
* protocol: 'https',
|
|
113
113
|
* hostname: 'example.com',
|
|
@@ -172,7 +172,7 @@ declare module "url" {
|
|
|
172
172
|
* manner similar to that of a Web browser resolving an anchor tag HREF.
|
|
173
173
|
*
|
|
174
174
|
* ```js
|
|
175
|
-
*
|
|
175
|
+
* import url from 'node:url';
|
|
176
176
|
* url.resolve('/one/two/three', 'four'); // '/one/two/four'
|
|
177
177
|
* url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
|
|
178
178
|
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
|
@@ -354,10 +354,10 @@ declare module "url" {
|
|
|
354
354
|
* Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
|
|
355
355
|
*
|
|
356
356
|
* ```js
|
|
357
|
-
*
|
|
357
|
+
* import {
|
|
358
358
|
* Blob,
|
|
359
359
|
* resolveObjectURL,
|
|
360
|
-
* }
|
|
360
|
+
* } from 'node:buffer';
|
|
361
361
|
*
|
|
362
362
|
* const blob = new Blob(['hello']);
|
|
363
363
|
* const id = URL.createObjectURL(blob);
|
|
@@ -861,7 +861,7 @@ declare module "url" {
|
|
|
861
861
|
URLSearchParams: typeof _URLSearchParams;
|
|
862
862
|
}
|
|
863
863
|
/**
|
|
864
|
-
* `URL` class is a global reference for `
|
|
864
|
+
* `URL` class is a global reference for `import { URL } from 'node:url'`
|
|
865
865
|
* https://nodejs.org/api/url.html#the-whatwg-url-api
|
|
866
866
|
* @since v10.0.0
|
|
867
867
|
*/
|
|
@@ -870,7 +870,7 @@ declare module "url" {
|
|
|
870
870
|
typeof globalThis extends { onmessage: any; URL: infer URL } ? URL
|
|
871
871
|
: typeof _URL;
|
|
872
872
|
/**
|
|
873
|
-
* `URLSearchParams` class is a global reference for `
|
|
873
|
+
* `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'`.
|
|
874
874
|
* https://nodejs.org/api/url.html#class-urlsearchparams
|
|
875
875
|
* @since v10.0.0
|
|
876
876
|
*/
|
node v16.18/util.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* it:
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
|
-
*
|
|
7
|
+
* import util from 'node:util';
|
|
8
8
|
* ```
|
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/util.js)
|
|
10
10
|
*/
|
|
@@ -158,7 +158,7 @@ declare module "util" {
|
|
|
158
158
|
* timestamp.
|
|
159
159
|
*
|
|
160
160
|
* ```js
|
|
161
|
-
*
|
|
161
|
+
* import util from 'node:util';
|
|
162
162
|
*
|
|
163
163
|
* util.log('Timestamped message.');
|
|
164
164
|
* ```
|
|
@@ -199,7 +199,7 @@ declare module "util" {
|
|
|
199
199
|
* Circular references point to their anchor by using a reference index:
|
|
200
200
|
*
|
|
201
201
|
* ```js
|
|
202
|
-
*
|
|
202
|
+
* import { inspect } from 'node:util';
|
|
203
203
|
*
|
|
204
204
|
* const obj = {};
|
|
205
205
|
* obj.a = [obj];
|
|
@@ -217,7 +217,7 @@ declare module "util" {
|
|
|
217
217
|
* The following example inspects all properties of the `util` object:
|
|
218
218
|
*
|
|
219
219
|
* ```js
|
|
220
|
-
*
|
|
220
|
+
* import util from 'node:util';
|
|
221
221
|
*
|
|
222
222
|
* console.log(util.inspect(util, { showHidden: true, depth: null }));
|
|
223
223
|
* ```
|
|
@@ -225,7 +225,7 @@ declare module "util" {
|
|
|
225
225
|
* The following example highlights the effect of the `compact` option:
|
|
226
226
|
*
|
|
227
227
|
* ```js
|
|
228
|
-
*
|
|
228
|
+
* import util from 'node:util';
|
|
229
229
|
*
|
|
230
230
|
* const o = {
|
|
231
231
|
* a: [1, 2, [[
|
|
@@ -282,7 +282,7 @@ declare module "util" {
|
|
|
282
282
|
* with no remaining strong references may be garbage collected at any time.
|
|
283
283
|
*
|
|
284
284
|
* ```js
|
|
285
|
-
*
|
|
285
|
+
* import { inspect } from 'node:util';
|
|
286
286
|
*
|
|
287
287
|
* const obj = { a: 1 };
|
|
288
288
|
* const obj2 = { b: 2 };
|
|
@@ -296,8 +296,8 @@ declare module "util" {
|
|
|
296
296
|
* impact the result of `util.inspect()`.
|
|
297
297
|
*
|
|
298
298
|
* ```js
|
|
299
|
-
*
|
|
300
|
-
*
|
|
299
|
+
* import { inspect } from 'node:util';
|
|
300
|
+
* import assert from 'node:assert';
|
|
301
301
|
*
|
|
302
302
|
* const o1 = {
|
|
303
303
|
* b: [2, 3, 1],
|
|
@@ -350,7 +350,7 @@ declare module "util" {
|
|
|
350
350
|
* Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`.
|
|
351
351
|
*
|
|
352
352
|
* ```js
|
|
353
|
-
*
|
|
353
|
+
* import util from 'node:util';
|
|
354
354
|
*
|
|
355
355
|
* util.isArray([]);
|
|
356
356
|
* // Returns: true
|
|
@@ -367,7 +367,7 @@ declare module "util" {
|
|
|
367
367
|
* Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
|
|
368
368
|
*
|
|
369
369
|
* ```js
|
|
370
|
-
*
|
|
370
|
+
* import util from 'node:util';
|
|
371
371
|
*
|
|
372
372
|
* util.isRegExp(/some regexp/);
|
|
373
373
|
* // Returns: true
|
|
@@ -384,7 +384,7 @@ declare module "util" {
|
|
|
384
384
|
* Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
|
|
385
385
|
*
|
|
386
386
|
* ```js
|
|
387
|
-
*
|
|
387
|
+
* import util from 'node:util';
|
|
388
388
|
*
|
|
389
389
|
* util.isDate(new Date());
|
|
390
390
|
* // Returns: true
|
|
@@ -401,7 +401,7 @@ declare module "util" {
|
|
|
401
401
|
* Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`.
|
|
402
402
|
*
|
|
403
403
|
* ```js
|
|
404
|
-
*
|
|
404
|
+
* import util from 'node:util';
|
|
405
405
|
*
|
|
406
406
|
* util.isError(new Error());
|
|
407
407
|
* // Returns: true
|
|
@@ -415,7 +415,7 @@ declare module "util" {
|
|
|
415
415
|
* possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`.
|
|
416
416
|
*
|
|
417
417
|
* ```js
|
|
418
|
-
*
|
|
418
|
+
* import util from 'node:util';
|
|
419
419
|
* const obj = { name: 'Error', message: 'an error occurred' };
|
|
420
420
|
*
|
|
421
421
|
* util.isError(obj);
|
|
@@ -440,8 +440,8 @@ declare module "util" {
|
|
|
440
440
|
* through the `constructor.super_` property.
|
|
441
441
|
*
|
|
442
442
|
* ```js
|
|
443
|
-
*
|
|
444
|
-
*
|
|
443
|
+
* import util from 'node:util';
|
|
444
|
+
* import EventEmitter from 'node:events';
|
|
445
445
|
*
|
|
446
446
|
* function MyStream() {
|
|
447
447
|
* EventEmitter.call(this);
|
|
@@ -467,7 +467,7 @@ declare module "util" {
|
|
|
467
467
|
* ES6 example using `class` and `extends`:
|
|
468
468
|
*
|
|
469
469
|
* ```js
|
|
470
|
-
*
|
|
470
|
+
* import EventEmitter from 'node:events';
|
|
471
471
|
*
|
|
472
472
|
* class MyStream extends EventEmitter {
|
|
473
473
|
* write(data) {
|
|
@@ -496,7 +496,7 @@ declare module "util" {
|
|
|
496
496
|
* environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op.
|
|
497
497
|
*
|
|
498
498
|
* ```js
|
|
499
|
-
*
|
|
499
|
+
* import util from 'node:util';
|
|
500
500
|
* const debuglog = util.debuglog('foo');
|
|
501
501
|
*
|
|
502
502
|
* debuglog('hello from foo [%d]', 123);
|
|
@@ -515,7 +515,7 @@ declare module "util" {
|
|
|
515
515
|
* The `section` supports wildcard also:
|
|
516
516
|
*
|
|
517
517
|
* ```js
|
|
518
|
-
*
|
|
518
|
+
* import util from 'node:util';
|
|
519
519
|
* const debuglog = util.debuglog('foo-bar');
|
|
520
520
|
*
|
|
521
521
|
* debuglog('hi there, it\'s foo-bar [%d]', 2333);
|
|
@@ -535,7 +535,7 @@ declare module "util" {
|
|
|
535
535
|
* unnecessary wrapping.
|
|
536
536
|
*
|
|
537
537
|
* ```js
|
|
538
|
-
*
|
|
538
|
+
* import util from 'node:util';
|
|
539
539
|
* let debuglog = util.debuglog('internals', (debug) => {
|
|
540
540
|
* // Replace with a logging function that optimizes out
|
|
541
541
|
* // testing if the section is enabled
|
|
@@ -553,7 +553,7 @@ declare module "util" {
|
|
|
553
553
|
* Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
|
|
554
554
|
*
|
|
555
555
|
* ```js
|
|
556
|
-
*
|
|
556
|
+
* import util from 'node:util';
|
|
557
557
|
*
|
|
558
558
|
* util.isBoolean(1);
|
|
559
559
|
* // Returns: false
|
|
@@ -570,7 +570,7 @@ declare module "util" {
|
|
|
570
570
|
* Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
|
|
571
571
|
*
|
|
572
572
|
* ```js
|
|
573
|
-
*
|
|
573
|
+
* import util from 'node:util';
|
|
574
574
|
*
|
|
575
575
|
* util.isBuffer({ length: 0 });
|
|
576
576
|
* // Returns: false
|
|
@@ -587,7 +587,7 @@ declare module "util" {
|
|
|
587
587
|
* Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`.
|
|
588
588
|
*
|
|
589
589
|
* ```js
|
|
590
|
-
*
|
|
590
|
+
* import util from 'node:util';
|
|
591
591
|
*
|
|
592
592
|
* function Foo() {}
|
|
593
593
|
* const Bar = () => {};
|
|
@@ -607,7 +607,7 @@ declare module "util" {
|
|
|
607
607
|
* Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
|
|
608
608
|
*
|
|
609
609
|
* ```js
|
|
610
|
-
*
|
|
610
|
+
* import util from 'node:util';
|
|
611
611
|
*
|
|
612
612
|
* util.isNull(0);
|
|
613
613
|
* // Returns: false
|
|
@@ -625,7 +625,7 @@ declare module "util" {
|
|
|
625
625
|
* returns `false`.
|
|
626
626
|
*
|
|
627
627
|
* ```js
|
|
628
|
-
*
|
|
628
|
+
* import util from 'node:util';
|
|
629
629
|
*
|
|
630
630
|
* util.isNullOrUndefined(0);
|
|
631
631
|
* // Returns: false
|
|
@@ -642,7 +642,7 @@ declare module "util" {
|
|
|
642
642
|
* Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
|
|
643
643
|
*
|
|
644
644
|
* ```js
|
|
645
|
-
*
|
|
645
|
+
* import util from 'node:util';
|
|
646
646
|
*
|
|
647
647
|
* util.isNumber(false);
|
|
648
648
|
* // Returns: false
|
|
@@ -662,7 +662,7 @@ declare module "util" {
|
|
|
662
662
|
* Otherwise, returns `false`.
|
|
663
663
|
*
|
|
664
664
|
* ```js
|
|
665
|
-
*
|
|
665
|
+
* import util from 'node:util';
|
|
666
666
|
*
|
|
667
667
|
* util.isObject(5);
|
|
668
668
|
* // Returns: false
|
|
@@ -681,7 +681,7 @@ declare module "util" {
|
|
|
681
681
|
* Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
|
|
682
682
|
*
|
|
683
683
|
* ```js
|
|
684
|
-
*
|
|
684
|
+
* import util from 'node:util';
|
|
685
685
|
*
|
|
686
686
|
* util.isPrimitive(5);
|
|
687
687
|
* // Returns: true
|
|
@@ -710,7 +710,7 @@ declare module "util" {
|
|
|
710
710
|
* Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
|
|
711
711
|
*
|
|
712
712
|
* ```js
|
|
713
|
-
*
|
|
713
|
+
* import util from 'node:util';
|
|
714
714
|
*
|
|
715
715
|
* util.isString('');
|
|
716
716
|
* // Returns: true
|
|
@@ -729,7 +729,7 @@ declare module "util" {
|
|
|
729
729
|
* Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
|
|
730
730
|
*
|
|
731
731
|
* ```js
|
|
732
|
-
*
|
|
732
|
+
* import util from 'node:util';
|
|
733
733
|
*
|
|
734
734
|
* util.isSymbol(5);
|
|
735
735
|
* // Returns: false
|
|
@@ -746,7 +746,7 @@ declare module "util" {
|
|
|
746
746
|
* Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
|
|
747
747
|
*
|
|
748
748
|
* ```js
|
|
749
|
-
*
|
|
749
|
+
* import util from 'node:util';
|
|
750
750
|
*
|
|
751
751
|
* const foo = undefined;
|
|
752
752
|
* util.isUndefined(5);
|
|
@@ -765,7 +765,7 @@ declare module "util" {
|
|
|
765
765
|
* such a way that it is marked as deprecated.
|
|
766
766
|
*
|
|
767
767
|
* ```js
|
|
768
|
-
*
|
|
768
|
+
* import util from 'node:util';
|
|
769
769
|
*
|
|
770
770
|
* exports.obsoleteFunction = util.deprecate(() => {
|
|
771
771
|
* // Do something here.
|
|
@@ -781,7 +781,7 @@ declare module "util" {
|
|
|
781
781
|
* the warning will be emitted only once for that `code`.
|
|
782
782
|
*
|
|
783
783
|
* ```js
|
|
784
|
-
*
|
|
784
|
+
* import util from 'node:util';
|
|
785
785
|
*
|
|
786
786
|
* const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
|
|
787
787
|
* const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
|
|
@@ -835,7 +835,7 @@ declare module "util" {
|
|
|
835
835
|
* first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value.
|
|
836
836
|
*
|
|
837
837
|
* ```js
|
|
838
|
-
*
|
|
838
|
+
* import util from 'node:util';
|
|
839
839
|
*
|
|
840
840
|
* async function fn() {
|
|
841
841
|
* return 'hello world';
|
|
@@ -961,8 +961,8 @@ declare module "util" {
|
|
|
961
961
|
* that returns promises.
|
|
962
962
|
*
|
|
963
963
|
* ```js
|
|
964
|
-
*
|
|
965
|
-
*
|
|
964
|
+
* import util from 'node:util';
|
|
965
|
+
* import fs from 'node:fs';
|
|
966
966
|
*
|
|
967
967
|
* const stat = util.promisify(fs.stat);
|
|
968
968
|
* stat('.').then((stats) => {
|
|
@@ -975,8 +975,8 @@ declare module "util" {
|
|
|
975
975
|
* Or, equivalently using `async function`s:
|
|
976
976
|
*
|
|
977
977
|
* ```js
|
|
978
|
-
*
|
|
979
|
-
*
|
|
978
|
+
* import util from 'node:util';
|
|
979
|
+
* import fs from 'node:fs';
|
|
980
980
|
*
|
|
981
981
|
* const stat = util.promisify(fs.stat);
|
|
982
982
|
*
|
|
@@ -997,7 +997,7 @@ declare module "util" {
|
|
|
997
997
|
* work as expected unless handled specially:
|
|
998
998
|
*
|
|
999
999
|
* ```js
|
|
1000
|
-
*
|
|
1000
|
+
* import util from 'node:util';
|
|
1001
1001
|
*
|
|
1002
1002
|
* class Foo {
|
|
1003
1003
|
* constructor() {
|
|
@@ -1166,7 +1166,7 @@ declare module "util" {
|
|
|
1166
1166
|
import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
|
|
1167
1167
|
global {
|
|
1168
1168
|
/**
|
|
1169
|
-
* `TextDecoder` class is a global reference for `
|
|
1169
|
+
* `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'`
|
|
1170
1170
|
* https://nodejs.org/api/globals.html#textdecoder
|
|
1171
1171
|
* @since v11.0.0
|
|
1172
1172
|
*/
|
|
@@ -1177,7 +1177,7 @@ declare module "util" {
|
|
|
1177
1177
|
: typeof _TextDecoder;
|
|
1178
1178
|
|
|
1179
1179
|
/**
|
|
1180
|
-
* `TextEncoder` class is a global reference for `
|
|
1180
|
+
* `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'`
|
|
1181
1181
|
* https://nodejs.org/api/globals.html#textencoder
|
|
1182
1182
|
* @since v11.0.0
|
|
1183
1183
|
*/
|
node v16.18/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
|
-
*
|
|
5
|
+
* import v8 from 'node:v8';
|
|
6
6
|
* ```
|
|
7
7
|
* @see [source](https://github.com/nodejs/node/blob/v16.20.2/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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
216
|
-
*
|
|
215
|
+
* import { writeHeapSnapshot } from 'node:v8';
|
|
216
|
+
* import {
|
|
217
217
|
* Worker,
|
|
218
218
|
* isMainThread,
|
|
219
219
|
* parentPort,
|
|
220
|
-
* }
|
|
220
|
+
* } from 'node:worker_threads';
|
|
221
221
|
*
|
|
222
222
|
* if (isMainThread) {
|
|
223
223
|
* const worker = new Worker(__filename);
|
|
@@ -554,12 +554,12 @@ declare module "v8" {
|
|
|
554
554
|
* ```js
|
|
555
555
|
* 'use strict';
|
|
556
556
|
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
557
|
+
* import fs from 'node:fs';
|
|
558
|
+
* import zlib from 'node:zlib';
|
|
559
|
+
* import path from 'node:path';
|
|
560
|
+
* import assert from 'node:assert';
|
|
561
561
|
*
|
|
562
|
-
*
|
|
562
|
+
* import v8 from 'node:v8';
|
|
563
563
|
*
|
|
564
564
|
* class BookShelf {
|
|
565
565
|
* storage = new Map();
|
node v16.18/vm.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* code are reflected in the context object.
|
|
16
16
|
*
|
|
17
17
|
* ```js
|
|
18
|
-
*
|
|
18
|
+
* import vm from 'node:vm';
|
|
19
19
|
*
|
|
20
20
|
* const x = 1;
|
|
21
21
|
*
|
|
@@ -166,7 +166,7 @@ declare module "vm" {
|
|
|
166
166
|
* The globals are contained in the `context` object.
|
|
167
167
|
*
|
|
168
168
|
* ```js
|
|
169
|
-
*
|
|
169
|
+
* import vm from 'node:vm';
|
|
170
170
|
*
|
|
171
171
|
* const context = {
|
|
172
172
|
* animal: 'cat',
|
|
@@ -202,7 +202,7 @@ declare module "vm" {
|
|
|
202
202
|
* contained within each individual `context`.
|
|
203
203
|
*
|
|
204
204
|
* ```js
|
|
205
|
-
*
|
|
205
|
+
* import vm from 'node:vm';
|
|
206
206
|
*
|
|
207
207
|
* const script = new vm.Script('globalVar = "set"');
|
|
208
208
|
*
|
|
@@ -227,7 +227,7 @@ declare module "vm" {
|
|
|
227
227
|
* executes that code multiple times:
|
|
228
228
|
*
|
|
229
229
|
* ```js
|
|
230
|
-
*
|
|
230
|
+
* import vm from 'node:vm';
|
|
231
231
|
*
|
|
232
232
|
* global.globalVar = 0;
|
|
233
233
|
*
|
|
@@ -280,7 +280,7 @@ declare module "vm" {
|
|
|
280
280
|
* will remain unchanged.
|
|
281
281
|
*
|
|
282
282
|
* ```js
|
|
283
|
-
*
|
|
283
|
+
* import vm from 'node:vm';
|
|
284
284
|
*
|
|
285
285
|
* global.globalVar = 3;
|
|
286
286
|
*
|
|
@@ -327,7 +327,7 @@ declare module "vm" {
|
|
|
327
327
|
* The following example compiles and executes different scripts using a single `contextified` object:
|
|
328
328
|
*
|
|
329
329
|
* ```js
|
|
330
|
-
*
|
|
330
|
+
* import vm from 'node:vm';
|
|
331
331
|
*
|
|
332
332
|
* const contextObject = { globalVar: 1 };
|
|
333
333
|
* vm.createContext(contextObject);
|
|
@@ -356,7 +356,7 @@ declare module "vm" {
|
|
|
356
356
|
* variable and sets a new one. These globals are contained in the `contextObject`.
|
|
357
357
|
*
|
|
358
358
|
* ```js
|
|
359
|
-
*
|
|
359
|
+
* import vm from 'node:vm';
|
|
360
360
|
*
|
|
361
361
|
* const contextObject = {
|
|
362
362
|
* animal: 'cat',
|
|
@@ -384,7 +384,7 @@ declare module "vm" {
|
|
|
384
384
|
* the JavaScript [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) function to run the same code:
|
|
385
385
|
*
|
|
386
386
|
* ```js
|
|
387
|
-
*
|
|
387
|
+
* import vm from 'node:vm';
|
|
388
388
|
* let localVar = 'initial value';
|
|
389
389
|
*
|
|
390
390
|
* const vmResult = vm.runInThisContext('localVar = "vm";');
|
|
@@ -411,12 +411,11 @@ declare module "vm" {
|
|
|
411
411
|
*
|
|
412
412
|
* ```js
|
|
413
413
|
* 'use strict';
|
|
414
|
-
*
|
|
414
|
+
* import vm from 'node:vm';
|
|
415
415
|
*
|
|
416
416
|
* const code = `
|
|
417
417
|
* ((require) => {
|
|
418
|
-
* const http = require('http');
|
|
419
|
-
*
|
|
418
|
+
* const http = require('node:http');
|
|
420
419
|
* http.createServer((request, response) => {
|
|
421
420
|
* response.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
422
421
|
* response.end('Hello World\\n');
|
|
@@ -458,7 +457,7 @@ declare module "vm" {
|
|
|
458
457
|
* the memory occupied by each heap space in the current V8 instance.
|
|
459
458
|
*
|
|
460
459
|
* ```js
|
|
461
|
-
*
|
|
460
|
+
* import vm from 'node:vm';
|
|
462
461
|
* // Measure the memory used by the main context.
|
|
463
462
|
* vm.measureMemory({ mode: 'summary' })
|
|
464
463
|
* // This is the same as vm.measureMemory()
|