m06_task3.js 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.idea/.name +1 -0
- package/.idea/inspectionProfiles/Project_Default.xml +10 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/node_lab_6.iml +12 -0
- package/06_task2.html +73 -0
- package/06_task2.js +52 -0
- package/06_task3.js +3 -0
- package/06_task4.js +3 -0
- package/m06_task3.js +28 -0
- package/package/index.js +28 -0
- package/package/node_modules/.package-lock.json +31 -0
- package/package/node_modules/@types/node/LICENSE +21 -0
- package/package/node_modules/@types/node/README.md +16 -0
- package/package/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/package/node_modules/@types/node/assert.d.ts +961 -0
- package/package/node_modules/@types/node/async_hooks.d.ts +501 -0
- package/package/node_modules/@types/node/buffer.d.ts +2258 -0
- package/package/node_modules/@types/node/child_process.d.ts +1369 -0
- package/package/node_modules/@types/node/cluster.d.ts +410 -0
- package/package/node_modules/@types/node/console.d.ts +412 -0
- package/package/node_modules/@types/node/constants.d.ts +18 -0
- package/package/node_modules/@types/node/crypto.d.ts +3964 -0
- package/package/node_modules/@types/node/dgram.d.ts +545 -0
- package/package/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
- package/package/node_modules/@types/node/dns/promises.d.ts +370 -0
- package/package/node_modules/@types/node/dns.d.ts +659 -0
- package/package/node_modules/@types/node/dom-events.d.ts +126 -0
- package/package/node_modules/@types/node/domain.d.ts +170 -0
- package/package/node_modules/@types/node/events.d.ts +678 -0
- package/package/node_modules/@types/node/fs/promises.d.ts +1138 -0
- package/package/node_modules/@types/node/fs.d.ts +3872 -0
- package/package/node_modules/@types/node/globals.d.ts +300 -0
- package/package/node_modules/@types/node/globals.global.d.ts +1 -0
- package/package/node_modules/@types/node/http.d.ts +1614 -0
- package/package/node_modules/@types/node/http2.d.ts +2134 -0
- package/package/node_modules/@types/node/https.d.ts +541 -0
- package/package/node_modules/@types/node/index.d.ts +133 -0
- package/package/node_modules/@types/node/inspector.d.ts +2741 -0
- package/package/node_modules/@types/node/module.d.ts +114 -0
- package/package/node_modules/@types/node/net.d.ts +869 -0
- package/package/node_modules/@types/node/os.d.ts +466 -0
- package/package/node_modules/@types/node/package.json +232 -0
- package/package/node_modules/@types/node/path.d.ts +191 -0
- package/package/node_modules/@types/node/perf_hooks.d.ts +625 -0
- package/package/node_modules/@types/node/process.d.ts +1482 -0
- package/package/node_modules/@types/node/punycode.d.ts +117 -0
- package/package/node_modules/@types/node/querystring.d.ts +131 -0
- package/package/node_modules/@types/node/readline/promises.d.ts +143 -0
- package/package/node_modules/@types/node/readline.d.ts +653 -0
- package/package/node_modules/@types/node/repl.d.ts +424 -0
- package/package/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/package/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/package/node_modules/@types/node/stream/web.d.ts +330 -0
- package/package/node_modules/@types/node/stream.d.ts +1340 -0
- package/package/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/package/node_modules/@types/node/test.d.ts +314 -0
- package/package/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/package/node_modules/@types/node/timers.d.ts +94 -0
- package/package/node_modules/@types/node/tls.d.ts +1028 -0
- package/package/node_modules/@types/node/trace_events.d.ts +171 -0
- package/package/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/package/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
- package/package/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
- package/package/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
- package/package/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
- package/package/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
- package/package/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/package/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/package/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
- package/package/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
- package/package/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
- package/package/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
- package/package/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/package/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/package/node_modules/@types/node/ts4.8/events.d.ts +678 -0
- package/package/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
- package/package/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
- package/package/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
- package/package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/package/node_modules/@types/node/ts4.8/http.d.ts +1614 -0
- package/package/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
- package/package/node_modules/@types/node/ts4.8/https.d.ts +541 -0
- package/package/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/package/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
- package/package/node_modules/@types/node/ts4.8/module.d.ts +114 -0
- package/package/node_modules/@types/node/ts4.8/net.d.ts +869 -0
- package/package/node_modules/@types/node/ts4.8/os.d.ts +466 -0
- package/package/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
- package/package/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
- package/package/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/package/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/package/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
- package/package/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
- package/package/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/package/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/package/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/package/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
- package/package/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/package/node_modules/@types/node/ts4.8/test.d.ts +314 -0
- package/package/node_modules/@types/node/ts4.8/timers/promises.d.ts +68 -0
- package/package/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
- package/package/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
- package/package/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
- package/package/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
- package/package/node_modules/@types/node/ts4.8/url.d.ts +897 -0
- package/package/node_modules/@types/node/ts4.8/util.d.ts +1850 -0
- package/package/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
- package/package/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
- package/package/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/package/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
- package/package/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/package/node_modules/@types/node/tty.d.ts +206 -0
- package/package/node_modules/@types/node/url.d.ts +897 -0
- package/package/node_modules/@types/node/util.d.ts +1850 -0
- package/package/node_modules/@types/node/v8.d.ts +396 -0
- package/package/node_modules/@types/node/vm.d.ts +509 -0
- package/package/node_modules/@types/node/wasi.d.ts +158 -0
- package/package/node_modules/@types/node/worker_threads.d.ts +689 -0
- package/package/node_modules/@types/node/zlib.d.ts +517 -0
- package/package/node_modules/@types/nodemailer/LICENSE +21 -0
- package/package/node_modules/@types/nodemailer/README.md +16 -0
- package/package/node_modules/@types/nodemailer/index.d.ts +83 -0
- package/package/node_modules/@types/nodemailer/lib/addressparser/index.d.ts +31 -0
- package/package/node_modules/@types/nodemailer/lib/base64/index.d.ts +22 -0
- package/package/node_modules/@types/nodemailer/lib/dkim/index.d.ts +45 -0
- package/package/node_modules/@types/nodemailer/lib/dkim/message-parser.d.ts +75 -0
- package/package/node_modules/@types/nodemailer/lib/dkim/relaxed-body.d.ts +75 -0
- package/package/node_modules/@types/nodemailer/lib/dkim/sign.d.ts +11 -0
- package/package/node_modules/@types/nodemailer/lib/fetch/cookies.d.ts +54 -0
- package/package/node_modules/@types/nodemailer/lib/fetch/index.d.ts +38 -0
- package/package/node_modules/@types/nodemailer/lib/json-transport/index.d.ts +50 -0
- package/package/node_modules/@types/nodemailer/lib/mail-composer/index.d.ts +25 -0
- package/package/node_modules/@types/nodemailer/lib/mailer/index.d.ts +230 -0
- package/package/node_modules/@types/nodemailer/lib/mailer/mail-message.d.ts +28 -0
- package/package/node_modules/@types/nodemailer/lib/mime-funcs/index.d.ts +87 -0
- package/package/node_modules/@types/nodemailer/lib/mime-funcs/mime-types.d.ts +2 -0
- package/package/node_modules/@types/nodemailer/lib/mime-node/index.d.ts +137 -0
- package/package/node_modules/@types/nodemailer/lib/mime-node/last-newline.d.ts +9 -0
- package/package/node_modules/@types/nodemailer/lib/qp/index.d.ts +23 -0
- package/package/node_modules/@types/nodemailer/lib/sendmail-transport/index.d.ts +53 -0
- package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-unix.d.ts +7 -0
- package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-windows.d.ts +7 -0
- package/package/node_modules/@types/nodemailer/lib/ses-transport/index.d.ts +136 -0
- package/package/node_modules/@types/nodemailer/lib/shared/index.d.ts +51 -0
- package/package/node_modules/@types/nodemailer/lib/smtp-connection/data-stream.d.ts +11 -0
- package/package/node_modules/@types/nodemailer/lib/smtp-connection/http-proxy-client.d.ts +11 -0
- package/package/node_modules/@types/nodemailer/lib/smtp-connection/index.d.ts +254 -0
- package/package/node_modules/@types/nodemailer/lib/smtp-pool/index.d.ts +90 -0
- package/package/node_modules/@types/nodemailer/lib/smtp-pool/pool-resource.d.ts +66 -0
- package/package/node_modules/@types/nodemailer/lib/smtp-transport/index.d.ts +115 -0
- package/package/node_modules/@types/nodemailer/lib/stream-transport/index.d.ts +56 -0
- package/package/node_modules/@types/nodemailer/lib/well-known/index.d.ts +6 -0
- package/package/node_modules/@types/nodemailer/lib/xoauth2/index.d.ts +110 -0
- package/package/node_modules/@types/nodemailer/package.json +37 -0
- package/package/node_modules/nodemailer/.gitattributes +6 -0
- package/package/node_modules/nodemailer/.prettierrc.js +8 -0
- package/package/node_modules/nodemailer/CHANGELOG.md +715 -0
- package/package/node_modules/nodemailer/CODE_OF_CONDUCT.md +76 -0
- package/package/node_modules/nodemailer/CONTRIBUTING.md +67 -0
- package/package/node_modules/nodemailer/LICENSE +16 -0
- package/package/node_modules/nodemailer/README.md +93 -0
- package/package/node_modules/nodemailer/SECURITY.txt +22 -0
- package/package/node_modules/nodemailer/lib/addressparser/index.js +313 -0
- package/package/node_modules/nodemailer/lib/base64/index.js +142 -0
- package/package/node_modules/nodemailer/lib/dkim/index.js +251 -0
- package/package/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
- package/package/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
- package/package/node_modules/nodemailer/lib/dkim/sign.js +117 -0
- package/package/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
- package/package/node_modules/nodemailer/lib/fetch/index.js +269 -0
- package/package/node_modules/nodemailer/lib/json-transport/index.js +82 -0
- package/package/node_modules/nodemailer/lib/mail-composer/index.js +558 -0
- package/package/node_modules/nodemailer/lib/mailer/index.js +427 -0
- package/package/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
- package/package/node_modules/nodemailer/lib/mime-funcs/index.js +619 -0
- package/package/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
- package/package/node_modules/nodemailer/lib/mime-node/index.js +1290 -0
- package/package/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
- package/package/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
- package/package/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
- package/package/node_modules/nodemailer/lib/nodemailer.js +143 -0
- package/package/node_modules/nodemailer/lib/qp/index.js +219 -0
- package/package/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
- package/package/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
- package/package/node_modules/nodemailer/lib/shared/index.js +639 -0
- package/package/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
- package/package/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
- package/package/node_modules/nodemailer/lib/smtp-connection/index.js +1786 -0
- package/package/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
- package/package/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
- package/package/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
- package/package/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
- package/package/node_modules/nodemailer/lib/well-known/index.js +47 -0
- package/package/node_modules/nodemailer/lib/well-known/services.json +286 -0
- package/package/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
- package/package/node_modules/nodemailer/package.json +46 -0
- package/package/node_modules/nodemailer/postinstall.js +101 -0
- package/package/package-lock.json +60 -0
- package/package/package.json +6 -0
- package/package.json +19 -0
@@ -0,0 +1,171 @@
|
|
1
|
+
/**
|
2
|
+
* The `trace_events` module provides a mechanism to centralize tracing information
|
3
|
+
* generated by V8, Node.js core, and userspace code.
|
4
|
+
*
|
5
|
+
* Tracing can be enabled with the `--trace-event-categories` command-line flag
|
6
|
+
* or by using the `trace_events` module. The `--trace-event-categories` flag
|
7
|
+
* accepts a list of comma-separated category names.
|
8
|
+
*
|
9
|
+
* The available categories are:
|
10
|
+
*
|
11
|
+
* * `node`: An empty placeholder.
|
12
|
+
* * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data.
|
13
|
+
* The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
|
14
|
+
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
|
15
|
+
* * `node.console`: Enables capture of `console.time()` and `console.count()`output.
|
16
|
+
* * `node.dns.native`: Enables capture of trace data for DNS queries.
|
17
|
+
* * `node.environment`: Enables capture of Node.js Environment milestones.
|
18
|
+
* * `node.fs.sync`: Enables capture of trace data for file system sync methods.
|
19
|
+
* * `node.perf`: Enables capture of `Performance API` measurements.
|
20
|
+
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
|
21
|
+
* measures and marks.
|
22
|
+
* * `node.perf.timerify`: Enables capture of only Performance API timerify
|
23
|
+
* measurements.
|
24
|
+
* * `node.promises.rejections`: Enables capture of trace data tracking the number
|
25
|
+
* of unhandled Promise rejections and handled-after-rejections.
|
26
|
+
* * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
|
27
|
+
* * `v8`: The `V8` events are GC, compiling, and execution related.
|
28
|
+
*
|
29
|
+
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
|
30
|
+
*
|
31
|
+
* ```bash
|
32
|
+
* node --trace-event-categories v8,node,node.async_hooks server.js
|
33
|
+
* ```
|
34
|
+
*
|
35
|
+
* Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be
|
36
|
+
* used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default.
|
37
|
+
*
|
38
|
+
* ```bash
|
39
|
+
* node --trace-events-enabled
|
40
|
+
*
|
41
|
+
* # is equivalent to
|
42
|
+
*
|
43
|
+
* node --trace-event-categories v8,node,node.async_hooks
|
44
|
+
* ```
|
45
|
+
*
|
46
|
+
* Alternatively, trace events may be enabled using the `trace_events` module:
|
47
|
+
*
|
48
|
+
* ```js
|
49
|
+
* const trace_events = require('trace_events');
|
50
|
+
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
51
|
+
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
52
|
+
*
|
53
|
+
* // do work
|
54
|
+
*
|
55
|
+
* tracing.disable(); // Disable trace event capture for the 'node.perf' category
|
56
|
+
* ```
|
57
|
+
*
|
58
|
+
* Running Node.js with tracing enabled will produce log files that can be opened
|
59
|
+
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
|
60
|
+
*
|
61
|
+
* The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can
|
62
|
+
* be specified with `--trace-event-file-pattern` that accepts a template
|
63
|
+
* string that supports `${rotation}` and `${pid}`:
|
64
|
+
*
|
65
|
+
* ```bash
|
66
|
+
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
|
67
|
+
* ```
|
68
|
+
*
|
69
|
+
* To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
|
70
|
+
* in your code, such as:
|
71
|
+
*
|
72
|
+
* ```js
|
73
|
+
* process.on('SIGINT', function onSigint() {
|
74
|
+
* console.info('Received SIGINT.');
|
75
|
+
* process.exit(130); // Or applicable exit code depending on OS and signal
|
76
|
+
* });
|
77
|
+
* ```
|
78
|
+
*
|
79
|
+
* The tracing system uses the same time source
|
80
|
+
* as the one used by `process.hrtime()`.
|
81
|
+
* However the trace-event timestamps are expressed in microseconds,
|
82
|
+
* unlike `process.hrtime()` which returns nanoseconds.
|
83
|
+
*
|
84
|
+
* The features from this module are not available in `Worker` threads.
|
85
|
+
* @experimental
|
86
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/trace_events.js)
|
87
|
+
*/
|
88
|
+
declare module 'trace_events' {
|
89
|
+
/**
|
90
|
+
* The `Tracing` object is used to enable or disable tracing for sets of
|
91
|
+
* categories. Instances are created using the
|
92
|
+
* `trace_events.createTracing()` method.
|
93
|
+
*
|
94
|
+
* When created, the `Tracing` object is disabled. Calling the
|
95
|
+
* `tracing.enable()` method adds the categories to the set of enabled trace
|
96
|
+
* event categories. Calling `tracing.disable()` will remove the categories
|
97
|
+
* from the set of enabled trace event categories.
|
98
|
+
*/
|
99
|
+
interface Tracing {
|
100
|
+
/**
|
101
|
+
* A comma-separated list of the trace event categories covered by this
|
102
|
+
* `Tracing` object.
|
103
|
+
*/
|
104
|
+
readonly categories: string;
|
105
|
+
/**
|
106
|
+
* Disables this `Tracing` object.
|
107
|
+
*
|
108
|
+
* Only trace event categories _not_ covered by other enabled `Tracing`
|
109
|
+
* objects and _not_ specified by the `--trace-event-categories` flag
|
110
|
+
* will be disabled.
|
111
|
+
*/
|
112
|
+
disable(): void;
|
113
|
+
/**
|
114
|
+
* Enables this `Tracing` object for the set of categories covered by
|
115
|
+
* the `Tracing` object.
|
116
|
+
*/
|
117
|
+
enable(): void;
|
118
|
+
/**
|
119
|
+
* `true` only if the `Tracing` object has been enabled.
|
120
|
+
*/
|
121
|
+
readonly enabled: boolean;
|
122
|
+
}
|
123
|
+
interface CreateTracingOptions {
|
124
|
+
/**
|
125
|
+
* An array of trace category names. Values included in the array are
|
126
|
+
* coerced to a string when possible. An error will be thrown if the
|
127
|
+
* value cannot be coerced.
|
128
|
+
*/
|
129
|
+
categories: string[];
|
130
|
+
}
|
131
|
+
/**
|
132
|
+
* Creates and returns a `Tracing` object for the given set of `categories`.
|
133
|
+
*
|
134
|
+
* ```js
|
135
|
+
* const trace_events = require('trace_events');
|
136
|
+
* const categories = ['node.perf', 'node.async_hooks'];
|
137
|
+
* const tracing = trace_events.createTracing({ categories });
|
138
|
+
* tracing.enable();
|
139
|
+
* // do stuff
|
140
|
+
* tracing.disable();
|
141
|
+
* ```
|
142
|
+
* @since v10.0.0
|
143
|
+
* @return .
|
144
|
+
*/
|
145
|
+
function createTracing(options: CreateTracingOptions): Tracing;
|
146
|
+
/**
|
147
|
+
* Returns a comma-separated list of all currently-enabled trace event
|
148
|
+
* categories. The current set of enabled trace event categories is determined
|
149
|
+
* by the _union_ of all currently-enabled `Tracing` objects and any categories
|
150
|
+
* enabled using the `--trace-event-categories` flag.
|
151
|
+
*
|
152
|
+
* 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.
|
153
|
+
*
|
154
|
+
* ```js
|
155
|
+
* const trace_events = require('trace_events');
|
156
|
+
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
|
157
|
+
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
|
158
|
+
* const t3 = trace_events.createTracing({ categories: ['v8'] });
|
159
|
+
*
|
160
|
+
* t1.enable();
|
161
|
+
* t2.enable();
|
162
|
+
*
|
163
|
+
* console.log(trace_events.getEnabledCategories());
|
164
|
+
* ```
|
165
|
+
* @since v10.0.0
|
166
|
+
*/
|
167
|
+
function getEnabledCategories(): string | undefined;
|
168
|
+
}
|
169
|
+
declare module 'node:trace_events' {
|
170
|
+
export * from 'trace_events';
|
171
|
+
}
|
@@ -0,0 +1,206 @@
|
|
1
|
+
/**
|
2
|
+
* The `tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes.
|
3
|
+
* In most cases, it will not be necessary or possible to use this module directly.
|
4
|
+
* However, it can be accessed using:
|
5
|
+
*
|
6
|
+
* ```js
|
7
|
+
* const tty = require('tty');
|
8
|
+
* ```
|
9
|
+
*
|
10
|
+
* When Node.js detects that it is being run with a text terminal ("TTY")
|
11
|
+
* attached, `process.stdin` will, by default, be initialized as an instance of`tty.ReadStream` and both `process.stdout` and `process.stderr` will, by
|
12
|
+
* default, be instances of `tty.WriteStream`. The preferred method of determining
|
13
|
+
* whether Node.js is being run within a TTY context is to check that the value of
|
14
|
+
* the `process.stdout.isTTY` property is `true`:
|
15
|
+
*
|
16
|
+
* ```console
|
17
|
+
* $ node -p -e "Boolean(process.stdout.isTTY)"
|
18
|
+
* true
|
19
|
+
* $ node -p -e "Boolean(process.stdout.isTTY)" | cat
|
20
|
+
* false
|
21
|
+
* ```
|
22
|
+
*
|
23
|
+
* In most cases, there should be little to no reason for an application to
|
24
|
+
* manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
|
25
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/tty.js)
|
26
|
+
*/
|
27
|
+
declare module 'tty' {
|
28
|
+
import * as net from 'node:net';
|
29
|
+
/**
|
30
|
+
* The `tty.isatty()` method returns `true` if the given `fd` is associated with
|
31
|
+
* a TTY and `false` if it is not, including whenever `fd` is not a non-negative
|
32
|
+
* integer.
|
33
|
+
* @since v0.5.8
|
34
|
+
* @param fd A numeric file descriptor
|
35
|
+
*/
|
36
|
+
function isatty(fd: number): boolean;
|
37
|
+
/**
|
38
|
+
* Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js
|
39
|
+
* process and there should be no reason to create additional instances.
|
40
|
+
* @since v0.5.8
|
41
|
+
*/
|
42
|
+
class ReadStream extends net.Socket {
|
43
|
+
constructor(fd: number, options?: net.SocketConstructorOpts);
|
44
|
+
/**
|
45
|
+
* A `boolean` that is `true` if the TTY is currently configured to operate as a
|
46
|
+
* raw device. Defaults to `false`.
|
47
|
+
* @since v0.7.7
|
48
|
+
*/
|
49
|
+
isRaw: boolean;
|
50
|
+
/**
|
51
|
+
* Allows configuration of `tty.ReadStream` so that it operates as a raw device.
|
52
|
+
*
|
53
|
+
* When in raw mode, input is always available character-by-character, not
|
54
|
+
* including modifiers. Additionally, all special processing of characters by the
|
55
|
+
* terminal is disabled, including echoing input
|
56
|
+
* characters. Ctrl+C will no longer cause a `SIGINT` when
|
57
|
+
* in this mode.
|
58
|
+
* @since v0.7.7
|
59
|
+
* @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
|
60
|
+
* property will be set to the resulting mode.
|
61
|
+
* @return The read stream instance.
|
62
|
+
*/
|
63
|
+
setRawMode(mode: boolean): this;
|
64
|
+
/**
|
65
|
+
* A `boolean` that is always `true` for `tty.ReadStream` instances.
|
66
|
+
* @since v0.5.8
|
67
|
+
*/
|
68
|
+
isTTY: boolean;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* -1 - to the left from cursor
|
72
|
+
* 0 - the entire line
|
73
|
+
* 1 - to the right from cursor
|
74
|
+
*/
|
75
|
+
type Direction = -1 | 0 | 1;
|
76
|
+
/**
|
77
|
+
* Represents the writable side of a TTY. In normal circumstances,`process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there
|
78
|
+
* should be no reason to create additional instances.
|
79
|
+
* @since v0.5.8
|
80
|
+
*/
|
81
|
+
class WriteStream extends net.Socket {
|
82
|
+
constructor(fd: number);
|
83
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
84
|
+
addListener(event: 'resize', listener: () => void): this;
|
85
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
86
|
+
emit(event: 'resize'): boolean;
|
87
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
88
|
+
on(event: 'resize', listener: () => void): this;
|
89
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
90
|
+
once(event: 'resize', listener: () => void): this;
|
91
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
92
|
+
prependListener(event: 'resize', listener: () => void): this;
|
93
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
94
|
+
prependOnceListener(event: 'resize', listener: () => void): this;
|
95
|
+
/**
|
96
|
+
* `writeStream.clearLine()` clears the current line of this `WriteStream` in a
|
97
|
+
* direction identified by `dir`.
|
98
|
+
* @since v0.7.7
|
99
|
+
* @param callback Invoked once the operation completes.
|
100
|
+
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
101
|
+
*/
|
102
|
+
clearLine(dir: Direction, callback?: () => void): boolean;
|
103
|
+
/**
|
104
|
+
* `writeStream.clearScreenDown()` clears this `WriteStream` from the current
|
105
|
+
* cursor down.
|
106
|
+
* @since v0.7.7
|
107
|
+
* @param callback Invoked once the operation completes.
|
108
|
+
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
109
|
+
*/
|
110
|
+
clearScreenDown(callback?: () => void): boolean;
|
111
|
+
/**
|
112
|
+
* `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified
|
113
|
+
* position.
|
114
|
+
* @since v0.7.7
|
115
|
+
* @param callback Invoked once the operation completes.
|
116
|
+
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
117
|
+
*/
|
118
|
+
cursorTo(x: number, y?: number, callback?: () => void): boolean;
|
119
|
+
cursorTo(x: number, callback: () => void): boolean;
|
120
|
+
/**
|
121
|
+
* `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its
|
122
|
+
* current position.
|
123
|
+
* @since v0.7.7
|
124
|
+
* @param callback Invoked once the operation completes.
|
125
|
+
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
126
|
+
*/
|
127
|
+
moveCursor(dx: number, dy: number, callback?: () => void): boolean;
|
128
|
+
/**
|
129
|
+
* Returns:
|
130
|
+
*
|
131
|
+
* * `1` for 2,
|
132
|
+
* * `4` for 16,
|
133
|
+
* * `8` for 256,
|
134
|
+
* * `24` for 16,777,216 colors supported.
|
135
|
+
*
|
136
|
+
* Use this to determine what colors the terminal supports. Due to the nature of
|
137
|
+
* colors in terminals it is possible to either have false positives or false
|
138
|
+
* negatives. It depends on process information and the environment variables that
|
139
|
+
* may lie about what terminal is used.
|
140
|
+
* It is possible to pass in an `env` object to simulate the usage of a specific
|
141
|
+
* terminal. This can be useful to check how specific environment settings behave.
|
142
|
+
*
|
143
|
+
* To enforce a specific color support, use one of the below environment settings.
|
144
|
+
*
|
145
|
+
* * 2 colors: `FORCE_COLOR = 0` (Disables colors)
|
146
|
+
* * 16 colors: `FORCE_COLOR = 1`
|
147
|
+
* * 256 colors: `FORCE_COLOR = 2`
|
148
|
+
* * 16,777,216 colors: `FORCE_COLOR = 3`
|
149
|
+
*
|
150
|
+
* Disabling color support is also possible by using the `NO_COLOR` and`NODE_DISABLE_COLORS` environment variables.
|
151
|
+
* @since v9.9.0
|
152
|
+
* @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
|
153
|
+
*/
|
154
|
+
getColorDepth(env?: object): number;
|
155
|
+
/**
|
156
|
+
* Returns `true` if the `writeStream` supports at least as many colors as provided
|
157
|
+
* in `count`. Minimum support is 2 (black and white).
|
158
|
+
*
|
159
|
+
* This has the same false positives and negatives as described in `writeStream.getColorDepth()`.
|
160
|
+
*
|
161
|
+
* ```js
|
162
|
+
* process.stdout.hasColors();
|
163
|
+
* // Returns true or false depending on if `stdout` supports at least 16 colors.
|
164
|
+
* process.stdout.hasColors(256);
|
165
|
+
* // Returns true or false depending on if `stdout` supports at least 256 colors.
|
166
|
+
* process.stdout.hasColors({ TMUX: '1' });
|
167
|
+
* // Returns true.
|
168
|
+
* process.stdout.hasColors(2 ** 24, { TMUX: '1' });
|
169
|
+
* // Returns false (the environment setting pretends to support 2 ** 8 colors).
|
170
|
+
* ```
|
171
|
+
* @since v11.13.0, v10.16.0
|
172
|
+
* @param [count=16] The number of colors that are requested (minimum 2).
|
173
|
+
* @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
|
174
|
+
*/
|
175
|
+
hasColors(count?: number): boolean;
|
176
|
+
hasColors(env?: object): boolean;
|
177
|
+
hasColors(count: number, env?: object): boolean;
|
178
|
+
/**
|
179
|
+
* `writeStream.getWindowSize()` returns the size of the TTY
|
180
|
+
* corresponding to this `WriteStream`. The array is of the type`[numColumns, numRows]` where `numColumns` and `numRows` represent the number
|
181
|
+
* of columns and rows in the corresponding TTY.
|
182
|
+
* @since v0.7.7
|
183
|
+
*/
|
184
|
+
getWindowSize(): [number, number];
|
185
|
+
/**
|
186
|
+
* A `number` specifying the number of columns the TTY currently has. This property
|
187
|
+
* is updated whenever the `'resize'` event is emitted.
|
188
|
+
* @since v0.7.7
|
189
|
+
*/
|
190
|
+
columns: number;
|
191
|
+
/**
|
192
|
+
* A `number` specifying the number of rows the TTY currently has. This property
|
193
|
+
* is updated whenever the `'resize'` event is emitted.
|
194
|
+
* @since v0.7.7
|
195
|
+
*/
|
196
|
+
rows: number;
|
197
|
+
/**
|
198
|
+
* A `boolean` that is always `true`.
|
199
|
+
* @since v0.5.8
|
200
|
+
*/
|
201
|
+
isTTY: boolean;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
declare module 'node:tty' {
|
205
|
+
export * from 'tty';
|
206
|
+
}
|