@types/node 16.11.39 → 18.11.2
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.11 → node}/LICENSE +0 -0
- node v16.11/README.md → node/README.md +4 -4
- {node v16.11 → node}/assert/strict.d.ts +0 -0
- node v16.11/assert.d.ts → node/assert.d.ts +7 -8
- node v16.11/async_hooks.d.ts → node/async_hooks.d.ts +8 -4
- node/buffer.d.ts +2258 -0
- node v16.11/child_process.d.ts → node/child_process.d.ts +6 -3
- node v16.11/cluster.d.ts → node/cluster.d.ts +14 -18
- node v16.11/console.d.ts → node/console.d.ts +1 -1
- {node v16.11 → node}/constants.d.ts +0 -0
- node v16.11/crypto.d.ts → node/crypto.d.ts +679 -53
- node v16.11/dgram.d.ts → node/dgram.d.ts +3 -3
- node v16.11/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +2 -1
- node v16.11/dns/promises.d.ts → node/dns/promises.d.ts +10 -8
- node v16.11/dns.d.ts → node/dns.d.ts +16 -11
- node/dom-events.d.ts +126 -0
- node v16.11/domain.d.ts → node/domain.d.ts +3 -2
- node v16.11/events.d.ts → node/events.d.ts +65 -10
- node v16.11/fs/promises.d.ts → node/fs/promises.d.ts +86 -39
- node v16.11/fs.d.ts → node/fs.d.ts +149 -67
- node/globals.d.ts +300 -0
- {node v16.11 → node}/globals.global.d.ts +0 -0
- node v16.11/http.d.ts → node/http.d.ts +305 -77
- node v16.11/http2.d.ts → node/http2.d.ts +38 -5
- node v16.11/https.d.ts → node/https.d.ts +209 -59
- node v16.11/index.d.ts → node/index.d.ts +6 -3
- node v16.11/inspector.d.ts → node/inspector.d.ts +11 -15
- {node v16.11 → node}/module.d.ts +0 -0
- node v16.11/net.d.ts → node/net.d.ts +94 -21
- node v16.11/os.d.ts → node/os.d.ts +15 -4
- node v16.11/package.json → node/package.json +15 -8
- node v16.11/path.d.ts → node/path.d.ts +34 -23
- node v16.11/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -8
- node v16.11/process.d.ts → node/process.d.ts +17 -16
- node v16.11/punycode.d.ts → node/punycode.d.ts +1 -1
- node v16.11/querystring.d.ts → node/querystring.d.ts +4 -4
- node/readline/promises.d.ts +143 -0
- node v16.11/readline.d.ts → node/readline.d.ts +140 -30
- node v16.11/repl.d.ts → node/repl.d.ts +2 -2
- node v16.11/stream/consumers.d.ts → node/stream/consumers.d.ts +2 -14
- {node v16.11 → node}/stream/promises.d.ts +0 -0
- node v16.11/stream/web.d.ts → node/stream/web.d.ts +3 -65
- node v16.11/stream.d.ts → node/stream.d.ts +97 -19
- node v16.11/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
- node/test.d.ts +314 -0
- {node v16.11 → node}/timers/promises.d.ts +0 -0
- node v16.11/timers.d.ts → node/timers.d.ts +1 -1
- node v16.11/tls.d.ts → node/tls.d.ts +32 -23
- node v16.11/trace_events.d.ts → node/trace_events.d.ts +11 -1
- node/ts4.8/assert/strict.d.ts +8 -0
- node/ts4.8/assert.d.ts +911 -0
- node/ts4.8/async_hooks.d.ts +501 -0
- node v16.11/buffer.d.ts → node/ts4.8/buffer.d.ts +46 -19
- node/ts4.8/child_process.d.ts +1369 -0
- node/ts4.8/cluster.d.ts +410 -0
- node/ts4.8/console.d.ts +412 -0
- node/ts4.8/constants.d.ts +18 -0
- node/ts4.8/crypto.d.ts +3964 -0
- node/ts4.8/dgram.d.ts +545 -0
- node/ts4.8/diagnostics_channel.d.ts +153 -0
- node/ts4.8/dns/promises.d.ts +370 -0
- node/ts4.8/dns.d.ts +659 -0
- node/ts4.8/dom-events.d.ts +126 -0
- node/ts4.8/domain.d.ts +170 -0
- node/ts4.8/events.d.ts +678 -0
- node/ts4.8/fs/promises.d.ts +1138 -0
- node/ts4.8/fs.d.ts +3872 -0
- node v16.11/globals.d.ts → node/ts4.8/globals.d.ts +14 -4
- node/ts4.8/globals.global.d.ts +1 -0
- node/ts4.8/http.d.ts +1607 -0
- node/ts4.8/http2.d.ts +2134 -0
- node/ts4.8/https.d.ts +541 -0
- node/ts4.8/index.d.ts +88 -0
- node/ts4.8/inspector.d.ts +2741 -0
- node/ts4.8/module.d.ts +114 -0
- node/ts4.8/net.d.ts +869 -0
- node/ts4.8/os.d.ts +466 -0
- node/ts4.8/path.d.ts +191 -0
- node/ts4.8/perf_hooks.d.ts +625 -0
- node/ts4.8/process.d.ts +1482 -0
- node/ts4.8/punycode.d.ts +117 -0
- node/ts4.8/querystring.d.ts +131 -0
- node/ts4.8/readline/promises.d.ts +143 -0
- node/ts4.8/readline.d.ts +653 -0
- node/ts4.8/repl.d.ts +424 -0
- node/ts4.8/stream/consumers.d.ts +12 -0
- node/ts4.8/stream/promises.d.ts +42 -0
- node/ts4.8/stream/web.d.ts +330 -0
- node/ts4.8/stream.d.ts +1340 -0
- node/ts4.8/string_decoder.d.ts +67 -0
- node/ts4.8/test.d.ts +314 -0
- node/ts4.8/timers/promises.d.ts +68 -0
- node/ts4.8/timers.d.ts +94 -0
- node/ts4.8/tls.d.ts +1028 -0
- node/ts4.8/trace_events.d.ts +171 -0
- node v16.11/tty.d.ts → node/ts4.8/tty.d.ts +4 -2
- node v16.11/url.d.ts → node/ts4.8/url.d.ts +85 -39
- node v16.11/util.d.ts → node/ts4.8/util.d.ts +268 -12
- node v16.11/v8.d.ts → node/ts4.8/v8.d.ts +21 -3
- node v16.11/vm.d.ts → node/ts4.8/vm.d.ts +6 -4
- node v16.11/wasi.d.ts → node/ts4.8/wasi.d.ts +1 -1
- node v16.11/worker_threads.d.ts → node/ts4.8/worker_threads.d.ts +50 -10
- node v16.11/zlib.d.ts → node/ts4.8/zlib.d.ts +1 -1
- node/tty.d.ts +206 -0
- node/url.d.ts +897 -0
- node/util.d.ts +1850 -0
- node/v8.d.ts +396 -0
- node/vm.d.ts +509 -0
- node/wasi.d.ts +158 -0
- node/worker_threads.d.ts +689 -0
- node/zlib.d.ts +517 -0
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* performance.measure('A to B', 'A', 'B');
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
29
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
29
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/perf_hooks.js)
|
|
30
30
|
*/
|
|
31
31
|
declare module 'perf_hooks' {
|
|
32
32
|
import { AsyncResource } from 'node:async_hooks';
|
|
@@ -85,6 +85,14 @@ declare module 'perf_hooks' {
|
|
|
85
85
|
* @since v16.0.0
|
|
86
86
|
*/
|
|
87
87
|
readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
|
|
88
|
+
toJSON(): any;
|
|
89
|
+
}
|
|
90
|
+
class PerformanceMark extends PerformanceEntry {
|
|
91
|
+
readonly duration: 0;
|
|
92
|
+
readonly entryType: 'mark';
|
|
93
|
+
}
|
|
94
|
+
class PerformanceMeasure extends PerformanceEntry {
|
|
95
|
+
readonly entryType: 'measure';
|
|
88
96
|
}
|
|
89
97
|
/**
|
|
90
98
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
@@ -191,14 +199,44 @@ declare module 'perf_hooks' {
|
|
|
191
199
|
* @param name
|
|
192
200
|
*/
|
|
193
201
|
clearMarks(name?: string): void;
|
|
202
|
+
/**
|
|
203
|
+
* If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
|
|
204
|
+
* If name is provided, removes only the named measure.
|
|
205
|
+
* @param name
|
|
206
|
+
* @since v16.7.0
|
|
207
|
+
*/
|
|
208
|
+
clearMeasures(name?: string): void;
|
|
209
|
+
/**
|
|
210
|
+
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
|
|
211
|
+
* If you are only interested in performance entries of certain types or that have certain names, see
|
|
212
|
+
* `performance.getEntriesByType()` and `performance.getEntriesByName()`.
|
|
213
|
+
* @since v16.7.0
|
|
214
|
+
*/
|
|
215
|
+
getEntries(): PerformanceEntry[];
|
|
216
|
+
/**
|
|
217
|
+
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
|
|
218
|
+
* whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
|
|
219
|
+
* @param name
|
|
220
|
+
* @param type
|
|
221
|
+
* @since v16.7.0
|
|
222
|
+
*/
|
|
223
|
+
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
|
|
224
|
+
/**
|
|
225
|
+
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
|
|
226
|
+
* whose `performanceEntry.entryType` is equal to `type`.
|
|
227
|
+
* @param type
|
|
228
|
+
* @since v16.7.0
|
|
229
|
+
*/
|
|
230
|
+
getEntriesByType(type: EntryType): PerformanceEntry[];
|
|
194
231
|
/**
|
|
195
232
|
* Creates a new PerformanceMark entry in the Performance Timeline.
|
|
196
233
|
* A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark',
|
|
197
234
|
* and whose performanceEntry.duration is always 0.
|
|
198
235
|
* Performance marks are used to mark specific significant moments in the Performance Timeline.
|
|
199
236
|
* @param name
|
|
237
|
+
* @return The PerformanceMark entry that was created
|
|
200
238
|
*/
|
|
201
|
-
mark(name?: string, options?: MarkOptions):
|
|
239
|
+
mark(name?: string, options?: MarkOptions): PerformanceMark;
|
|
202
240
|
/**
|
|
203
241
|
* Creates a new PerformanceMeasure entry in the Performance Timeline.
|
|
204
242
|
* A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
|
|
@@ -213,9 +251,10 @@ declare module 'perf_hooks' {
|
|
|
213
251
|
* @param name
|
|
214
252
|
* @param startMark
|
|
215
253
|
* @param endMark
|
|
254
|
+
* @return The PerformanceMeasure entry that was created
|
|
216
255
|
*/
|
|
217
|
-
measure(name: string, startMark?: string, endMark?: string):
|
|
218
|
-
measure(name: string, options: MeasureOptions):
|
|
256
|
+
measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
|
|
257
|
+
measure(name: string, options: MeasureOptions): PerformanceMeasure;
|
|
219
258
|
/**
|
|
220
259
|
* An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
|
|
221
260
|
*/
|
|
@@ -270,6 +309,9 @@ declare module 'perf_hooks' {
|
|
|
270
309
|
* * }
|
|
271
310
|
* * ]
|
|
272
311
|
*
|
|
312
|
+
*
|
|
313
|
+
* performance.clearMarks();
|
|
314
|
+
* performance.clearMeasures();
|
|
273
315
|
* observer.disconnect();
|
|
274
316
|
* });
|
|
275
317
|
* obs.observe({ type: 'mark' });
|
|
@@ -317,6 +359,9 @@ declare module 'perf_hooks' {
|
|
|
317
359
|
* * ]
|
|
318
360
|
*
|
|
319
361
|
* console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
|
|
362
|
+
*
|
|
363
|
+
* performance.clearMarks();
|
|
364
|
+
* performance.clearMeasures();
|
|
320
365
|
* observer.disconnect();
|
|
321
366
|
* });
|
|
322
367
|
* obs.observe({ entryTypes: ['mark', 'measure'] });
|
|
@@ -355,6 +400,8 @@ declare module 'perf_hooks' {
|
|
|
355
400
|
* * }
|
|
356
401
|
* * ]
|
|
357
402
|
*
|
|
403
|
+
* performance.clearMarks();
|
|
404
|
+
* performance.clearMeasures();
|
|
358
405
|
* observer.disconnect();
|
|
359
406
|
* });
|
|
360
407
|
* obs.observe({ type: 'mark' });
|
|
@@ -384,7 +431,7 @@ declare module 'perf_hooks' {
|
|
|
384
431
|
* } = require('perf_hooks');
|
|
385
432
|
*
|
|
386
433
|
* const obs = new PerformanceObserver((list, observer) => {
|
|
387
|
-
* // Called
|
|
434
|
+
* // Called once asynchronously. `list` contains three items.
|
|
388
435
|
* });
|
|
389
436
|
* obs.observe({ type: 'mark' });
|
|
390
437
|
*
|
|
@@ -487,7 +534,7 @@ declare module 'perf_hooks' {
|
|
|
487
534
|
}
|
|
488
535
|
interface RecordableHistogram extends Histogram {
|
|
489
536
|
/**
|
|
490
|
-
* @since v15.9.0
|
|
537
|
+
* @since v15.9.0, v14.18.0
|
|
491
538
|
* @param val The amount to record in the histogram.
|
|
492
539
|
*/
|
|
493
540
|
record(val: number | bigint): void;
|
|
@@ -496,9 +543,15 @@ declare module 'perf_hooks' {
|
|
|
496
543
|
* previous call to `recordDelta()` and records that amount in the histogram.
|
|
497
544
|
*
|
|
498
545
|
* ## Examples
|
|
499
|
-
* @since v15.9.0
|
|
546
|
+
* @since v15.9.0, v14.18.0
|
|
500
547
|
*/
|
|
501
548
|
recordDelta(): void;
|
|
549
|
+
/**
|
|
550
|
+
* Adds the values from other to this histogram.
|
|
551
|
+
* @since v17.4.0, v16.14.0
|
|
552
|
+
* @param other Recordable Histogram to combine with
|
|
553
|
+
*/
|
|
554
|
+
add(other: RecordableHistogram): void;
|
|
502
555
|
}
|
|
503
556
|
/**
|
|
504
557
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
@@ -548,9 +601,24 @@ declare module 'perf_hooks' {
|
|
|
548
601
|
}
|
|
549
602
|
/**
|
|
550
603
|
* Returns a `RecordableHistogram`.
|
|
551
|
-
* @since v15.9.0
|
|
604
|
+
* @since v15.9.0, v14.18.0
|
|
552
605
|
*/
|
|
553
606
|
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
|
607
|
+
|
|
608
|
+
import { performance as _performance } from 'perf_hooks';
|
|
609
|
+
global {
|
|
610
|
+
/**
|
|
611
|
+
* `performance` is a global reference for `require('perf_hooks').performance`
|
|
612
|
+
* https://nodejs.org/api/globals.html#performance
|
|
613
|
+
* @since v16.0.0
|
|
614
|
+
*/
|
|
615
|
+
var performance: typeof globalThis extends {
|
|
616
|
+
onmessage: any;
|
|
617
|
+
performance: infer T;
|
|
618
|
+
}
|
|
619
|
+
? T
|
|
620
|
+
: typeof _performance;
|
|
621
|
+
}
|
|
554
622
|
}
|
|
555
623
|
declare module 'node:perf_hooks' {
|
|
556
624
|
export * from 'perf_hooks';
|
|
@@ -49,6 +49,7 @@ declare module 'process' {
|
|
|
49
49
|
openssl: string;
|
|
50
50
|
}
|
|
51
51
|
type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
|
|
52
|
+
type Architecture = 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x64';
|
|
52
53
|
type Signals =
|
|
53
54
|
| 'SIGABRT'
|
|
54
55
|
| 'SIGALRM'
|
|
@@ -96,7 +97,7 @@ declare module 'process' {
|
|
|
96
97
|
type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
|
|
97
98
|
/**
|
|
98
99
|
* Most of the time the unhandledRejection will be an Error, but this should not be relied upon
|
|
99
|
-
* as *anything* can be thrown/rejected, it is therefore unsafe to assume
|
|
100
|
+
* as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.
|
|
100
101
|
*/
|
|
101
102
|
type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
|
|
102
103
|
type WarningListener = (warning: Error) => void;
|
|
@@ -589,7 +590,7 @@ declare module 'process' {
|
|
|
589
590
|
*
|
|
590
591
|
* The reason this is problematic is because writes to `process.stdout` in Node.js
|
|
591
592
|
* are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
|
|
592
|
-
* event loop. Calling `process.exit()`, however, forces the process to
|
|
593
|
+
* event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.
|
|
593
594
|
*
|
|
594
595
|
* Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding
|
|
595
596
|
* scheduling any additional work for the event loop:
|
|
@@ -641,7 +642,7 @@ declare module 'process' {
|
|
|
641
642
|
* Android).
|
|
642
643
|
* @since v0.1.31
|
|
643
644
|
*/
|
|
644
|
-
getgid()
|
|
645
|
+
getgid?: () => number;
|
|
645
646
|
/**
|
|
646
647
|
* The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
|
|
647
648
|
* numeric ID or a group name
|
|
@@ -668,7 +669,7 @@ declare module 'process' {
|
|
|
668
669
|
* @since v0.1.31
|
|
669
670
|
* @param id The group name or ID
|
|
670
671
|
*/
|
|
671
|
-
setgid(id: number | string)
|
|
672
|
+
setgid?: (id: number | string) => void;
|
|
672
673
|
/**
|
|
673
674
|
* The `process.getuid()` method returns the numeric user identity of the process.
|
|
674
675
|
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
|
@@ -685,7 +686,7 @@ declare module 'process' {
|
|
|
685
686
|
* Android).
|
|
686
687
|
* @since v0.1.28
|
|
687
688
|
*/
|
|
688
|
-
getuid()
|
|
689
|
+
getuid?: () => number;
|
|
689
690
|
/**
|
|
690
691
|
* The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
|
|
691
692
|
* numeric ID or a username string.
|
|
@@ -711,7 +712,7 @@ declare module 'process' {
|
|
|
711
712
|
* This feature is not available in `Worker` threads.
|
|
712
713
|
* @since v0.1.28
|
|
713
714
|
*/
|
|
714
|
-
setuid(id: number | string)
|
|
715
|
+
setuid?: (id: number | string) => void;
|
|
715
716
|
/**
|
|
716
717
|
* The `process.geteuid()` method returns the numerical effective user identity of
|
|
717
718
|
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
|
@@ -728,7 +729,7 @@ declare module 'process' {
|
|
|
728
729
|
* Android).
|
|
729
730
|
* @since v2.0.0
|
|
730
731
|
*/
|
|
731
|
-
geteuid()
|
|
732
|
+
geteuid?: () => number;
|
|
732
733
|
/**
|
|
733
734
|
* The `process.seteuid()` method sets the effective user identity of the process.
|
|
734
735
|
* (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
|
|
@@ -755,7 +756,7 @@ declare module 'process' {
|
|
|
755
756
|
* @since v2.0.0
|
|
756
757
|
* @param id A user name or ID
|
|
757
758
|
*/
|
|
758
|
-
seteuid(id: number | string)
|
|
759
|
+
seteuid?: (id: number | string) => void;
|
|
759
760
|
/**
|
|
760
761
|
* The `process.getegid()` method returns the numerical effective group identity
|
|
761
762
|
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
|
@@ -772,7 +773,7 @@ declare module 'process' {
|
|
|
772
773
|
* Android).
|
|
773
774
|
* @since v2.0.0
|
|
774
775
|
*/
|
|
775
|
-
getegid()
|
|
776
|
+
getegid?: () => number;
|
|
776
777
|
/**
|
|
777
778
|
* The `process.setegid()` method sets the effective group identity of the process.
|
|
778
779
|
* (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
|
|
@@ -799,7 +800,7 @@ declare module 'process' {
|
|
|
799
800
|
* @since v2.0.0
|
|
800
801
|
* @param id A group name or ID
|
|
801
802
|
*/
|
|
802
|
-
setegid(id: number | string)
|
|
803
|
+
setegid?: (id: number | string) => void;
|
|
803
804
|
/**
|
|
804
805
|
* The `process.getgroups()` method returns an array with the supplementary group
|
|
805
806
|
* IDs. POSIX leaves it unspecified if the effective group ID is included but
|
|
@@ -817,7 +818,7 @@ declare module 'process' {
|
|
|
817
818
|
* Android).
|
|
818
819
|
* @since v0.9.4
|
|
819
820
|
*/
|
|
820
|
-
getgroups()
|
|
821
|
+
getgroups?: () => number[];
|
|
821
822
|
/**
|
|
822
823
|
* The `process.setgroups()` method sets the supplementary group IDs for the
|
|
823
824
|
* Node.js process. This is a privileged operation that requires the Node.js
|
|
@@ -843,7 +844,7 @@ declare module 'process' {
|
|
|
843
844
|
* This feature is not available in `Worker` threads.
|
|
844
845
|
* @since v0.9.4
|
|
845
846
|
*/
|
|
846
|
-
setgroups(groups: ReadonlyArray<string | number>)
|
|
847
|
+
setgroups?: (groups: ReadonlyArray<string | number>) => void;
|
|
847
848
|
/**
|
|
848
849
|
* The `process.setUncaughtExceptionCaptureCallback()` function sets a function
|
|
849
850
|
* that will be invoked when an uncaught exception occurs, which will receive the
|
|
@@ -1040,7 +1041,7 @@ declare module 'process' {
|
|
|
1040
1041
|
title: string;
|
|
1041
1042
|
/**
|
|
1042
1043
|
* The operating system CPU architecture for which the Node.js binary was compiled.
|
|
1043
|
-
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`,
|
|
1044
|
+
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
|
|
1044
1045
|
*
|
|
1045
1046
|
* ```js
|
|
1046
1047
|
* import { arch } from 'process';
|
|
@@ -1049,10 +1050,10 @@ declare module 'process' {
|
|
|
1049
1050
|
* ```
|
|
1050
1051
|
* @since v0.5.0
|
|
1051
1052
|
*/
|
|
1052
|
-
readonly arch:
|
|
1053
|
+
readonly arch: Architecture;
|
|
1053
1054
|
/**
|
|
1054
1055
|
* The `process.platform` property returns a string identifying the operating
|
|
1055
|
-
* system platform
|
|
1056
|
+
* system platform for which the Node.js binary was compiled.
|
|
1056
1057
|
*
|
|
1057
1058
|
* Currently possible values are:
|
|
1058
1059
|
*
|
|
@@ -1405,7 +1406,7 @@ declare module 'process' {
|
|
|
1405
1406
|
emit(event: 'unhandledRejection', reason: unknown, promise: Promise<unknown>): boolean;
|
|
1406
1407
|
emit(event: 'warning', warning: Error): boolean;
|
|
1407
1408
|
emit(event: 'message', message: unknown, sendHandle: unknown): this;
|
|
1408
|
-
emit(event: Signals, signal
|
|
1409
|
+
emit(event: Signals, signal?: Signals): boolean;
|
|
1409
1410
|
emit(event: 'multipleResolves', type: MultipleResolveType, promise: Promise<unknown>, value: unknown): this;
|
|
1410
1411
|
emit(event: 'worker', listener: WorkerListener): this;
|
|
1411
1412
|
on(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* made available to developers as a convenience. Fixes or other modifications to
|
|
25
25
|
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
|
|
26
26
|
* @deprecated Since v7.0.0 - Deprecated
|
|
27
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
27
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/punycode.js)
|
|
28
28
|
*/
|
|
29
29
|
declare module 'punycode' {
|
|
30
30
|
/**
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* const querystring = require('querystring');
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* `querystring` is more performant than `URLSearchParams` but is not a
|
|
10
|
+
* standardized API. Use `URLSearchParams` when performance is not critical
|
|
11
|
+
* or when compatibility with browser code is desirable.
|
|
12
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/querystring.js)
|
|
13
13
|
*/
|
|
14
14
|
declare module 'querystring' {
|
|
15
15
|
interface StringifyOptions {
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `readline/promise` module provides an API for reading lines of input from a Readable stream one line at a time.
|
|
3
|
+
*
|
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline/promises.js)
|
|
5
|
+
* @since v17.0.0
|
|
6
|
+
*/
|
|
7
|
+
declare module 'readline/promises' {
|
|
8
|
+
import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';
|
|
9
|
+
import { Abortable } from 'node:events';
|
|
10
|
+
|
|
11
|
+
class Interface extends _Interface {
|
|
12
|
+
/**
|
|
13
|
+
* The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input,
|
|
14
|
+
* then invokes the callback function passing the provided input as the first argument.
|
|
15
|
+
*
|
|
16
|
+
* When called, rl.question() will resume the input stream if it has been paused.
|
|
17
|
+
*
|
|
18
|
+
* If the readlinePromises.Interface was created with output set to null or undefined the query is not written.
|
|
19
|
+
*
|
|
20
|
+
* If the question is called after rl.close(), it returns a rejected promise.
|
|
21
|
+
*
|
|
22
|
+
* Example usage:
|
|
23
|
+
*
|
|
24
|
+
* ```js
|
|
25
|
+
* const answer = await rl.question('What is your favorite food? ');
|
|
26
|
+
* console.log(`Oh, so your favorite food is ${answer}`);
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Using an AbortSignal to cancel a question.
|
|
30
|
+
*
|
|
31
|
+
* ```js
|
|
32
|
+
* const signal = AbortSignal.timeout(10_000);
|
|
33
|
+
*
|
|
34
|
+
* signal.addEventListener('abort', () => {
|
|
35
|
+
* console.log('The food question timed out');
|
|
36
|
+
* }, { once: true });
|
|
37
|
+
*
|
|
38
|
+
* const answer = await rl.question('What is your favorite food? ', { signal });
|
|
39
|
+
* console.log(`Oh, so your favorite food is ${answer}`);
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @since v17.0.0
|
|
43
|
+
* @param query A statement or query to write to output, prepended to the prompt.
|
|
44
|
+
*/
|
|
45
|
+
question(query: string): Promise<string>;
|
|
46
|
+
question(query: string, options: Abortable): Promise<string>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class Readline {
|
|
50
|
+
/**
|
|
51
|
+
* @param stream A TTY stream.
|
|
52
|
+
*/
|
|
53
|
+
constructor(stream: NodeJS.WritableStream, options?: { autoCommit?: boolean });
|
|
54
|
+
/**
|
|
55
|
+
* 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
|
+
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
|
|
57
|
+
*/
|
|
58
|
+
clearLine(dir: Direction): this;
|
|
59
|
+
/**
|
|
60
|
+
* The `rl.clearScreenDown()` method adds to the internal list of pending action an action that clears the associated `stream` from the current position of the cursor down.
|
|
61
|
+
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
|
|
62
|
+
*/
|
|
63
|
+
clearScreenDown(): this;
|
|
64
|
+
/**
|
|
65
|
+
* The `rl.commit()` method sends all the pending actions to the associated `stream` and clears the internal list of pending actions.
|
|
66
|
+
*/
|
|
67
|
+
commit(): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* The `rl.cursorTo()` method adds to the internal list of pending action an action that moves cursor to the specified position in the associated `stream`.
|
|
70
|
+
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
|
|
71
|
+
*/
|
|
72
|
+
cursorTo(x: number, y?: number): this;
|
|
73
|
+
/**
|
|
74
|
+
* The `rl.moveCursor()` method adds to the internal list of pending action an action that moves the cursor relative to its current position in the associated `stream`.
|
|
75
|
+
* Call `rl.commit()` to see the effect of this method, unless autoCommit: true was passed to the constructor.
|
|
76
|
+
*/
|
|
77
|
+
moveCursor(dx: number, dy: number): this;
|
|
78
|
+
/**
|
|
79
|
+
* The `rl.rollback()` method clears the internal list of pending actions without sending it to the associated `stream`.
|
|
80
|
+
*/
|
|
81
|
+
rollback(): this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
|
|
86
|
+
*
|
|
87
|
+
* ```js
|
|
88
|
+
* const readlinePromises = require('node:readline/promises');
|
|
89
|
+
* const rl = readlinePromises.createInterface({
|
|
90
|
+
* input: process.stdin,
|
|
91
|
+
* output: process.stdout
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* Once the `readlinePromises.Interface` instance is created, the most common case is to listen for the `'line'` event:
|
|
96
|
+
*
|
|
97
|
+
* ```js
|
|
98
|
+
* rl.on('line', (line) => {
|
|
99
|
+
* console.log(`Received: ${line}`);
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* If `terminal` is `true` for this instance then the `output` stream will get the best compatibility if it defines an `output.columns` property,
|
|
104
|
+
* and emits a `'resize'` event on the `output`, if or when the columns ever change (`process.stdout` does this automatically when it is a TTY).
|
|
105
|
+
*
|
|
106
|
+
* ## Use of the `completer` function
|
|
107
|
+
*
|
|
108
|
+
* The `completer` function takes the current line entered by the user as an argument, and returns an `Array` with 2 entries:
|
|
109
|
+
*
|
|
110
|
+
* - An Array with matching entries for the completion.
|
|
111
|
+
* - The substring that was used for the matching.
|
|
112
|
+
*
|
|
113
|
+
* For instance: `[[substr1, substr2, ...], originalsubstring]`.
|
|
114
|
+
*
|
|
115
|
+
* ```js
|
|
116
|
+
* function completer(line) {
|
|
117
|
+
* const completions = '.help .error .exit .quit .q'.split(' ');
|
|
118
|
+
* const hits = completions.filter((c) => c.startsWith(line));
|
|
119
|
+
* // Show all completions if none found
|
|
120
|
+
* return [hits.length ? hits : completions, line];
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* The `completer` function can also returns a `Promise`, or be asynchronous:
|
|
125
|
+
*
|
|
126
|
+
* ```js
|
|
127
|
+
* async function completer(linePartial) {
|
|
128
|
+
* await someAsyncWork();
|
|
129
|
+
* return [['123'], linePartial];
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
function createInterface(
|
|
134
|
+
input: NodeJS.ReadableStream,
|
|
135
|
+
output?: NodeJS.WritableStream,
|
|
136
|
+
completer?: Completer | AsyncCompleter,
|
|
137
|
+
terminal?: boolean,
|
|
138
|
+
): Interface;
|
|
139
|
+
function createInterface(options: ReadLineOptions): Interface;
|
|
140
|
+
}
|
|
141
|
+
declare module 'node:readline/promises' {
|
|
142
|
+
export * from 'readline/promises';
|
|
143
|
+
}
|