@types/node 18.16.3 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert.d.ts +68 -73
- node/async_hooks.d.ts +62 -42
- node/buffer.d.ts +123 -95
- node/child_process.d.ts +50 -54
- node/cluster.d.ts +12 -12
- node/console.d.ts +5 -5
- node/crypto.d.ts +209 -220
- node/dgram.d.ts +15 -15
- node/diagnostics_channel.d.ts +25 -26
- node/dns/promises.d.ts +6 -6
- node/dns.d.ts +16 -16
- node/domain.d.ts +3 -3
- node/events.d.ts +60 -60
- node/fs/promises.d.ts +74 -48
- node/fs.d.ts +91 -81
- node/http.d.ts +147 -144
- node/http2.d.ts +42 -46
- node/https.d.ts +52 -153
- node/index.d.ts +1 -1
- node/inspector.d.ts +10 -3
- node/module.d.ts +5 -4
- node/net.d.ts +21 -18
- node/os.d.ts +22 -18
- node/package.json +2 -2
- node/path.d.ts +4 -4
- node/perf_hooks.d.ts +28 -15
- node/process.d.ts +43 -46
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +5 -5
- node/readline/promises.d.ts +6 -4
- node/readline.d.ts +15 -15
- node/repl.d.ts +9 -9
- node/stream/consumers.d.ts +1 -1
- node/stream.d.ts +74 -136
- node/string_decoder.d.ts +6 -6
- node/test.d.ts +0 -76
- node/timers/promises.d.ts +3 -3
- node/timers.d.ts +2 -2
- node/tls.d.ts +22 -15
- node/trace_events.d.ts +20 -9
- node/ts4.8/assert.d.ts +68 -73
- node/ts4.8/async_hooks.d.ts +59 -31
- node/ts4.8/buffer.d.ts +123 -95
- node/ts4.8/child_process.d.ts +50 -54
- node/ts4.8/cluster.d.ts +12 -12
- node/ts4.8/console.d.ts +5 -5
- node/ts4.8/crypto.d.ts +209 -220
- node/ts4.8/dgram.d.ts +15 -15
- node/ts4.8/diagnostics_channel.d.ts +25 -26
- node/ts4.8/dns/promises.d.ts +6 -6
- node/ts4.8/dns.d.ts +16 -16
- node/ts4.8/domain.d.ts +3 -3
- node/ts4.8/events.d.ts +60 -60
- node/ts4.8/fs/promises.d.ts +72 -45
- node/ts4.8/fs.d.ts +81 -67
- node/ts4.8/http.d.ts +133 -126
- node/ts4.8/http2.d.ts +42 -46
- node/ts4.8/https.d.ts +52 -153
- node/ts4.8/inspector.d.ts +10 -3
- node/ts4.8/module.d.ts +5 -4
- node/ts4.8/net.d.ts +21 -18
- node/ts4.8/os.d.ts +22 -18
- node/ts4.8/path.d.ts +4 -4
- node/ts4.8/perf_hooks.d.ts +28 -15
- node/ts4.8/process.d.ts +43 -46
- node/ts4.8/punycode.d.ts +1 -1
- node/ts4.8/querystring.d.ts +5 -5
- node/ts4.8/readline/promises.d.ts +6 -4
- node/ts4.8/readline.d.ts +15 -15
- node/ts4.8/repl.d.ts +9 -9
- node/ts4.8/stream/consumers.d.ts +1 -1
- node/ts4.8/stream.d.ts +77 -139
- node/ts4.8/string_decoder.d.ts +6 -6
- node/ts4.8/test.d.ts +0 -75
- node/ts4.8/timers/promises.d.ts +3 -3
- node/ts4.8/timers.d.ts +2 -2
- node/ts4.8/tls.d.ts +22 -15
- node/ts4.8/trace_events.d.ts +20 -9
- node/ts4.8/tty.d.ts +4 -5
- node/ts4.8/url.d.ts +26 -36
- node/ts4.8/util.d.ts +143 -116
- node/ts4.8/v8.d.ts +107 -16
- node/ts4.8/vm.d.ts +292 -42
- node/ts4.8/wasi.d.ts +8 -14
- node/ts4.8/worker_threads.d.ts +32 -34
- node/ts4.8/zlib.d.ts +11 -11
- node/tty.d.ts +4 -5
- node/url.d.ts +26 -36
- node/util.d.ts +146 -111
- node/v8.d.ts +110 -16
- node/vm.d.ts +292 -42
- node/wasi.d.ts +8 -14
- node/worker_threads.d.ts +32 -34
- node/zlib.d.ts +11 -11
node/path.d.ts
CHANGED
|
@@ -7,13 +7,13 @@ declare module 'path/win32' {
|
|
|
7
7
|
export = path;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* The `path` module provides utilities for working with file and directory
|
|
11
|
-
* It can be accessed using:
|
|
10
|
+
* The `node:path` module provides utilities for working with file and directory
|
|
11
|
+
* paths. It can be accessed using:
|
|
12
12
|
*
|
|
13
13
|
* ```js
|
|
14
|
-
* const path = require('path');
|
|
14
|
+
* const path = require('node:path');
|
|
15
15
|
* ```
|
|
16
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
16
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/path.js)
|
|
17
17
|
*/
|
|
18
18
|
declare module 'path' {
|
|
19
19
|
namespace path {
|
node/perf_hooks.d.ts
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
|
|
8
8
|
* * [Performance Timeline](https://w3c.github.io/performance-timeline/)
|
|
9
9
|
* * [User Timing](https://www.w3.org/TR/user-timing/)
|
|
10
|
+
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
|
|
10
11
|
*
|
|
11
12
|
* ```js
|
|
12
|
-
* const { PerformanceObserver, performance } = require('perf_hooks');
|
|
13
|
+
* const { PerformanceObserver, performance } = require('node:perf_hooks');
|
|
13
14
|
*
|
|
14
15
|
* const obs = new PerformanceObserver((items) => {
|
|
15
16
|
* console.log(items.getEntries()[0].duration);
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
* performance.measure('A to B', 'A', 'B');
|
|
27
28
|
* });
|
|
28
29
|
* ```
|
|
29
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
30
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/perf_hooks.js)
|
|
30
31
|
*/
|
|
31
32
|
declare module 'perf_hooks' {
|
|
32
33
|
import { AsyncResource } from 'node:async_hooks';
|
|
@@ -46,6 +47,7 @@ declare module 'perf_hooks' {
|
|
|
46
47
|
readonly flags?: number | undefined;
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
50
|
+
* The constructor of this class is not exposed to users directly.
|
|
49
51
|
* @since v8.5.0
|
|
50
52
|
*/
|
|
51
53
|
class PerformanceEntry {
|
|
@@ -87,10 +89,20 @@ declare module 'perf_hooks' {
|
|
|
87
89
|
readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
|
|
88
90
|
toJSON(): any;
|
|
89
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Exposes marks created via the `Performance.mark()` method.
|
|
94
|
+
* @since v18.2.0, v16.17.0
|
|
95
|
+
*/
|
|
90
96
|
class PerformanceMark extends PerformanceEntry {
|
|
91
97
|
readonly duration: 0;
|
|
92
98
|
readonly entryType: 'mark';
|
|
93
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Exposes measures created via the `Performance.measure()` method.
|
|
102
|
+
*
|
|
103
|
+
* The constructor of this class is not exposed to users directly.
|
|
104
|
+
* @since v18.2.0, v16.17.0
|
|
105
|
+
*/
|
|
94
106
|
class PerformanceMeasure extends PerformanceEntry {
|
|
95
107
|
readonly entryType: 'measure';
|
|
96
108
|
}
|
|
@@ -288,8 +300,8 @@ declare module 'perf_hooks' {
|
|
|
288
300
|
* ```js
|
|
289
301
|
* const {
|
|
290
302
|
* performance,
|
|
291
|
-
* PerformanceObserver
|
|
292
|
-
* } = require('perf_hooks');
|
|
303
|
+
* PerformanceObserver,
|
|
304
|
+
* } = require('node:perf_hooks');
|
|
293
305
|
*
|
|
294
306
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
295
307
|
* console.log(perfObserverList.getEntries());
|
|
@@ -330,8 +342,8 @@ declare module 'perf_hooks' {
|
|
|
330
342
|
* ```js
|
|
331
343
|
* const {
|
|
332
344
|
* performance,
|
|
333
|
-
* PerformanceObserver
|
|
334
|
-
* } = require('perf_hooks');
|
|
345
|
+
* PerformanceObserver,
|
|
346
|
+
* } = require('node:perf_hooks');
|
|
335
347
|
*
|
|
336
348
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
337
349
|
* console.log(perfObserverList.getEntriesByName('meow'));
|
|
@@ -379,8 +391,8 @@ declare module 'perf_hooks' {
|
|
|
379
391
|
* ```js
|
|
380
392
|
* const {
|
|
381
393
|
* performance,
|
|
382
|
-
* PerformanceObserver
|
|
383
|
-
* } = require('perf_hooks');
|
|
394
|
+
* PerformanceObserver,
|
|
395
|
+
* } = require('node:perf_hooks');
|
|
384
396
|
*
|
|
385
397
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
386
398
|
* console.log(perfObserverList.getEntriesByType('mark'));
|
|
@@ -414,6 +426,9 @@ declare module 'perf_hooks' {
|
|
|
414
426
|
getEntriesByType(type: EntryType): PerformanceEntry[];
|
|
415
427
|
}
|
|
416
428
|
type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
|
|
429
|
+
/**
|
|
430
|
+
* @since v8.5.0
|
|
431
|
+
*/
|
|
417
432
|
class PerformanceObserver extends AsyncResource {
|
|
418
433
|
constructor(callback: PerformanceObserverCallback);
|
|
419
434
|
/**
|
|
@@ -427,8 +442,8 @@ declare module 'perf_hooks' {
|
|
|
427
442
|
* ```js
|
|
428
443
|
* const {
|
|
429
444
|
* performance,
|
|
430
|
-
* PerformanceObserver
|
|
431
|
-
* } = require('perf_hooks');
|
|
445
|
+
* PerformanceObserver,
|
|
446
|
+
* } = require('node:perf_hooks');
|
|
432
447
|
*
|
|
433
448
|
* const obs = new PerformanceObserver((list, observer) => {
|
|
434
449
|
* // Called once asynchronously. `list` contains three items.
|
|
@@ -547,11 +562,10 @@ declare module 'perf_hooks' {
|
|
|
547
562
|
*/
|
|
548
563
|
recordDelta(): void;
|
|
549
564
|
/**
|
|
550
|
-
* Adds the values from other to this histogram.
|
|
565
|
+
* Adds the values from `other` to this histogram.
|
|
551
566
|
* @since v17.4.0, v16.14.0
|
|
552
|
-
* @param other Recordable Histogram to combine with
|
|
553
567
|
*/
|
|
554
|
-
|
|
568
|
+
add(other: RecordableHistogram): void;
|
|
555
569
|
}
|
|
556
570
|
/**
|
|
557
571
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
@@ -566,7 +580,7 @@ declare module 'perf_hooks' {
|
|
|
566
580
|
* detect.
|
|
567
581
|
*
|
|
568
582
|
* ```js
|
|
569
|
-
* const { monitorEventLoopDelay } = require('perf_hooks');
|
|
583
|
+
* const { monitorEventLoopDelay } = require('node:perf_hooks');
|
|
570
584
|
* const h = monitorEventLoopDelay({ resolution: 20 });
|
|
571
585
|
* h.enable();
|
|
572
586
|
* // Do something.
|
|
@@ -604,7 +618,6 @@ declare module 'perf_hooks' {
|
|
|
604
618
|
* @since v15.9.0, v14.18.0
|
|
605
619
|
*/
|
|
606
620
|
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
|
607
|
-
|
|
608
621
|
import { performance as _performance } from 'perf_hooks';
|
|
609
622
|
global {
|
|
610
623
|
/**
|
node/process.d.ts
CHANGED
|
@@ -250,7 +250,7 @@ declare module 'process' {
|
|
|
250
250
|
* For example, to copy `process.stdin` to `process.stdout`:
|
|
251
251
|
*
|
|
252
252
|
* ```js
|
|
253
|
-
* import { stdin, stdout } from 'process';
|
|
253
|
+
* import { stdin, stdout } from 'node:process';
|
|
254
254
|
*
|
|
255
255
|
* stdin.pipe(stdout);
|
|
256
256
|
* ```
|
|
@@ -297,7 +297,7 @@ declare module 'process' {
|
|
|
297
297
|
* For example, assuming the following script for `process-args.js`:
|
|
298
298
|
*
|
|
299
299
|
* ```js
|
|
300
|
-
* import { argv } from 'process';
|
|
300
|
+
* import { argv } from 'node:process';
|
|
301
301
|
*
|
|
302
302
|
* // print process.argv
|
|
303
303
|
* argv.forEach((val, index) => {
|
|
@@ -389,7 +389,7 @@ declare module 'process' {
|
|
|
389
389
|
* the specified `directory` does not exist).
|
|
390
390
|
*
|
|
391
391
|
* ```js
|
|
392
|
-
* import { chdir, cwd } from 'process';
|
|
392
|
+
* import { chdir, cwd } from 'node:process';
|
|
393
393
|
*
|
|
394
394
|
* console.log(`Starting directory: ${cwd()}`);
|
|
395
395
|
* try {
|
|
@@ -409,7 +409,7 @@ declare module 'process' {
|
|
|
409
409
|
* process.
|
|
410
410
|
*
|
|
411
411
|
* ```js
|
|
412
|
-
* import { cwd } from 'process';
|
|
412
|
+
* import { cwd } from 'node:process';
|
|
413
413
|
*
|
|
414
414
|
* console.log(`Current directory: ${cwd()}`);
|
|
415
415
|
* ```
|
|
@@ -420,7 +420,7 @@ declare module 'process' {
|
|
|
420
420
|
* The port used by the Node.js debugger when enabled.
|
|
421
421
|
*
|
|
422
422
|
* ```js
|
|
423
|
-
* import process from 'process';
|
|
423
|
+
* import process from 'node:process';
|
|
424
424
|
*
|
|
425
425
|
* process.debugPort = 5858;
|
|
426
426
|
* ```
|
|
@@ -432,12 +432,12 @@ declare module 'process' {
|
|
|
432
432
|
* specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
|
|
433
433
|
*
|
|
434
434
|
* ```js
|
|
435
|
-
* import { emitWarning } from 'process';
|
|
435
|
+
* import { emitWarning } from 'node:process';
|
|
436
436
|
*
|
|
437
437
|
* // Emit a warning with a code and additional detail.
|
|
438
438
|
* emitWarning('Something happened!', {
|
|
439
439
|
* code: 'MY_WARNING',
|
|
440
|
-
* detail: 'This is some additional information'
|
|
440
|
+
* detail: 'This is some additional information',
|
|
441
441
|
* });
|
|
442
442
|
* // Emits:
|
|
443
443
|
* // (node:56338) [MY_WARNING] Warning: Something happened!
|
|
@@ -447,7 +447,7 @@ declare module 'process' {
|
|
|
447
447
|
* In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler.
|
|
448
448
|
*
|
|
449
449
|
* ```js
|
|
450
|
-
* import process from 'process';
|
|
450
|
+
* import process from 'node:process';
|
|
451
451
|
*
|
|
452
452
|
* process.on('warning', (warning) => {
|
|
453
453
|
* console.warn(warning.name); // 'Warning'
|
|
@@ -499,7 +499,7 @@ declare module 'process' {
|
|
|
499
499
|
* While the following will:
|
|
500
500
|
*
|
|
501
501
|
* ```js
|
|
502
|
-
* import { env } from 'process';
|
|
502
|
+
* import { env } from 'node:process';
|
|
503
503
|
*
|
|
504
504
|
* env.foo = 'bar';
|
|
505
505
|
* console.log(env.foo);
|
|
@@ -510,7 +510,7 @@ declare module 'process' {
|
|
|
510
510
|
* throw an error when the value is not a string, number, or boolean.
|
|
511
511
|
*
|
|
512
512
|
* ```js
|
|
513
|
-
* import { env } from 'process';
|
|
513
|
+
* import { env } from 'node:process';
|
|
514
514
|
*
|
|
515
515
|
* env.test = null;
|
|
516
516
|
* console.log(env.test);
|
|
@@ -523,7 +523,7 @@ declare module 'process' {
|
|
|
523
523
|
* Use `delete` to delete a property from `process.env`.
|
|
524
524
|
*
|
|
525
525
|
* ```js
|
|
526
|
-
* import { env } from 'process';
|
|
526
|
+
* import { env } from 'node:process';
|
|
527
527
|
*
|
|
528
528
|
* env.TEST = 1;
|
|
529
529
|
* delete env.TEST;
|
|
@@ -534,7 +534,7 @@ declare module 'process' {
|
|
|
534
534
|
* On Windows operating systems, environment variables are case-insensitive.
|
|
535
535
|
*
|
|
536
536
|
* ```js
|
|
537
|
-
* import { env } from 'process';
|
|
537
|
+
* import { env } from 'node:process';
|
|
538
538
|
*
|
|
539
539
|
* env.TEST = 1;
|
|
540
540
|
* console.log(env.test);
|
|
@@ -543,7 +543,7 @@ declare module 'process' {
|
|
|
543
543
|
*
|
|
544
544
|
* Unless explicitly specified when creating a `Worker` instance,
|
|
545
545
|
* each `Worker` thread has its own copy of `process.env`, based on its
|
|
546
|
-
* parent thread
|
|
546
|
+
* parent thread's `process.env`, or whatever was specified as the `env` option
|
|
547
547
|
* to the `Worker` constructor. Changes to `process.env` will not be visible
|
|
548
548
|
* across `Worker` threads, and only the main thread can make changes that
|
|
549
549
|
* are visible to the operating system or to native add-ons.
|
|
@@ -560,7 +560,7 @@ declare module 'process' {
|
|
|
560
560
|
* To exit with a 'failure' code:
|
|
561
561
|
*
|
|
562
562
|
* ```js
|
|
563
|
-
* import { exit } from 'process';
|
|
563
|
+
* import { exit } from 'node:process';
|
|
564
564
|
*
|
|
565
565
|
* exit(1);
|
|
566
566
|
* ```
|
|
@@ -579,7 +579,7 @@ declare module 'process' {
|
|
|
579
579
|
* truncated and lost:
|
|
580
580
|
*
|
|
581
581
|
* ```js
|
|
582
|
-
* import { exit } from 'process';
|
|
582
|
+
* import { exit } from 'node:process';
|
|
583
583
|
*
|
|
584
584
|
* // This is an example of what *not* to do:
|
|
585
585
|
* if (someConditionNotMet()) {
|
|
@@ -596,7 +596,7 @@ declare module 'process' {
|
|
|
596
596
|
* scheduling any additional work for the event loop:
|
|
597
597
|
*
|
|
598
598
|
* ```js
|
|
599
|
-
* import process from 'process';
|
|
599
|
+
* import process from 'node:process';
|
|
600
600
|
*
|
|
601
601
|
* // How to properly set the exit code while letting
|
|
602
602
|
* // the process exit gracefully.
|
|
@@ -613,7 +613,7 @@ declare module 'process' {
|
|
|
613
613
|
* In `Worker` threads, this function stops the current thread rather
|
|
614
614
|
* than the current process.
|
|
615
615
|
* @since v0.1.13
|
|
616
|
-
* @param [code=0] The exit code.
|
|
616
|
+
* @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
|
|
617
617
|
*/
|
|
618
618
|
exit(code?: number): never;
|
|
619
619
|
/**
|
|
@@ -873,7 +873,7 @@ declare module 'process' {
|
|
|
873
873
|
* The `process.version` property contains the Node.js version string.
|
|
874
874
|
*
|
|
875
875
|
* ```js
|
|
876
|
-
* import { version } from 'process';
|
|
876
|
+
* import { version } from 'node:process';
|
|
877
877
|
*
|
|
878
878
|
* console.log(`Version: ${version}`);
|
|
879
879
|
* // Version: v14.8.0
|
|
@@ -890,7 +890,7 @@ declare module 'process' {
|
|
|
890
890
|
* to load modules that were compiled against a different module ABI version.
|
|
891
891
|
*
|
|
892
892
|
* ```js
|
|
893
|
-
* import { versions } from 'process';
|
|
893
|
+
* import { versions } from 'node:process';
|
|
894
894
|
*
|
|
895
895
|
* console.log(versions);
|
|
896
896
|
* ```
|
|
@@ -918,10 +918,10 @@ declare module 'process' {
|
|
|
918
918
|
*/
|
|
919
919
|
readonly versions: ProcessVersions;
|
|
920
920
|
/**
|
|
921
|
-
* The `process.config` property returns
|
|
922
|
-
* representation of the configure options used to compile the current
|
|
923
|
-
* executable. This is the same as the `config.gypi` file that was produced
|
|
924
|
-
* running the `./configure` script.
|
|
921
|
+
* The `process.config` property returns a frozen `Object` containing the
|
|
922
|
+
* JavaScript representation of the configure options used to compile the current
|
|
923
|
+
* Node.js executable. This is the same as the `config.gypi` file that was produced
|
|
924
|
+
* when running the `./configure` script.
|
|
925
925
|
*
|
|
926
926
|
* An example of the possible output looks like:
|
|
927
927
|
*
|
|
@@ -943,7 +943,6 @@ declare module 'process' {
|
|
|
943
943
|
* node_shared_http_parser: 'false',
|
|
944
944
|
* node_shared_libuv: 'false',
|
|
945
945
|
* node_shared_zlib: 'false',
|
|
946
|
-
* node_use_dtrace: 'false',
|
|
947
946
|
* node_use_openssl: 'true',
|
|
948
947
|
* node_shared_openssl: 'false',
|
|
949
948
|
* strict_aliasing: 'true',
|
|
@@ -952,13 +951,6 @@ declare module 'process' {
|
|
|
952
951
|
* }
|
|
953
952
|
* }
|
|
954
953
|
* ```
|
|
955
|
-
*
|
|
956
|
-
* The `process.config` property is **not** read-only and there are existing
|
|
957
|
-
* modules in the ecosystem that are known to extend, modify, or entirely replace
|
|
958
|
-
* the value of `process.config`.
|
|
959
|
-
*
|
|
960
|
-
* Modifying the `process.config` property, or any child-property of the`process.config` object has been deprecated. The `process.config` will be made
|
|
961
|
-
* read-only in a future release.
|
|
962
954
|
* @since v0.7.7
|
|
963
955
|
*/
|
|
964
956
|
readonly config: ProcessConfig;
|
|
@@ -977,7 +969,7 @@ declare module 'process' {
|
|
|
977
969
|
* other than kill the target process.
|
|
978
970
|
*
|
|
979
971
|
* ```js
|
|
980
|
-
* import process, { kill } from 'process';
|
|
972
|
+
* import process, { kill } from 'node:process';
|
|
981
973
|
*
|
|
982
974
|
* process.on('SIGHUP', () => {
|
|
983
975
|
* console.log('Got SIGHUP signal.');
|
|
@@ -1002,7 +994,7 @@ declare module 'process' {
|
|
|
1002
994
|
* The `process.pid` property returns the PID of the process.
|
|
1003
995
|
*
|
|
1004
996
|
* ```js
|
|
1005
|
-
* import { pid } from 'process';
|
|
997
|
+
* import { pid } from 'node:process';
|
|
1006
998
|
*
|
|
1007
999
|
* console.log(`This process is pid ${pid}`);
|
|
1008
1000
|
* ```
|
|
@@ -1014,7 +1006,7 @@ declare module 'process' {
|
|
|
1014
1006
|
* current process.
|
|
1015
1007
|
*
|
|
1016
1008
|
* ```js
|
|
1017
|
-
* import { ppid } from 'process';
|
|
1009
|
+
* import { ppid } from 'node:process';
|
|
1018
1010
|
*
|
|
1019
1011
|
* console.log(`The parent process is pid ${ppid}`);
|
|
1020
1012
|
* ```
|
|
@@ -1044,7 +1036,7 @@ declare module 'process' {
|
|
|
1044
1036
|
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
|
|
1045
1037
|
*
|
|
1046
1038
|
* ```js
|
|
1047
|
-
* import { arch } from 'process';
|
|
1039
|
+
* import { arch } from 'node:process';
|
|
1048
1040
|
*
|
|
1049
1041
|
* console.log(`This processor architecture is ${arch}`);
|
|
1050
1042
|
* ```
|
|
@@ -1066,7 +1058,7 @@ declare module 'process' {
|
|
|
1066
1058
|
* * `'win32'`
|
|
1067
1059
|
*
|
|
1068
1060
|
* ```js
|
|
1069
|
-
* import { platform } from 'process';
|
|
1061
|
+
* import { platform } from 'node:process';
|
|
1070
1062
|
*
|
|
1071
1063
|
* console.log(`This platform is ${platform}`);
|
|
1072
1064
|
* ```
|
|
@@ -1093,6 +1085,11 @@ declare module 'process' {
|
|
|
1093
1085
|
* Gets the amount of memory available to the process (in bytes) based on
|
|
1094
1086
|
* limits imposed by the OS. If there is no such constraint, or the constraint
|
|
1095
1087
|
* is unknown, `undefined` is returned.
|
|
1088
|
+
*
|
|
1089
|
+
* See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
|
|
1090
|
+
* information.
|
|
1091
|
+
* @since v19.6.0, v18.15.0
|
|
1092
|
+
* @experimental
|
|
1096
1093
|
*/
|
|
1097
1094
|
constrainedMemory(): number | undefined;
|
|
1098
1095
|
/**
|
|
@@ -1106,7 +1103,7 @@ declare module 'process' {
|
|
|
1106
1103
|
* argument to the function, to get a diff reading.
|
|
1107
1104
|
*
|
|
1108
1105
|
* ```js
|
|
1109
|
-
* import { cpuUsage } from 'process';
|
|
1106
|
+
* import { cpuUsage } from 'node:process';
|
|
1110
1107
|
*
|
|
1111
1108
|
* const startUsage = cpuUsage();
|
|
1112
1109
|
* // { user: 38579, system: 6986 }
|
|
@@ -1130,7 +1127,7 @@ declare module 'process' {
|
|
|
1130
1127
|
* See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
|
|
1131
1128
|
*
|
|
1132
1129
|
* ```js
|
|
1133
|
-
* import { nextTick } from 'process';
|
|
1130
|
+
* import { nextTick } from 'node:process';
|
|
1134
1131
|
*
|
|
1135
1132
|
* console.log('start');
|
|
1136
1133
|
* nextTick(() => {
|
|
@@ -1148,7 +1145,7 @@ declare module 'process' {
|
|
|
1148
1145
|
* I/O has occurred:
|
|
1149
1146
|
*
|
|
1150
1147
|
* ```js
|
|
1151
|
-
* import { nextTick } from 'process';
|
|
1148
|
+
* import { nextTick } from 'node:process';
|
|
1152
1149
|
*
|
|
1153
1150
|
* function MyThing(options) {
|
|
1154
1151
|
* this.setupOptions(options);
|
|
@@ -1196,7 +1193,7 @@ declare module 'process' {
|
|
|
1196
1193
|
* The following approach is much better:
|
|
1197
1194
|
*
|
|
1198
1195
|
* ```js
|
|
1199
|
-
* import { nextTick } from 'process';
|
|
1196
|
+
* import { nextTick } from 'node:process';
|
|
1200
1197
|
*
|
|
1201
1198
|
* function definitelyAsync(arg, cb) {
|
|
1202
1199
|
* if (arg) {
|
|
@@ -1221,10 +1218,10 @@ declare module 'process' {
|
|
|
1221
1218
|
* ```js
|
|
1222
1219
|
* {
|
|
1223
1220
|
* name: 'node',
|
|
1224
|
-
* lts: '
|
|
1225
|
-
* sourceUrl: 'https://nodejs.org/download/release/
|
|
1226
|
-
* headersUrl: 'https://nodejs.org/download/release/
|
|
1227
|
-
* libUrl: 'https://nodejs.org/download/release/
|
|
1221
|
+
* lts: 'Hydrogen',
|
|
1222
|
+
* sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz',
|
|
1223
|
+
* headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz',
|
|
1224
|
+
* libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib'
|
|
1228
1225
|
* }
|
|
1229
1226
|
* ```
|
|
1230
1227
|
*
|
|
@@ -1328,7 +1325,7 @@ declare module 'process' {
|
|
|
1328
1325
|
* dashes:
|
|
1329
1326
|
*
|
|
1330
1327
|
* ```js
|
|
1331
|
-
* import { allowedNodeEnvironmentFlags } from 'process';
|
|
1328
|
+
* import { allowedNodeEnvironmentFlags } from 'node:process';
|
|
1332
1329
|
*
|
|
1333
1330
|
* allowedNodeEnvironmentFlags.forEach((flag) => {
|
|
1334
1331
|
* // -r
|
|
@@ -1354,7 +1351,7 @@ declare module 'process' {
|
|
|
1354
1351
|
report?: ProcessReport | undefined;
|
|
1355
1352
|
/**
|
|
1356
1353
|
* ```js
|
|
1357
|
-
* import { resourceUsage } from 'process';
|
|
1354
|
+
* import { resourceUsage } from 'node:process';
|
|
1358
1355
|
*
|
|
1359
1356
|
* console.log(resourceUsage());
|
|
1360
1357
|
* /*
|
node/punycode.d.ts
CHANGED
|
@@ -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/
|
|
27
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/punycode.js)
|
|
28
28
|
*/
|
|
29
29
|
declare module 'punycode' {
|
|
30
30
|
/**
|
node/querystring.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `querystring` module provides utilities for parsing and formatting URL
|
|
2
|
+
* The `node:querystring` module provides utilities for parsing and formatting URL
|
|
3
3
|
* query strings. It can be accessed using:
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
* const querystring = require('querystring');
|
|
6
|
+
* const querystring = require('node:querystring');
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
9
|
* `querystring` is more performant than `URLSearchParams` but is not a
|
|
10
|
-
* standardized API. Use `URLSearchParams` when performance is not critical
|
|
11
|
-
*
|
|
12
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
10
|
+
* standardized API. Use `URLSearchParams` when performance is not critical or
|
|
11
|
+
* when compatibility with browser code is desirable.
|
|
12
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/querystring.js)
|
|
13
13
|
*/
|
|
14
14
|
declare module 'querystring' {
|
|
15
15
|
interface StringifyOptions {
|
node/readline/promises.d.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
declare module 'readline/promises' {
|
|
8
8
|
import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';
|
|
9
9
|
import { Abortable } from 'node:events';
|
|
10
|
-
|
|
11
10
|
class Interface extends _Interface {
|
|
12
11
|
/**
|
|
13
12
|
* The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input,
|
|
@@ -45,12 +44,16 @@ declare module 'readline/promises' {
|
|
|
45
44
|
question(query: string): Promise<string>;
|
|
46
45
|
question(query: string, options: Abortable): Promise<string>;
|
|
47
46
|
}
|
|
48
|
-
|
|
49
47
|
class Readline {
|
|
50
48
|
/**
|
|
51
49
|
* @param stream A TTY stream.
|
|
52
50
|
*/
|
|
53
|
-
constructor(
|
|
51
|
+
constructor(
|
|
52
|
+
stream: NodeJS.WritableStream,
|
|
53
|
+
options?: {
|
|
54
|
+
autoCommit?: boolean;
|
|
55
|
+
}
|
|
56
|
+
);
|
|
54
57
|
/**
|
|
55
58
|
* The `rl.clearLine()` method adds to the internal list of pending action an action that clears current line of the associated `stream` in a specified direction identified by `dir`.
|
|
56
59
|
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
|
|
@@ -80,7 +83,6 @@ declare module 'readline/promises' {
|
|
|
80
83
|
*/
|
|
81
84
|
rollback(): this;
|
|
82
85
|
}
|
|
83
|
-
|
|
84
86
|
/**
|
|
85
87
|
* The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
|
|
86
88
|
*
|
node/readline.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
|
|
2
|
+
* The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
|
|
3
3
|
*
|
|
4
4
|
* To use the promise-based APIs:
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* import * as readline from 'node:readline';
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
|
-
* The following simple example illustrates the basic use of the `readline`
|
|
16
|
+
* The following simple example illustrates the basic use of the `node:readline`module.
|
|
17
17
|
*
|
|
18
18
|
* ```js
|
|
19
19
|
* import * as readline from 'node:readline/promises';
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
*
|
|
31
31
|
* 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
|
|
32
32
|
* received on the `input` stream.
|
|
33
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
33
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/readline.js)
|
|
34
34
|
*/
|
|
35
35
|
declare module 'readline' {
|
|
36
36
|
import { Abortable, EventEmitter } from 'node:events';
|
|
@@ -408,11 +408,11 @@ declare module 'readline' {
|
|
|
408
408
|
* implement a small command-line interface:
|
|
409
409
|
*
|
|
410
410
|
* ```js
|
|
411
|
-
* const readline = require('readline');
|
|
411
|
+
* const readline = require('node:readline');
|
|
412
412
|
* const rl = readline.createInterface({
|
|
413
413
|
* input: process.stdin,
|
|
414
414
|
* output: process.stdout,
|
|
415
|
-
* prompt: 'OHAI> '
|
|
415
|
+
* prompt: 'OHAI> ',
|
|
416
416
|
* });
|
|
417
417
|
*
|
|
418
418
|
* rl.prompt();
|
|
@@ -440,15 +440,15 @@ declare module 'readline' {
|
|
|
440
440
|
* well as a `for await...of` loop:
|
|
441
441
|
*
|
|
442
442
|
* ```js
|
|
443
|
-
* const fs = require('fs');
|
|
444
|
-
* const readline = require('readline');
|
|
443
|
+
* const fs = require('node:fs');
|
|
444
|
+
* const readline = require('node:readline');
|
|
445
445
|
*
|
|
446
446
|
* async function processLineByLine() {
|
|
447
447
|
* const fileStream = fs.createReadStream('input.txt');
|
|
448
448
|
*
|
|
449
449
|
* const rl = readline.createInterface({
|
|
450
450
|
* input: fileStream,
|
|
451
|
-
* crlfDelay: Infinity
|
|
451
|
+
* crlfDelay: Infinity,
|
|
452
452
|
* });
|
|
453
453
|
* // Note: we use the crlfDelay option to recognize all instances of CR LF
|
|
454
454
|
* // ('\r\n') in input.txt as a single line break.
|
|
@@ -465,12 +465,12 @@ declare module 'readline' {
|
|
|
465
465
|
* Alternatively, one could use the `'line'` event:
|
|
466
466
|
*
|
|
467
467
|
* ```js
|
|
468
|
-
* const fs = require('fs');
|
|
469
|
-
* const readline = require('readline');
|
|
468
|
+
* const fs = require('node:fs');
|
|
469
|
+
* const readline = require('node:readline');
|
|
470
470
|
*
|
|
471
471
|
* const rl = readline.createInterface({
|
|
472
472
|
* input: fs.createReadStream('sample.txt'),
|
|
473
|
-
* crlfDelay: Infinity
|
|
473
|
+
* crlfDelay: Infinity,
|
|
474
474
|
* });
|
|
475
475
|
*
|
|
476
476
|
* rl.on('line', (line) => {
|
|
@@ -481,15 +481,15 @@ declare module 'readline' {
|
|
|
481
481
|
* Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
|
|
482
482
|
*
|
|
483
483
|
* ```js
|
|
484
|
-
* const { once } = require('events');
|
|
485
|
-
* const { createReadStream } = require('fs');
|
|
486
|
-
* const { createInterface } = require('readline');
|
|
484
|
+
* const { once } = require('node:events');
|
|
485
|
+
* const { createReadStream } = require('node:fs');
|
|
486
|
+
* const { createInterface } = require('node:readline');
|
|
487
487
|
*
|
|
488
488
|
* (async function processLineByLine() {
|
|
489
489
|
* try {
|
|
490
490
|
* const rl = createInterface({
|
|
491
491
|
* input: createReadStream('big-file.txt'),
|
|
492
|
-
* crlfDelay: Infinity
|
|
492
|
+
* crlfDelay: Infinity,
|
|
493
493
|
* });
|
|
494
494
|
*
|
|
495
495
|
* rl.on('line', (line) => {
|