@aligent/cdk-prerender-proxy 0.2.4-beta1 → 0.2.5-beta
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.
- package/index.d.ts +1 -2
- package/index.js +2 -4
- package/lib/handlers/cache-control.ts +7 -20
- package/lib/handlers/error-response.ts +8 -51
- package/lib/handlers/node_modules/.package-lock.json +32 -3
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.d.ts +6 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.js +14 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.js +24 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.js +50 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.js +28 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.js +49 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.js +33 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/package.json +27 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/tsconfig.json +3 -0
- package/lib/handlers/node_modules/@middy/core/LICENSE +21 -0
- package/lib/handlers/node_modules/@middy/core/README.md +65 -0
- package/lib/handlers/node_modules/@middy/core/index.cjs +207 -0
- package/lib/handlers/node_modules/@middy/core/index.d.ts +91 -0
- package/lib/handlers/node_modules/@middy/core/index.js +199 -0
- package/lib/handlers/node_modules/@middy/core/package.json +65 -0
- package/lib/handlers/node_modules/@types/node/README.md +4 -4
- package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +5 -1
- package/lib/handlers/node_modules/@types/node/assert.d.ts +904 -67
- package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +371 -96
- package/lib/handlers/node_modules/@types/node/buffer.d.ts +2199 -25
- package/lib/handlers/node_modules/@types/node/child_process.d.ts +1151 -308
- package/lib/handlers/node_modules/@types/node/cluster.d.ts +356 -208
- package/lib/handlers/node_modules/@types/node/console.d.ts +324 -45
- package/lib/handlers/node_modules/@types/node/constants.d.ts +8 -3
- package/lib/handlers/node_modules/@types/node/crypto.d.ts +3230 -846
- package/lib/handlers/node_modules/@types/node/dgram.d.ts +478 -74
- package/lib/handlers/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
- package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +308 -35
- package/lib/handlers/node_modules/@types/node/dns.d.ts +444 -107
- package/lib/handlers/node_modules/@types/node/dom-events.d.ts +126 -0
- package/lib/handlers/node_modules/@types/node/domain.d.ts +162 -16
- package/lib/handlers/node_modules/@types/node/events.d.ts +624 -39
- package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +911 -365
- package/lib/handlers/node_modules/@types/node/fs.d.ts +2611 -978
- package/lib/handlers/node_modules/@types/node/globals.d.ts +66 -421
- package/lib/handlers/node_modules/@types/node/globals.global.d.ts +1 -1
- package/lib/handlers/node_modules/@types/node/http.d.ts +1416 -199
- package/lib/handlers/node_modules/@types/node/http2.d.ts +1688 -530
- package/lib/handlers/node_modules/@types/node/https.d.ts +532 -26
- package/lib/handlers/node_modules/@types/node/index.d.ts +92 -16
- package/lib/handlers/node_modules/@types/node/inspector.d.ts +511 -811
- package/lib/handlers/node_modules/@types/node/module.d.ts +75 -13
- package/lib/handlers/node_modules/@types/node/net.d.ts +710 -167
- package/lib/handlers/node_modules/@types/node/os.d.ts +252 -25
- package/lib/handlers/node_modules/@types/node/package.json +30 -25
- package/lib/handlers/node_modules/@types/node/path.d.ts +59 -31
- package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +420 -105
- package/lib/handlers/node_modules/@types/node/process.d.ts +1249 -228
- package/lib/handlers/node_modules/@types/node/punycode.d.ts +67 -25
- package/lib/handlers/node_modules/@types/node/querystring.d.ts +113 -10
- package/lib/handlers/node_modules/@types/node/readline/promises.d.ts +143 -0
- package/lib/handlers/node_modules/@types/node/readline.d.ts +570 -109
- package/lib/handlers/node_modules/@types/node/repl.d.ts +154 -125
- package/lib/handlers/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +18 -43
- package/lib/handlers/node_modules/@types/node/stream/web.d.ts +330 -0
- package/lib/handlers/node_modules/@types/node/stream.d.ts +1117 -248
- package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +60 -0
- package/lib/handlers/node_modules/@types/node/test.d.ts +446 -0
- package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +81 -9
- package/lib/handlers/node_modules/@types/node/timers.d.ts +84 -17
- package/lib/handlers/node_modules/@types/node/tls.d.ts +510 -275
- package/lib/handlers/node_modules/@types/node/trace_events.d.ts +120 -10
- package/lib/handlers/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/events.d.ts +678 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/http.d.ts +1651 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/https.d.ts +542 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/module.d.ts +114 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/net.d.ts +869 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/os.d.ts +466 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/test.d.ts +446 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/url.d.ts +897 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/util.d.ts +1926 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/lib/handlers/node_modules/@types/node/tty.d.ts +163 -23
- package/lib/handlers/node_modules/@types/node/url.d.ts +825 -44
- package/lib/handlers/node_modules/@types/node/util.d.ts +1842 -72
- package/lib/handlers/node_modules/@types/node/v8.d.ts +276 -78
- package/lib/handlers/node_modules/@types/node/vm.d.ts +410 -53
- package/lib/handlers/node_modules/@types/node/wasi.d.ts +102 -30
- package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +559 -152
- package/lib/handlers/node_modules/@types/node/zlib.d.ts +234 -78
- package/lib/handlers/node_modules/esbuild/README.md +3 -0
- package/lib/handlers/node_modules/esbuild/bin/esbuild +0 -0
- package/lib/handlers/node_modules/esbuild/install.js +256 -0
- package/lib/handlers/node_modules/esbuild/lib/main.d.ts +397 -0
- package/lib/handlers/node_modules/esbuild/lib/main.js +1939 -0
- package/lib/handlers/node_modules/esbuild/package.json +15 -0
- package/lib/handlers/package-lock.json +62 -6
- package/lib/handlers/package.json +6 -1
- package/lib/handlers/prerender-check.ts +8 -27
- package/lib/handlers/prerender.ts +8 -43
- package/package.json +1 -1
- package/lib/handlers/node_modules/@types/node/base.d.ts +0 -19
- package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +0 -34
- package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +0 -68
- package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/lib/handlers/node_modules/@types/node/util/types.d.ts +0 -53
- package/lib/handlers/prerender-handler.ts +0 -13
- package/lib/sendToPrerender.d.ts +0 -2
- package/lib/sendToPrerender.js +0 -42
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
declare module 'process' {
|
|
2
|
-
import * as tty from 'tty';
|
|
3
|
-
|
|
2
|
+
import * as tty from 'node:tty';
|
|
3
|
+
import { Worker } from 'node:worker_threads';
|
|
4
4
|
global {
|
|
5
5
|
var process: NodeJS.Process;
|
|
6
|
-
|
|
7
6
|
namespace NodeJS {
|
|
8
7
|
// this namespace merge is here because these are specifically used
|
|
9
8
|
// as the type for process.stdin, process.stdout, and process.stderr.
|
|
10
9
|
// they can't live in tty.d.ts because we need to disambiguate the imported name.
|
|
11
10
|
interface ReadStream extends tty.ReadStream {}
|
|
12
11
|
interface WriteStream extends tty.WriteStream {}
|
|
13
|
-
|
|
14
12
|
interface MemoryUsageFn {
|
|
15
13
|
/**
|
|
16
14
|
* The `process.memoryUsage()` method iterate over each page to gather informations about memory
|
|
@@ -22,7 +20,6 @@ declare module 'process' {
|
|
|
22
20
|
*/
|
|
23
21
|
rss(): number;
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
interface MemoryUsage {
|
|
27
24
|
rss: number;
|
|
28
25
|
heapTotal: number;
|
|
@@ -30,20 +27,17 @@ declare module 'process' {
|
|
|
30
27
|
external: number;
|
|
31
28
|
arrayBuffers: number;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
interface CpuUsage {
|
|
35
31
|
user: number;
|
|
36
32
|
system: number;
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
interface ProcessRelease {
|
|
40
35
|
name: string;
|
|
41
|
-
sourceUrl?: string;
|
|
42
|
-
headersUrl?: string;
|
|
43
|
-
libUrl?: string;
|
|
44
|
-
lts?: string;
|
|
36
|
+
sourceUrl?: string | undefined;
|
|
37
|
+
headersUrl?: string | undefined;
|
|
38
|
+
libUrl?: string | undefined;
|
|
39
|
+
lts?: string | undefined;
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
interface ProcessVersions extends Dict<string> {
|
|
48
42
|
http_parser: string;
|
|
49
43
|
node: string;
|
|
@@ -54,51 +48,77 @@ declare module 'process' {
|
|
|
54
48
|
modules: string;
|
|
55
49
|
openssl: string;
|
|
56
50
|
}
|
|
57
|
-
|
|
58
|
-
type
|
|
59
|
-
| 'android'
|
|
60
|
-
| 'darwin'
|
|
61
|
-
| 'freebsd'
|
|
62
|
-
| 'linux'
|
|
63
|
-
| 'openbsd'
|
|
64
|
-
| 'sunos'
|
|
65
|
-
| 'win32'
|
|
66
|
-
| 'cygwin'
|
|
67
|
-
| 'netbsd';
|
|
68
|
-
|
|
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';
|
|
69
53
|
type Signals =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
| 'SIGABRT'
|
|
55
|
+
| 'SIGALRM'
|
|
56
|
+
| 'SIGBUS'
|
|
57
|
+
| 'SIGCHLD'
|
|
58
|
+
| 'SIGCONT'
|
|
59
|
+
| 'SIGFPE'
|
|
60
|
+
| 'SIGHUP'
|
|
61
|
+
| 'SIGILL'
|
|
62
|
+
| 'SIGINT'
|
|
63
|
+
| 'SIGIO'
|
|
64
|
+
| 'SIGIOT'
|
|
65
|
+
| 'SIGKILL'
|
|
66
|
+
| 'SIGPIPE'
|
|
67
|
+
| 'SIGPOLL'
|
|
68
|
+
| 'SIGPROF'
|
|
69
|
+
| 'SIGPWR'
|
|
70
|
+
| 'SIGQUIT'
|
|
71
|
+
| 'SIGSEGV'
|
|
72
|
+
| 'SIGSTKFLT'
|
|
73
|
+
| 'SIGSTOP'
|
|
74
|
+
| 'SIGSYS'
|
|
75
|
+
| 'SIGTERM'
|
|
76
|
+
| 'SIGTRAP'
|
|
77
|
+
| 'SIGTSTP'
|
|
78
|
+
| 'SIGTTIN'
|
|
79
|
+
| 'SIGTTOU'
|
|
80
|
+
| 'SIGUNUSED'
|
|
81
|
+
| 'SIGURG'
|
|
82
|
+
| 'SIGUSR1'
|
|
83
|
+
| 'SIGUSR2'
|
|
84
|
+
| 'SIGVTALRM'
|
|
85
|
+
| 'SIGWINCH'
|
|
86
|
+
| 'SIGXCPU'
|
|
87
|
+
| 'SIGXFSZ'
|
|
88
|
+
| 'SIGBREAK'
|
|
89
|
+
| 'SIGLOST'
|
|
90
|
+
| 'SIGINFO';
|
|
91
|
+
type UncaughtExceptionOrigin = 'uncaughtException' | 'unhandledRejection';
|
|
75
92
|
type MultipleResolveType = 'resolve' | 'reject';
|
|
76
|
-
|
|
77
93
|
type BeforeExitListener = (code: number) => void;
|
|
78
94
|
type DisconnectListener = () => void;
|
|
79
95
|
type ExitListener = (code: number) => void;
|
|
80
|
-
type RejectionHandledListener = (promise: Promise<
|
|
81
|
-
type UncaughtExceptionListener = (error: Error) => void;
|
|
82
|
-
|
|
96
|
+
type RejectionHandledListener = (promise: Promise<unknown>) => void;
|
|
97
|
+
type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Most of the time the unhandledRejection will be an Error, but this should not be relied upon
|
|
100
|
+
* as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.
|
|
101
|
+
*/
|
|
102
|
+
type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
|
|
83
103
|
type WarningListener = (warning: Error) => void;
|
|
84
|
-
type MessageListener = (message:
|
|
104
|
+
type MessageListener = (message: unknown, sendHandle: unknown) => void;
|
|
85
105
|
type SignalsListener = (signal: Signals) => void;
|
|
86
|
-
type
|
|
87
|
-
type
|
|
88
|
-
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
|
|
89
|
-
|
|
106
|
+
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<unknown>, value: unknown) => void;
|
|
107
|
+
type WorkerListener = (worker: Worker) => void;
|
|
90
108
|
interface Socket extends ReadWriteStream {
|
|
91
|
-
isTTY?: true;
|
|
109
|
+
isTTY?: true | undefined;
|
|
92
110
|
}
|
|
93
|
-
|
|
94
111
|
// Alias for compatibility
|
|
95
|
-
interface ProcessEnv extends Dict<string> {
|
|
96
|
-
|
|
112
|
+
interface ProcessEnv extends Dict<string> {
|
|
113
|
+
/**
|
|
114
|
+
* Can be used to change the default timezone at runtime
|
|
115
|
+
*/
|
|
116
|
+
TZ?: string;
|
|
117
|
+
}
|
|
97
118
|
interface HRTime {
|
|
98
119
|
(time?: [number, number]): [number, number];
|
|
99
120
|
bigint(): bigint;
|
|
100
121
|
}
|
|
101
|
-
|
|
102
122
|
interface ProcessReport {
|
|
103
123
|
/**
|
|
104
124
|
* Directory where the report is written.
|
|
@@ -106,7 +126,6 @@ declare module 'process' {
|
|
|
106
126
|
* @default '' indicating that reports are written to the current
|
|
107
127
|
*/
|
|
108
128
|
directory: string;
|
|
109
|
-
|
|
110
129
|
/**
|
|
111
130
|
* Filename where the report is written.
|
|
112
131
|
* The default value is the empty string.
|
|
@@ -114,39 +133,33 @@ declare module 'process' {
|
|
|
114
133
|
* PID, and sequence number.
|
|
115
134
|
*/
|
|
116
135
|
filename: string;
|
|
117
|
-
|
|
118
136
|
/**
|
|
119
137
|
* Returns a JSON-formatted diagnostic report for the running process.
|
|
120
138
|
* The report's JavaScript stack trace is taken from err, if present.
|
|
121
139
|
*/
|
|
122
140
|
getReport(err?: Error): string;
|
|
123
|
-
|
|
124
141
|
/**
|
|
125
142
|
* If true, a diagnostic report is generated on fatal errors,
|
|
126
143
|
* such as out of memory errors or failed C++ assertions.
|
|
127
144
|
* @default false
|
|
128
145
|
*/
|
|
129
146
|
reportOnFatalError: boolean;
|
|
130
|
-
|
|
131
147
|
/**
|
|
132
148
|
* If true, a diagnostic report is generated when the process
|
|
133
149
|
* receives the signal specified by process.report.signal.
|
|
134
|
-
* @
|
|
150
|
+
* @default false
|
|
135
151
|
*/
|
|
136
152
|
reportOnSignal: boolean;
|
|
137
|
-
|
|
138
153
|
/**
|
|
139
154
|
* If true, a diagnostic report is generated on uncaught exception.
|
|
140
155
|
* @default false
|
|
141
156
|
*/
|
|
142
157
|
reportOnUncaughtException: boolean;
|
|
143
|
-
|
|
144
158
|
/**
|
|
145
159
|
* The signal used to trigger the creation of a diagnostic report.
|
|
146
160
|
* @default 'SIGUSR2'
|
|
147
161
|
*/
|
|
148
162
|
signal: Signals;
|
|
149
|
-
|
|
150
163
|
/**
|
|
151
164
|
* Writes a diagnostic report to a file. If filename is not provided, the default filename
|
|
152
165
|
* includes the date, time, PID, and a sequence number.
|
|
@@ -163,7 +176,6 @@ declare module 'process' {
|
|
|
163
176
|
writeReport(error?: Error): string;
|
|
164
177
|
writeReport(fileName?: string, err?: Error): string;
|
|
165
178
|
}
|
|
166
|
-
|
|
167
179
|
interface ResourceUsage {
|
|
168
180
|
fsRead: number;
|
|
169
181
|
fsWrite: number;
|
|
@@ -182,129 +194,1039 @@ declare module 'process' {
|
|
|
182
194
|
userCPUTime: number;
|
|
183
195
|
voluntaryContextSwitches: number;
|
|
184
196
|
}
|
|
185
|
-
|
|
186
197
|
interface EmitWarningOptions {
|
|
187
198
|
/**
|
|
188
199
|
* When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted.
|
|
189
200
|
*
|
|
190
201
|
* @default 'Warning'
|
|
191
202
|
*/
|
|
192
|
-
type?: string;
|
|
193
|
-
|
|
203
|
+
type?: string | undefined;
|
|
194
204
|
/**
|
|
195
205
|
* A unique identifier for the warning instance being emitted.
|
|
196
206
|
*/
|
|
197
|
-
code?: string;
|
|
198
|
-
|
|
207
|
+
code?: string | undefined;
|
|
199
208
|
/**
|
|
200
209
|
* When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.
|
|
201
210
|
*
|
|
202
211
|
* @default process.emitWarning
|
|
203
212
|
*/
|
|
204
|
-
ctor?: Function;
|
|
205
|
-
|
|
213
|
+
ctor?: Function | undefined;
|
|
206
214
|
/**
|
|
207
215
|
* Additional text to include with the error.
|
|
208
216
|
*/
|
|
209
|
-
detail?: string;
|
|
217
|
+
detail?: string | undefined;
|
|
218
|
+
}
|
|
219
|
+
interface ProcessConfig {
|
|
220
|
+
readonly target_defaults: {
|
|
221
|
+
readonly cflags: any[];
|
|
222
|
+
readonly default_configuration: string;
|
|
223
|
+
readonly defines: string[];
|
|
224
|
+
readonly include_dirs: string[];
|
|
225
|
+
readonly libraries: string[];
|
|
226
|
+
};
|
|
227
|
+
readonly variables: {
|
|
228
|
+
readonly clang: number;
|
|
229
|
+
readonly host_arch: string;
|
|
230
|
+
readonly node_install_npm: boolean;
|
|
231
|
+
readonly node_install_waf: boolean;
|
|
232
|
+
readonly node_prefix: string;
|
|
233
|
+
readonly node_shared_openssl: boolean;
|
|
234
|
+
readonly node_shared_v8: boolean;
|
|
235
|
+
readonly node_shared_zlib: boolean;
|
|
236
|
+
readonly node_use_dtrace: boolean;
|
|
237
|
+
readonly node_use_etw: boolean;
|
|
238
|
+
readonly node_use_openssl: boolean;
|
|
239
|
+
readonly target_arch: string;
|
|
240
|
+
readonly v8_no_strict_aliasing: number;
|
|
241
|
+
readonly v8_use_snapshot: boolean;
|
|
242
|
+
readonly visibility: string;
|
|
243
|
+
};
|
|
210
244
|
}
|
|
211
|
-
|
|
212
245
|
interface Process extends EventEmitter {
|
|
213
246
|
/**
|
|
214
|
-
*
|
|
247
|
+
* The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is
|
|
248
|
+
* a `Writable` stream.
|
|
249
|
+
*
|
|
250
|
+
* For example, to copy `process.stdin` to `process.stdout`:
|
|
251
|
+
*
|
|
252
|
+
* ```js
|
|
253
|
+
* import { stdin, stdout } from 'process';
|
|
254
|
+
*
|
|
255
|
+
* stdin.pipe(stdout);
|
|
256
|
+
* ```
|
|
257
|
+
*
|
|
258
|
+
* `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
|
|
215
259
|
*/
|
|
216
260
|
stdout: WriteStream & {
|
|
217
261
|
fd: 1;
|
|
218
262
|
};
|
|
219
263
|
/**
|
|
220
|
-
*
|
|
264
|
+
* The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is
|
|
265
|
+
* a `Writable` stream.
|
|
266
|
+
*
|
|
267
|
+
* `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
|
|
221
268
|
*/
|
|
222
269
|
stderr: WriteStream & {
|
|
223
270
|
fd: 2;
|
|
224
271
|
};
|
|
272
|
+
/**
|
|
273
|
+
* The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is
|
|
274
|
+
* a `Readable` stream.
|
|
275
|
+
*
|
|
276
|
+
* For details of how to read from `stdin` see `readable.read()`.
|
|
277
|
+
*
|
|
278
|
+
* As a `Duplex` stream, `process.stdin` can also be used in "old" mode that
|
|
279
|
+
* is compatible with scripts written for Node.js prior to v0.10\.
|
|
280
|
+
* For more information see `Stream compatibility`.
|
|
281
|
+
*
|
|
282
|
+
* In "old" streams mode the `stdin` stream is paused by default, so one
|
|
283
|
+
* must call `process.stdin.resume()` to read from it. Note also that calling`process.stdin.resume()` itself would switch stream to "old" mode.
|
|
284
|
+
*/
|
|
225
285
|
stdin: ReadStream & {
|
|
226
286
|
fd: 0;
|
|
227
287
|
};
|
|
228
288
|
openStdin(): Socket;
|
|
289
|
+
/**
|
|
290
|
+
* The `process.argv` property returns an array containing the command-line
|
|
291
|
+
* arguments passed when the Node.js process was launched. The first element will
|
|
292
|
+
* be {@link execPath}. See `process.argv0` if access to the original value
|
|
293
|
+
* of `argv[0]` is needed. The second element will be the path to the JavaScript
|
|
294
|
+
* file being executed. The remaining elements will be any additional command-line
|
|
295
|
+
* arguments.
|
|
296
|
+
*
|
|
297
|
+
* For example, assuming the following script for `process-args.js`:
|
|
298
|
+
*
|
|
299
|
+
* ```js
|
|
300
|
+
* import { argv } from 'process';
|
|
301
|
+
*
|
|
302
|
+
* // print process.argv
|
|
303
|
+
* argv.forEach((val, index) => {
|
|
304
|
+
* console.log(`${index}: ${val}`);
|
|
305
|
+
* });
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* Launching the Node.js process as:
|
|
309
|
+
*
|
|
310
|
+
* ```console
|
|
311
|
+
* $ node process-args.js one two=three four
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* Would generate the output:
|
|
315
|
+
*
|
|
316
|
+
* ```text
|
|
317
|
+
* 0: /usr/local/bin/node
|
|
318
|
+
* 1: /Users/mjr/work/node/process-args.js
|
|
319
|
+
* 2: one
|
|
320
|
+
* 3: two=three
|
|
321
|
+
* 4: four
|
|
322
|
+
* ```
|
|
323
|
+
* @since v0.1.27
|
|
324
|
+
*/
|
|
229
325
|
argv: string[];
|
|
326
|
+
/**
|
|
327
|
+
* The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts.
|
|
328
|
+
*
|
|
329
|
+
* ```console
|
|
330
|
+
* $ bash -c 'exec -a customArgv0 ./node'
|
|
331
|
+
* > process.argv[0]
|
|
332
|
+
* '/Volumes/code/external/node/out/Release/node'
|
|
333
|
+
* > process.argv0
|
|
334
|
+
* 'customArgv0'
|
|
335
|
+
* ```
|
|
336
|
+
* @since v6.4.0
|
|
337
|
+
*/
|
|
230
338
|
argv0: string;
|
|
339
|
+
/**
|
|
340
|
+
* The `process.execArgv` property returns the set of Node.js-specific command-line
|
|
341
|
+
* options passed when the Node.js process was launched. These options do not
|
|
342
|
+
* appear in the array returned by the {@link argv} property, and do not
|
|
343
|
+
* include the Node.js executable, the name of the script, or any options following
|
|
344
|
+
* the script name. These options are useful in order to spawn child processes with
|
|
345
|
+
* the same execution environment as the parent.
|
|
346
|
+
*
|
|
347
|
+
* ```console
|
|
348
|
+
* $ node --harmony script.js --version
|
|
349
|
+
* ```
|
|
350
|
+
*
|
|
351
|
+
* Results in `process.execArgv`:
|
|
352
|
+
*
|
|
353
|
+
* ```js
|
|
354
|
+
* ['--harmony']
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* And `process.argv`:
|
|
358
|
+
*
|
|
359
|
+
* ```js
|
|
360
|
+
* ['/usr/local/bin/node', 'script.js', '--version']
|
|
361
|
+
* ```
|
|
362
|
+
*
|
|
363
|
+
* Refer to `Worker constructor` for the detailed behavior of worker
|
|
364
|
+
* threads with this property.
|
|
365
|
+
* @since v0.7.7
|
|
366
|
+
*/
|
|
231
367
|
execArgv: string[];
|
|
368
|
+
/**
|
|
369
|
+
* The `process.execPath` property returns the absolute pathname of the executable
|
|
370
|
+
* that started the Node.js process. Symbolic links, if any, are resolved.
|
|
371
|
+
*
|
|
372
|
+
* ```js
|
|
373
|
+
* '/usr/local/bin/node'
|
|
374
|
+
* ```
|
|
375
|
+
* @since v0.1.100
|
|
376
|
+
*/
|
|
232
377
|
execPath: string;
|
|
378
|
+
/**
|
|
379
|
+
* The `process.abort()` method causes the Node.js process to exit immediately and
|
|
380
|
+
* generate a core file.
|
|
381
|
+
*
|
|
382
|
+
* This feature is not available in `Worker` threads.
|
|
383
|
+
* @since v0.7.0
|
|
384
|
+
*/
|
|
233
385
|
abort(): never;
|
|
386
|
+
/**
|
|
387
|
+
* The `process.chdir()` method changes the current working directory of the
|
|
388
|
+
* Node.js process or throws an exception if doing so fails (for instance, if
|
|
389
|
+
* the specified `directory` does not exist).
|
|
390
|
+
*
|
|
391
|
+
* ```js
|
|
392
|
+
* import { chdir, cwd } from 'process';
|
|
393
|
+
*
|
|
394
|
+
* console.log(`Starting directory: ${cwd()}`);
|
|
395
|
+
* try {
|
|
396
|
+
* chdir('/tmp');
|
|
397
|
+
* console.log(`New directory: ${cwd()}`);
|
|
398
|
+
* } catch (err) {
|
|
399
|
+
* console.error(`chdir: ${err}`);
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* This feature is not available in `Worker` threads.
|
|
404
|
+
* @since v0.1.17
|
|
405
|
+
*/
|
|
234
406
|
chdir(directory: string): void;
|
|
407
|
+
/**
|
|
408
|
+
* The `process.cwd()` method returns the current working directory of the Node.js
|
|
409
|
+
* process.
|
|
410
|
+
*
|
|
411
|
+
* ```js
|
|
412
|
+
* import { cwd } from 'process';
|
|
413
|
+
*
|
|
414
|
+
* console.log(`Current directory: ${cwd()}`);
|
|
415
|
+
* ```
|
|
416
|
+
* @since v0.1.8
|
|
417
|
+
*/
|
|
235
418
|
cwd(): string;
|
|
419
|
+
/**
|
|
420
|
+
* The port used by the Node.js debugger when enabled.
|
|
421
|
+
*
|
|
422
|
+
* ```js
|
|
423
|
+
* import process from 'process';
|
|
424
|
+
*
|
|
425
|
+
* process.debugPort = 5858;
|
|
426
|
+
* ```
|
|
427
|
+
* @since v0.7.2
|
|
428
|
+
*/
|
|
236
429
|
debugPort: number;
|
|
237
|
-
|
|
238
430
|
/**
|
|
239
|
-
* The `process.emitWarning()` method can be used to emit custom or application
|
|
431
|
+
* The `process.emitWarning()` method can be used to emit custom or application
|
|
432
|
+
* specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
|
|
433
|
+
*
|
|
434
|
+
* ```js
|
|
435
|
+
* import { emitWarning } from 'process';
|
|
240
436
|
*
|
|
241
|
-
*
|
|
437
|
+
* // Emit a warning with a code and additional detail.
|
|
438
|
+
* emitWarning('Something happened!', {
|
|
439
|
+
* code: 'MY_WARNING',
|
|
440
|
+
* detail: 'This is some additional information'
|
|
441
|
+
* });
|
|
442
|
+
* // Emits:
|
|
443
|
+
* // (node:56338) [MY_WARNING] Warning: Something happened!
|
|
444
|
+
* // This is some additional information
|
|
445
|
+
* ```
|
|
242
446
|
*
|
|
447
|
+
* In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler.
|
|
448
|
+
*
|
|
449
|
+
* ```js
|
|
450
|
+
* import process from 'process';
|
|
451
|
+
*
|
|
452
|
+
* process.on('warning', (warning) => {
|
|
453
|
+
* console.warn(warning.name); // 'Warning'
|
|
454
|
+
* console.warn(warning.message); // 'Something happened!'
|
|
455
|
+
* console.warn(warning.code); // 'MY_WARNING'
|
|
456
|
+
* console.warn(warning.stack); // Stack trace
|
|
457
|
+
* console.warn(warning.detail); // 'This is some additional information'
|
|
458
|
+
* });
|
|
459
|
+
* ```
|
|
460
|
+
*
|
|
461
|
+
* If `warning` is passed as an `Error` object, the `options` argument is ignored.
|
|
462
|
+
* @since v8.0.0
|
|
243
463
|
* @param warning The warning to emit.
|
|
244
|
-
* @param type When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. Default: `'Warning'`.
|
|
245
|
-
* @param code A unique identifier for the warning instance being emitted.
|
|
246
|
-
* @param ctor When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. Default: `process.emitWarning`.
|
|
247
464
|
*/
|
|
248
465
|
emitWarning(warning: string | Error, ctor?: Function): void;
|
|
249
466
|
emitWarning(warning: string | Error, type?: string, ctor?: Function): void;
|
|
250
467
|
emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void;
|
|
251
468
|
emitWarning(warning: string | Error, options?: EmitWarningOptions): void;
|
|
252
|
-
|
|
469
|
+
/**
|
|
470
|
+
* The `process.env` property returns an object containing the user environment.
|
|
471
|
+
* See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html).
|
|
472
|
+
*
|
|
473
|
+
* An example of this object looks like:
|
|
474
|
+
*
|
|
475
|
+
* ```js
|
|
476
|
+
* {
|
|
477
|
+
* TERM: 'xterm-256color',
|
|
478
|
+
* SHELL: '/usr/local/bin/bash',
|
|
479
|
+
* USER: 'maciej',
|
|
480
|
+
* PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
|
|
481
|
+
* PWD: '/Users/maciej',
|
|
482
|
+
* EDITOR: 'vim',
|
|
483
|
+
* SHLVL: '1',
|
|
484
|
+
* HOME: '/Users/maciej',
|
|
485
|
+
* LOGNAME: 'maciej',
|
|
486
|
+
* _: '/usr/local/bin/node'
|
|
487
|
+
* }
|
|
488
|
+
* ```
|
|
489
|
+
*
|
|
490
|
+
* It is possible to modify this object, but such modifications will not be
|
|
491
|
+
* reflected outside the Node.js process, or (unless explicitly requested)
|
|
492
|
+
* to other `Worker` threads.
|
|
493
|
+
* In other words, the following example would not work:
|
|
494
|
+
*
|
|
495
|
+
* ```console
|
|
496
|
+
* $ node -e 'process.env.foo = "bar"' && echo $foo
|
|
497
|
+
* ```
|
|
498
|
+
*
|
|
499
|
+
* While the following will:
|
|
500
|
+
*
|
|
501
|
+
* ```js
|
|
502
|
+
* import { env } from 'process';
|
|
503
|
+
*
|
|
504
|
+
* env.foo = 'bar';
|
|
505
|
+
* console.log(env.foo);
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* Assigning a property on `process.env` will implicitly convert the value
|
|
509
|
+
* to a string. **This behavior is deprecated.** Future versions of Node.js may
|
|
510
|
+
* throw an error when the value is not a string, number, or boolean.
|
|
511
|
+
*
|
|
512
|
+
* ```js
|
|
513
|
+
* import { env } from 'process';
|
|
514
|
+
*
|
|
515
|
+
* env.test = null;
|
|
516
|
+
* console.log(env.test);
|
|
517
|
+
* // => 'null'
|
|
518
|
+
* env.test = undefined;
|
|
519
|
+
* console.log(env.test);
|
|
520
|
+
* // => 'undefined'
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* Use `delete` to delete a property from `process.env`.
|
|
524
|
+
*
|
|
525
|
+
* ```js
|
|
526
|
+
* import { env } from 'process';
|
|
527
|
+
*
|
|
528
|
+
* env.TEST = 1;
|
|
529
|
+
* delete env.TEST;
|
|
530
|
+
* console.log(env.TEST);
|
|
531
|
+
* // => undefined
|
|
532
|
+
* ```
|
|
533
|
+
*
|
|
534
|
+
* On Windows operating systems, environment variables are case-insensitive.
|
|
535
|
+
*
|
|
536
|
+
* ```js
|
|
537
|
+
* import { env } from 'process';
|
|
538
|
+
*
|
|
539
|
+
* env.TEST = 1;
|
|
540
|
+
* console.log(env.test);
|
|
541
|
+
* // => 1
|
|
542
|
+
* ```
|
|
543
|
+
*
|
|
544
|
+
* Unless explicitly specified when creating a `Worker` instance,
|
|
545
|
+
* each `Worker` thread has its own copy of `process.env`, based on its
|
|
546
|
+
* parent thread’s `process.env`, or whatever was specified as the `env` option
|
|
547
|
+
* to the `Worker` constructor. Changes to `process.env` will not be visible
|
|
548
|
+
* across `Worker` threads, and only the main thread can make changes that
|
|
549
|
+
* are visible to the operating system or to native add-ons.
|
|
550
|
+
* @since v0.1.27
|
|
551
|
+
*/
|
|
253
552
|
env: ProcessEnv;
|
|
553
|
+
/**
|
|
554
|
+
* The `process.exit()` method instructs Node.js to terminate the process
|
|
555
|
+
* synchronously with an exit status of `code`. If `code` is omitted, exit uses
|
|
556
|
+
* either the 'success' code `0` or the value of `process.exitCode` if it has been
|
|
557
|
+
* set. Node.js will not terminate until all the `'exit'` event listeners are
|
|
558
|
+
* called.
|
|
559
|
+
*
|
|
560
|
+
* To exit with a 'failure' code:
|
|
561
|
+
*
|
|
562
|
+
* ```js
|
|
563
|
+
* import { exit } from 'process';
|
|
564
|
+
*
|
|
565
|
+
* exit(1);
|
|
566
|
+
* ```
|
|
567
|
+
*
|
|
568
|
+
* The shell that executed Node.js should see the exit code as `1`.
|
|
569
|
+
*
|
|
570
|
+
* Calling `process.exit()` will force the process to exit as quickly as possible
|
|
571
|
+
* even if there are still asynchronous operations pending that have not yet
|
|
572
|
+
* completed fully, including I/O operations to `process.stdout` and`process.stderr`.
|
|
573
|
+
*
|
|
574
|
+
* In most situations, it is not actually necessary to call `process.exit()`explicitly. The Node.js process will exit on its own _if there is no additional_
|
|
575
|
+
* _work pending_ in the event loop. The `process.exitCode` property can be set to
|
|
576
|
+
* tell the process which exit code to use when the process exits gracefully.
|
|
577
|
+
*
|
|
578
|
+
* For instance, the following example illustrates a _misuse_ of the`process.exit()` method that could lead to data printed to stdout being
|
|
579
|
+
* truncated and lost:
|
|
580
|
+
*
|
|
581
|
+
* ```js
|
|
582
|
+
* import { exit } from 'process';
|
|
583
|
+
*
|
|
584
|
+
* // This is an example of what *not* to do:
|
|
585
|
+
* if (someConditionNotMet()) {
|
|
586
|
+
* printUsageToStdout();
|
|
587
|
+
* exit(1);
|
|
588
|
+
* }
|
|
589
|
+
* ```
|
|
590
|
+
*
|
|
591
|
+
* The reason this is problematic is because writes to `process.stdout` in Node.js
|
|
592
|
+
* are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
|
|
593
|
+
* event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.
|
|
594
|
+
*
|
|
595
|
+
* Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding
|
|
596
|
+
* scheduling any additional work for the event loop:
|
|
597
|
+
*
|
|
598
|
+
* ```js
|
|
599
|
+
* import process from 'process';
|
|
600
|
+
*
|
|
601
|
+
* // How to properly set the exit code while letting
|
|
602
|
+
* // the process exit gracefully.
|
|
603
|
+
* if (someConditionNotMet()) {
|
|
604
|
+
* printUsageToStdout();
|
|
605
|
+
* process.exitCode = 1;
|
|
606
|
+
* }
|
|
607
|
+
* ```
|
|
608
|
+
*
|
|
609
|
+
* If it is necessary to terminate the Node.js process due to an error condition,
|
|
610
|
+
* throwing an _uncaught_ error and allowing the process to terminate accordingly
|
|
611
|
+
* is safer than calling `process.exit()`.
|
|
612
|
+
*
|
|
613
|
+
* In `Worker` threads, this function stops the current thread rather
|
|
614
|
+
* than the current process.
|
|
615
|
+
* @since v0.1.13
|
|
616
|
+
* @param [code=0] The exit code.
|
|
617
|
+
*/
|
|
254
618
|
exit(code?: number): never;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
619
|
+
/**
|
|
620
|
+
* A number which will be the process exit code, when the process either
|
|
621
|
+
* exits gracefully, or is exited via {@link exit} without specifying
|
|
622
|
+
* a code.
|
|
623
|
+
*
|
|
624
|
+
* Specifying a code to {@link exit} will override any
|
|
625
|
+
* previous setting of `process.exitCode`.
|
|
626
|
+
* @since v0.11.8
|
|
627
|
+
*/
|
|
628
|
+
exitCode?: number | undefined;
|
|
629
|
+
/**
|
|
630
|
+
* The `process.getgid()` method returns the numerical group identity of the
|
|
631
|
+
* process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
|
|
632
|
+
*
|
|
633
|
+
* ```js
|
|
634
|
+
* import process from 'process';
|
|
635
|
+
*
|
|
636
|
+
* if (process.getgid) {
|
|
637
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
638
|
+
* }
|
|
639
|
+
* ```
|
|
640
|
+
*
|
|
641
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
642
|
+
* Android).
|
|
643
|
+
* @since v0.1.31
|
|
644
|
+
*/
|
|
645
|
+
getgid?: () => number;
|
|
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
|
|
648
|
+
* numeric ID or a group name
|
|
649
|
+
* string. If a group name is specified, this method blocks while resolving the
|
|
650
|
+
* associated numeric ID.
|
|
651
|
+
*
|
|
652
|
+
* ```js
|
|
653
|
+
* import process from 'process';
|
|
654
|
+
*
|
|
655
|
+
* if (process.getgid && process.setgid) {
|
|
656
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
657
|
+
* try {
|
|
658
|
+
* process.setgid(501);
|
|
659
|
+
* console.log(`New gid: ${process.getgid()}`);
|
|
660
|
+
* } catch (err) {
|
|
661
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
662
|
+
* }
|
|
663
|
+
* }
|
|
664
|
+
* ```
|
|
665
|
+
*
|
|
666
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
667
|
+
* Android).
|
|
668
|
+
* This feature is not available in `Worker` threads.
|
|
669
|
+
* @since v0.1.31
|
|
670
|
+
* @param id The group name or ID
|
|
671
|
+
*/
|
|
672
|
+
setgid?: (id: number | string) => void;
|
|
673
|
+
/**
|
|
674
|
+
* The `process.getuid()` method returns the numeric user identity of the process.
|
|
675
|
+
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
|
676
|
+
*
|
|
677
|
+
* ```js
|
|
678
|
+
* import process from 'process';
|
|
679
|
+
*
|
|
680
|
+
* if (process.getuid) {
|
|
681
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
682
|
+
* }
|
|
683
|
+
* ```
|
|
684
|
+
*
|
|
685
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
686
|
+
* Android).
|
|
687
|
+
* @since v0.1.28
|
|
688
|
+
*/
|
|
689
|
+
getuid?: () => number;
|
|
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
|
|
692
|
+
* numeric ID or a username string.
|
|
693
|
+
* If a username is specified, the method blocks while resolving the associated
|
|
694
|
+
* numeric ID.
|
|
695
|
+
*
|
|
696
|
+
* ```js
|
|
697
|
+
* import process from 'process';
|
|
698
|
+
*
|
|
699
|
+
* if (process.getuid && process.setuid) {
|
|
700
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
701
|
+
* try {
|
|
702
|
+
* process.setuid(501);
|
|
703
|
+
* console.log(`New uid: ${process.getuid()}`);
|
|
704
|
+
* } catch (err) {
|
|
705
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
706
|
+
* }
|
|
707
|
+
* }
|
|
708
|
+
* ```
|
|
709
|
+
*
|
|
710
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
711
|
+
* Android).
|
|
712
|
+
* This feature is not available in `Worker` threads.
|
|
713
|
+
* @since v0.1.28
|
|
714
|
+
*/
|
|
715
|
+
setuid?: (id: number | string) => void;
|
|
716
|
+
/**
|
|
717
|
+
* The `process.geteuid()` method returns the numerical effective user identity of
|
|
718
|
+
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
|
719
|
+
*
|
|
720
|
+
* ```js
|
|
721
|
+
* import process from 'process';
|
|
722
|
+
*
|
|
723
|
+
* if (process.geteuid) {
|
|
724
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
725
|
+
* }
|
|
726
|
+
* ```
|
|
727
|
+
*
|
|
728
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
729
|
+
* Android).
|
|
730
|
+
* @since v2.0.0
|
|
731
|
+
*/
|
|
732
|
+
geteuid?: () => number;
|
|
733
|
+
/**
|
|
734
|
+
* The `process.seteuid()` method sets the effective user identity of the process.
|
|
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
|
|
736
|
+
* string. If a username is specified, the method blocks while resolving the
|
|
737
|
+
* associated numeric ID.
|
|
738
|
+
*
|
|
739
|
+
* ```js
|
|
740
|
+
* import process from 'process';
|
|
741
|
+
*
|
|
742
|
+
* if (process.geteuid && process.seteuid) {
|
|
743
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
744
|
+
* try {
|
|
745
|
+
* process.seteuid(501);
|
|
746
|
+
* console.log(`New uid: ${process.geteuid()}`);
|
|
747
|
+
* } catch (err) {
|
|
748
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
749
|
+
* }
|
|
750
|
+
* }
|
|
751
|
+
* ```
|
|
752
|
+
*
|
|
753
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
754
|
+
* Android).
|
|
755
|
+
* This feature is not available in `Worker` threads.
|
|
756
|
+
* @since v2.0.0
|
|
757
|
+
* @param id A user name or ID
|
|
758
|
+
*/
|
|
759
|
+
seteuid?: (id: number | string) => void;
|
|
760
|
+
/**
|
|
761
|
+
* The `process.getegid()` method returns the numerical effective group identity
|
|
762
|
+
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
|
763
|
+
*
|
|
764
|
+
* ```js
|
|
765
|
+
* import process from 'process';
|
|
766
|
+
*
|
|
767
|
+
* if (process.getegid) {
|
|
768
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
769
|
+
* }
|
|
770
|
+
* ```
|
|
771
|
+
*
|
|
772
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
773
|
+
* Android).
|
|
774
|
+
* @since v2.0.0
|
|
775
|
+
*/
|
|
776
|
+
getegid?: () => number;
|
|
777
|
+
/**
|
|
778
|
+
* The `process.setegid()` method sets the effective group identity of the process.
|
|
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
|
|
780
|
+
* name string. If a group name is specified, this method blocks while resolving
|
|
781
|
+
* the associated a numeric ID.
|
|
782
|
+
*
|
|
783
|
+
* ```js
|
|
784
|
+
* import process from 'process';
|
|
785
|
+
*
|
|
786
|
+
* if (process.getegid && process.setegid) {
|
|
787
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
788
|
+
* try {
|
|
789
|
+
* process.setegid(501);
|
|
790
|
+
* console.log(`New gid: ${process.getegid()}`);
|
|
791
|
+
* } catch (err) {
|
|
792
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
793
|
+
* }
|
|
794
|
+
* }
|
|
795
|
+
* ```
|
|
796
|
+
*
|
|
797
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
798
|
+
* Android).
|
|
799
|
+
* This feature is not available in `Worker` threads.
|
|
800
|
+
* @since v2.0.0
|
|
801
|
+
* @param id A group name or ID
|
|
802
|
+
*/
|
|
803
|
+
setegid?: (id: number | string) => void;
|
|
804
|
+
/**
|
|
805
|
+
* The `process.getgroups()` method returns an array with the supplementary group
|
|
806
|
+
* IDs. POSIX leaves it unspecified if the effective group ID is included but
|
|
807
|
+
* Node.js ensures it always is.
|
|
808
|
+
*
|
|
809
|
+
* ```js
|
|
810
|
+
* import process from 'process';
|
|
811
|
+
*
|
|
812
|
+
* if (process.getgroups) {
|
|
813
|
+
* console.log(process.getgroups()); // [ 16, 21, 297 ]
|
|
814
|
+
* }
|
|
815
|
+
* ```
|
|
816
|
+
*
|
|
817
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
818
|
+
* Android).
|
|
819
|
+
* @since v0.9.4
|
|
820
|
+
*/
|
|
821
|
+
getgroups?: () => number[];
|
|
822
|
+
/**
|
|
823
|
+
* The `process.setgroups()` method sets the supplementary group IDs for the
|
|
824
|
+
* Node.js process. This is a privileged operation that requires the Node.js
|
|
825
|
+
* process to have `root` or the `CAP_SETGID` capability.
|
|
826
|
+
*
|
|
827
|
+
* The `groups` array can contain numeric group IDs, group names, or both.
|
|
828
|
+
*
|
|
829
|
+
* ```js
|
|
830
|
+
* import process from 'process';
|
|
831
|
+
*
|
|
832
|
+
* if (process.getgroups && process.setgroups) {
|
|
833
|
+
* try {
|
|
834
|
+
* process.setgroups([501]);
|
|
835
|
+
* console.log(process.getgroups()); // new groups
|
|
836
|
+
* } catch (err) {
|
|
837
|
+
* console.log(`Failed to set groups: ${err}`);
|
|
838
|
+
* }
|
|
839
|
+
* }
|
|
840
|
+
* ```
|
|
841
|
+
*
|
|
842
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
843
|
+
* Android).
|
|
844
|
+
* This feature is not available in `Worker` threads.
|
|
845
|
+
* @since v0.9.4
|
|
846
|
+
*/
|
|
847
|
+
setgroups?: (groups: ReadonlyArray<string | number>) => void;
|
|
848
|
+
/**
|
|
849
|
+
* The `process.setUncaughtExceptionCaptureCallback()` function sets a function
|
|
850
|
+
* that will be invoked when an uncaught exception occurs, which will receive the
|
|
851
|
+
* exception value itself as its first argument.
|
|
852
|
+
*
|
|
853
|
+
* If such a function is set, the `'uncaughtException'` event will
|
|
854
|
+
* not be emitted. If `--abort-on-uncaught-exception` was passed from the
|
|
855
|
+
* command line or set through `v8.setFlagsFromString()`, the process will
|
|
856
|
+
* not abort. Actions configured to take place on exceptions such as report
|
|
857
|
+
* generations will be affected too
|
|
858
|
+
*
|
|
859
|
+
* To unset the capture function,`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this
|
|
860
|
+
* method with a non-`null` argument while another capture function is set will
|
|
861
|
+
* throw an error.
|
|
862
|
+
*
|
|
863
|
+
* Using this function is mutually exclusive with using the deprecated `domain` built-in module.
|
|
864
|
+
* @since v9.3.0
|
|
865
|
+
*/
|
|
266
866
|
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
|
867
|
+
/**
|
|
868
|
+
* Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}.
|
|
869
|
+
* @since v9.3.0
|
|
870
|
+
*/
|
|
267
871
|
hasUncaughtExceptionCaptureCallback(): boolean;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
872
|
+
/**
|
|
873
|
+
* The `process.version` property contains the Node.js version string.
|
|
874
|
+
*
|
|
875
|
+
* ```js
|
|
876
|
+
* import { version } from 'process';
|
|
877
|
+
*
|
|
878
|
+
* console.log(`Version: ${version}`);
|
|
879
|
+
* // Version: v14.8.0
|
|
880
|
+
* ```
|
|
881
|
+
*
|
|
882
|
+
* To get the version string without the prepended _v_, use`process.versions.node`.
|
|
883
|
+
* @since v0.1.3
|
|
884
|
+
*/
|
|
885
|
+
readonly version: string;
|
|
886
|
+
/**
|
|
887
|
+
* The `process.versions` property returns an object listing the version strings of
|
|
888
|
+
* Node.js and its dependencies. `process.versions.modules` indicates the current
|
|
889
|
+
* ABI version, which is increased whenever a C++ API changes. Node.js will refuse
|
|
890
|
+
* to load modules that were compiled against a different module ABI version.
|
|
891
|
+
*
|
|
892
|
+
* ```js
|
|
893
|
+
* import { versions } from 'process';
|
|
894
|
+
*
|
|
895
|
+
* console.log(versions);
|
|
896
|
+
* ```
|
|
897
|
+
*
|
|
898
|
+
* Will generate an object similar to:
|
|
899
|
+
*
|
|
900
|
+
* ```console
|
|
901
|
+
* { node: '11.13.0',
|
|
902
|
+
* v8: '7.0.276.38-node.18',
|
|
903
|
+
* uv: '1.27.0',
|
|
904
|
+
* zlib: '1.2.11',
|
|
905
|
+
* brotli: '1.0.7',
|
|
906
|
+
* ares: '1.15.0',
|
|
907
|
+
* modules: '67',
|
|
908
|
+
* nghttp2: '1.34.0',
|
|
909
|
+
* napi: '4',
|
|
910
|
+
* llhttp: '1.1.1',
|
|
911
|
+
* openssl: '1.1.1b',
|
|
912
|
+
* cldr: '34.0',
|
|
913
|
+
* icu: '63.1',
|
|
914
|
+
* tz: '2018e',
|
|
915
|
+
* unicode: '11.0' }
|
|
916
|
+
* ```
|
|
917
|
+
* @since v0.2.0
|
|
918
|
+
*/
|
|
919
|
+
readonly versions: ProcessVersions;
|
|
920
|
+
/**
|
|
921
|
+
* The `process.config` property returns an `Object` containing the JavaScript
|
|
922
|
+
* representation of the configure options used to compile the current Node.js
|
|
923
|
+
* executable. This is the same as the `config.gypi` file that was produced when
|
|
924
|
+
* running the `./configure` script.
|
|
925
|
+
*
|
|
926
|
+
* An example of the possible output looks like:
|
|
927
|
+
*
|
|
928
|
+
* ```js
|
|
929
|
+
* {
|
|
930
|
+
* target_defaults:
|
|
931
|
+
* { cflags: [],
|
|
932
|
+
* default_configuration: 'Release',
|
|
933
|
+
* defines: [],
|
|
934
|
+
* include_dirs: [],
|
|
935
|
+
* libraries: [] },
|
|
936
|
+
* variables:
|
|
937
|
+
* {
|
|
938
|
+
* host_arch: 'x64',
|
|
939
|
+
* napi_build_version: 5,
|
|
940
|
+
* node_install_npm: 'true',
|
|
941
|
+
* node_prefix: '',
|
|
942
|
+
* node_shared_cares: 'false',
|
|
943
|
+
* node_shared_http_parser: 'false',
|
|
944
|
+
* node_shared_libuv: 'false',
|
|
945
|
+
* node_shared_zlib: 'false',
|
|
946
|
+
* node_use_dtrace: 'false',
|
|
947
|
+
* node_use_openssl: 'true',
|
|
948
|
+
* node_shared_openssl: 'false',
|
|
949
|
+
* strict_aliasing: 'true',
|
|
950
|
+
* target_arch: 'x64',
|
|
951
|
+
* v8_use_snapshot: 1
|
|
952
|
+
* }
|
|
953
|
+
* }
|
|
954
|
+
* ```
|
|
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
|
+
* @since v0.7.7
|
|
963
|
+
*/
|
|
964
|
+
readonly config: ProcessConfig;
|
|
965
|
+
/**
|
|
966
|
+
* The `process.kill()` method sends the `signal` to the process identified by`pid`.
|
|
967
|
+
*
|
|
968
|
+
* Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information.
|
|
969
|
+
*
|
|
970
|
+
* This method will throw an error if the target `pid` does not exist. As a special
|
|
971
|
+
* case, a signal of `0` can be used to test for the existence of a process.
|
|
972
|
+
* Windows platforms will throw an error if the `pid` is used to kill a process
|
|
973
|
+
* group.
|
|
974
|
+
*
|
|
975
|
+
* Even though the name of this function is `process.kill()`, it is really just a
|
|
976
|
+
* signal sender, like the `kill` system call. The signal sent may do something
|
|
977
|
+
* other than kill the target process.
|
|
978
|
+
*
|
|
979
|
+
* ```js
|
|
980
|
+
* import process, { kill } from 'process';
|
|
981
|
+
*
|
|
982
|
+
* process.on('SIGHUP', () => {
|
|
983
|
+
* console.log('Got SIGHUP signal.');
|
|
984
|
+
* });
|
|
985
|
+
*
|
|
986
|
+
* setTimeout(() => {
|
|
987
|
+
* console.log('Exiting.');
|
|
988
|
+
* process.exit(0);
|
|
989
|
+
* }, 100);
|
|
990
|
+
*
|
|
991
|
+
* kill(process.pid, 'SIGHUP');
|
|
992
|
+
* ```
|
|
993
|
+
*
|
|
994
|
+
* When `SIGUSR1` is received by a Node.js process, Node.js will start the
|
|
995
|
+
* debugger. See `Signal Events`.
|
|
996
|
+
* @since v0.0.6
|
|
997
|
+
* @param pid A process ID
|
|
998
|
+
* @param [signal='SIGTERM'] The signal to send, either as a string or number.
|
|
999
|
+
*/
|
|
296
1000
|
kill(pid: number, signal?: string | number): true;
|
|
297
|
-
|
|
298
|
-
|
|
1001
|
+
/**
|
|
1002
|
+
* The `process.pid` property returns the PID of the process.
|
|
1003
|
+
*
|
|
1004
|
+
* ```js
|
|
1005
|
+
* import { pid } from 'process';
|
|
1006
|
+
*
|
|
1007
|
+
* console.log(`This process is pid ${pid}`);
|
|
1008
|
+
* ```
|
|
1009
|
+
* @since v0.1.15
|
|
1010
|
+
*/
|
|
1011
|
+
readonly pid: number;
|
|
1012
|
+
/**
|
|
1013
|
+
* The `process.ppid` property returns the PID of the parent of the
|
|
1014
|
+
* current process.
|
|
1015
|
+
*
|
|
1016
|
+
* ```js
|
|
1017
|
+
* import { ppid } from 'process';
|
|
1018
|
+
*
|
|
1019
|
+
* console.log(`The parent process is pid ${ppid}`);
|
|
1020
|
+
* ```
|
|
1021
|
+
* @since v9.2.0, v8.10.0, v6.13.0
|
|
1022
|
+
*/
|
|
1023
|
+
readonly ppid: number;
|
|
1024
|
+
/**
|
|
1025
|
+
* The `process.title` property returns the current process title (i.e. returns
|
|
1026
|
+
* the current value of `ps`). Assigning a new value to `process.title` modifies
|
|
1027
|
+
* the current value of `ps`.
|
|
1028
|
+
*
|
|
1029
|
+
* When a new value is assigned, different platforms will impose different maximum
|
|
1030
|
+
* length restrictions on the title. Usually such restrictions are quite limited.
|
|
1031
|
+
* For instance, on Linux and macOS, `process.title` is limited to the size of the
|
|
1032
|
+
* binary name plus the length of the command-line arguments because setting the`process.title` overwrites the `argv` memory of the process. Node.js v0.8
|
|
1033
|
+
* allowed for longer process title strings by also overwriting the `environ`memory but that was potentially insecure and confusing in some (rather obscure)
|
|
1034
|
+
* cases.
|
|
1035
|
+
*
|
|
1036
|
+
* Assigning a value to `process.title` might not result in an accurate label
|
|
1037
|
+
* within process manager applications such as macOS Activity Monitor or Windows
|
|
1038
|
+
* Services Manager.
|
|
1039
|
+
* @since v0.1.104
|
|
1040
|
+
*/
|
|
299
1041
|
title: string;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
1042
|
+
/**
|
|
1043
|
+
* The operating system CPU architecture for which the Node.js binary was compiled.
|
|
1044
|
+
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
|
|
1045
|
+
*
|
|
1046
|
+
* ```js
|
|
1047
|
+
* import { arch } from 'process';
|
|
1048
|
+
*
|
|
1049
|
+
* console.log(`This processor architecture is ${arch}`);
|
|
1050
|
+
* ```
|
|
1051
|
+
* @since v0.5.0
|
|
1052
|
+
*/
|
|
1053
|
+
readonly arch: Architecture;
|
|
1054
|
+
/**
|
|
1055
|
+
* The `process.platform` property returns a string identifying the operating
|
|
1056
|
+
* system platform for which the Node.js binary was compiled.
|
|
1057
|
+
*
|
|
1058
|
+
* Currently possible values are:
|
|
1059
|
+
*
|
|
1060
|
+
* * `'aix'`
|
|
1061
|
+
* * `'darwin'`
|
|
1062
|
+
* * `'freebsd'`
|
|
1063
|
+
* * `'linux'`
|
|
1064
|
+
* * `'openbsd'`
|
|
1065
|
+
* * `'sunos'`
|
|
1066
|
+
* * `'win32'`
|
|
1067
|
+
*
|
|
1068
|
+
* ```js
|
|
1069
|
+
* import { platform } from 'process';
|
|
1070
|
+
*
|
|
1071
|
+
* console.log(`This platform is ${platform}`);
|
|
1072
|
+
* ```
|
|
1073
|
+
*
|
|
1074
|
+
* The value `'android'` may also be returned if the Node.js is built on the
|
|
1075
|
+
* Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
|
|
1076
|
+
* @since v0.1.16
|
|
1077
|
+
*/
|
|
1078
|
+
readonly platform: Platform;
|
|
1079
|
+
/**
|
|
1080
|
+
* The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at
|
|
1081
|
+
* runtime, `require.main` may still refer to the original main module in
|
|
1082
|
+
* modules that were required before the change occurred. Generally, it's
|
|
1083
|
+
* safe to assume that the two refer to the same module.
|
|
1084
|
+
*
|
|
1085
|
+
* As with `require.main`, `process.mainModule` will be `undefined` if there
|
|
1086
|
+
* is no entry script.
|
|
1087
|
+
* @since v0.1.17
|
|
1088
|
+
* @deprecated Since v14.0.0 - Use `main` instead.
|
|
1089
|
+
*/
|
|
1090
|
+
mainModule?: Module | undefined;
|
|
304
1091
|
memoryUsage: MemoryUsageFn;
|
|
1092
|
+
/**
|
|
1093
|
+
* The `process.cpuUsage()` method returns the user and system CPU time usage of
|
|
1094
|
+
* the current process, in an object with properties `user` and `system`, whose
|
|
1095
|
+
* values are microsecond values (millionth of a second). These values measure time
|
|
1096
|
+
* spent in user and system code respectively, and may end up being greater than
|
|
1097
|
+
* actual elapsed time if multiple CPU cores are performing work for this process.
|
|
1098
|
+
*
|
|
1099
|
+
* The result of a previous call to `process.cpuUsage()` can be passed as the
|
|
1100
|
+
* argument to the function, to get a diff reading.
|
|
1101
|
+
*
|
|
1102
|
+
* ```js
|
|
1103
|
+
* import { cpuUsage } from 'process';
|
|
1104
|
+
*
|
|
1105
|
+
* const startUsage = cpuUsage();
|
|
1106
|
+
* // { user: 38579, system: 6986 }
|
|
1107
|
+
*
|
|
1108
|
+
* // spin the CPU for 500 milliseconds
|
|
1109
|
+
* const now = Date.now();
|
|
1110
|
+
* while (Date.now() - now < 500);
|
|
1111
|
+
*
|
|
1112
|
+
* console.log(cpuUsage(startUsage));
|
|
1113
|
+
* // { user: 514883, system: 11226 }
|
|
1114
|
+
* ```
|
|
1115
|
+
* @since v6.1.0
|
|
1116
|
+
* @param previousValue A previous return value from calling `process.cpuUsage()`
|
|
1117
|
+
*/
|
|
305
1118
|
cpuUsage(previousValue?: CpuUsage): CpuUsage;
|
|
1119
|
+
/**
|
|
1120
|
+
* `process.nextTick()` adds `callback` to the "next tick queue". This queue is
|
|
1121
|
+
* fully drained after the current operation on the JavaScript stack runs to
|
|
1122
|
+
* completion and before the event loop is allowed to continue. It's possible to
|
|
1123
|
+
* create an infinite loop if one were to recursively call `process.nextTick()`.
|
|
1124
|
+
* See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
|
|
1125
|
+
*
|
|
1126
|
+
* ```js
|
|
1127
|
+
* import { nextTick } from 'process';
|
|
1128
|
+
*
|
|
1129
|
+
* console.log('start');
|
|
1130
|
+
* nextTick(() => {
|
|
1131
|
+
* console.log('nextTick callback');
|
|
1132
|
+
* });
|
|
1133
|
+
* console.log('scheduled');
|
|
1134
|
+
* // Output:
|
|
1135
|
+
* // start
|
|
1136
|
+
* // scheduled
|
|
1137
|
+
* // nextTick callback
|
|
1138
|
+
* ```
|
|
1139
|
+
*
|
|
1140
|
+
* This is important when developing APIs in order to give users the opportunity
|
|
1141
|
+
* to assign event handlers _after_ an object has been constructed but before any
|
|
1142
|
+
* I/O has occurred:
|
|
1143
|
+
*
|
|
1144
|
+
* ```js
|
|
1145
|
+
* import { nextTick } from 'process';
|
|
1146
|
+
*
|
|
1147
|
+
* function MyThing(options) {
|
|
1148
|
+
* this.setupOptions(options);
|
|
1149
|
+
*
|
|
1150
|
+
* nextTick(() => {
|
|
1151
|
+
* this.startDoingStuff();
|
|
1152
|
+
* });
|
|
1153
|
+
* }
|
|
1154
|
+
*
|
|
1155
|
+
* const thing = new MyThing();
|
|
1156
|
+
* thing.getReadyForStuff();
|
|
1157
|
+
*
|
|
1158
|
+
* // thing.startDoingStuff() gets called now, not before.
|
|
1159
|
+
* ```
|
|
1160
|
+
*
|
|
1161
|
+
* It is very important for APIs to be either 100% synchronous or 100%
|
|
1162
|
+
* asynchronous. Consider this example:
|
|
1163
|
+
*
|
|
1164
|
+
* ```js
|
|
1165
|
+
* // WARNING! DO NOT USE! BAD UNSAFE HAZARD!
|
|
1166
|
+
* function maybeSync(arg, cb) {
|
|
1167
|
+
* if (arg) {
|
|
1168
|
+
* cb();
|
|
1169
|
+
* return;
|
|
1170
|
+
* }
|
|
1171
|
+
*
|
|
1172
|
+
* fs.stat('file', cb);
|
|
1173
|
+
* }
|
|
1174
|
+
* ```
|
|
1175
|
+
*
|
|
1176
|
+
* This API is hazardous because in the following case:
|
|
1177
|
+
*
|
|
1178
|
+
* ```js
|
|
1179
|
+
* const maybeTrue = Math.random() > 0.5;
|
|
1180
|
+
*
|
|
1181
|
+
* maybeSync(maybeTrue, () => {
|
|
1182
|
+
* foo();
|
|
1183
|
+
* });
|
|
1184
|
+
*
|
|
1185
|
+
* bar();
|
|
1186
|
+
* ```
|
|
1187
|
+
*
|
|
1188
|
+
* It is not clear whether `foo()` or `bar()` will be called first.
|
|
1189
|
+
*
|
|
1190
|
+
* The following approach is much better:
|
|
1191
|
+
*
|
|
1192
|
+
* ```js
|
|
1193
|
+
* import { nextTick } from 'process';
|
|
1194
|
+
*
|
|
1195
|
+
* function definitelyAsync(arg, cb) {
|
|
1196
|
+
* if (arg) {
|
|
1197
|
+
* nextTick(cb);
|
|
1198
|
+
* return;
|
|
1199
|
+
* }
|
|
1200
|
+
*
|
|
1201
|
+
* fs.stat('file', cb);
|
|
1202
|
+
* }
|
|
1203
|
+
* ```
|
|
1204
|
+
* @since v0.1.26
|
|
1205
|
+
* @param args Additional arguments to pass when invoking the `callback`
|
|
1206
|
+
*/
|
|
306
1207
|
nextTick(callback: Function, ...args: any[]): void;
|
|
307
|
-
|
|
1208
|
+
/**
|
|
1209
|
+
* The `process.release` property returns an `Object` containing metadata related
|
|
1210
|
+
* to the current release, including URLs for the source tarball and headers-only
|
|
1211
|
+
* tarball.
|
|
1212
|
+
*
|
|
1213
|
+
* `process.release` contains the following properties:
|
|
1214
|
+
*
|
|
1215
|
+
* ```js
|
|
1216
|
+
* {
|
|
1217
|
+
* name: 'node',
|
|
1218
|
+
* lts: 'Erbium',
|
|
1219
|
+
* sourceUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1.tar.gz',
|
|
1220
|
+
* headersUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1-headers.tar.gz',
|
|
1221
|
+
* libUrl: 'https://nodejs.org/download/release/v12.18.1/win-x64/node.lib'
|
|
1222
|
+
* }
|
|
1223
|
+
* ```
|
|
1224
|
+
*
|
|
1225
|
+
* In custom builds from non-release versions of the source tree, only the`name` property may be present. The additional properties should not be
|
|
1226
|
+
* relied upon to exist.
|
|
1227
|
+
* @since v3.0.0
|
|
1228
|
+
*/
|
|
1229
|
+
readonly release: ProcessRelease;
|
|
308
1230
|
features: {
|
|
309
1231
|
inspector: boolean;
|
|
310
1232
|
debug: boolean;
|
|
@@ -316,146 +1238,245 @@ declare module 'process' {
|
|
|
316
1238
|
tls: boolean;
|
|
317
1239
|
};
|
|
318
1240
|
/**
|
|
319
|
-
*
|
|
320
|
-
* the
|
|
321
|
-
*
|
|
1241
|
+
* `process.umask()` returns the Node.js process's file mode creation mask. Child
|
|
1242
|
+
* processes inherit the mask from the parent process.
|
|
1243
|
+
* @since v0.1.19
|
|
1244
|
+
* @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential *
|
|
1245
|
+
* security vulnerability. There is no safe, cross-platform alternative API.
|
|
322
1246
|
*/
|
|
323
1247
|
umask(): number;
|
|
324
1248
|
/**
|
|
325
1249
|
* Can only be set if not in worker thread.
|
|
326
1250
|
*/
|
|
327
1251
|
umask(mask: string | number): number;
|
|
1252
|
+
/**
|
|
1253
|
+
* The `process.uptime()` method returns the number of seconds the current Node.js
|
|
1254
|
+
* process has been running.
|
|
1255
|
+
*
|
|
1256
|
+
* The return value includes fractions of a second. Use `Math.floor()` to get whole
|
|
1257
|
+
* seconds.
|
|
1258
|
+
* @since v0.5.0
|
|
1259
|
+
*/
|
|
328
1260
|
uptime(): number;
|
|
329
1261
|
hrtime: HRTime;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
1262
|
+
/**
|
|
1263
|
+
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
|
|
1264
|
+
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
|
|
1265
|
+
*
|
|
1266
|
+
* If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`.
|
|
1267
|
+
*
|
|
1268
|
+
* The message goes through serialization and parsing. The resulting message might
|
|
1269
|
+
* not be the same as what is originally sent.
|
|
1270
|
+
* @since v0.5.9
|
|
1271
|
+
* @param options used to parameterize the sending of certain types of handles.`options` supports the following properties:
|
|
1272
|
+
*/
|
|
1273
|
+
send?(
|
|
1274
|
+
message: any,
|
|
1275
|
+
sendHandle?: any,
|
|
1276
|
+
options?: {
|
|
1277
|
+
swallowErrors?: boolean | undefined;
|
|
1278
|
+
},
|
|
1279
|
+
callback?: (error: Error | null) => void
|
|
1280
|
+
): boolean;
|
|
1281
|
+
/**
|
|
1282
|
+
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the
|
|
1283
|
+
* IPC channel to the parent process, allowing the child process to exit gracefully
|
|
1284
|
+
* once there are no other connections keeping it alive.
|
|
1285
|
+
*
|
|
1286
|
+
* The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process.
|
|
1287
|
+
*
|
|
1288
|
+
* If the Node.js process was not spawned with an IPC channel,`process.disconnect()` will be `undefined`.
|
|
1289
|
+
* @since v0.7.2
|
|
1290
|
+
*/
|
|
334
1291
|
disconnect(): void;
|
|
1292
|
+
/**
|
|
1293
|
+
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return`true` so long as the IPC
|
|
1294
|
+
* channel is connected and will return `false` after`process.disconnect()` is called.
|
|
1295
|
+
*
|
|
1296
|
+
* Once `process.connected` is `false`, it is no longer possible to send messages
|
|
1297
|
+
* over the IPC channel using `process.send()`.
|
|
1298
|
+
* @since v0.7.2
|
|
1299
|
+
*/
|
|
335
1300
|
connected: boolean;
|
|
336
|
-
|
|
337
1301
|
/**
|
|
338
1302
|
* The `process.allowedNodeEnvironmentFlags` property is a special,
|
|
339
|
-
* read-only `Set` of flags allowable within the `NODE_OPTIONS`
|
|
340
|
-
*
|
|
1303
|
+
* read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable.
|
|
1304
|
+
*
|
|
1305
|
+
* `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides`Set.prototype.has` to recognize several different possible flag
|
|
1306
|
+
* representations. `process.allowedNodeEnvironmentFlags.has()` will
|
|
1307
|
+
* return `true` in the following cases:
|
|
1308
|
+
*
|
|
1309
|
+
* * Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,`inspect-brk` for `--inspect-brk`, or `r` for `-r`.
|
|
1310
|
+
* * Flags passed through to V8 (as listed in `--v8-options`) may replace
|
|
1311
|
+
* one or more _non-leading_ dashes for an underscore, or vice-versa;
|
|
1312
|
+
* e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`,
|
|
1313
|
+
* etc.
|
|
1314
|
+
* * Flags may contain one or more equals (`=`) characters; all
|
|
1315
|
+
* characters after and including the first equals will be ignored;
|
|
1316
|
+
* e.g., `--stack-trace-limit=100`.
|
|
1317
|
+
* * Flags _must_ be allowable within `NODE_OPTIONS`.
|
|
1318
|
+
*
|
|
1319
|
+
* When iterating over `process.allowedNodeEnvironmentFlags`, flags will
|
|
1320
|
+
* appear only _once_; each will begin with one or more dashes. Flags
|
|
1321
|
+
* passed through to V8 will contain underscores instead of non-leading
|
|
1322
|
+
* dashes:
|
|
1323
|
+
*
|
|
1324
|
+
* ```js
|
|
1325
|
+
* import { allowedNodeEnvironmentFlags } from 'process';
|
|
1326
|
+
*
|
|
1327
|
+
* allowedNodeEnvironmentFlags.forEach((flag) => {
|
|
1328
|
+
* // -r
|
|
1329
|
+
* // --inspect-brk
|
|
1330
|
+
* // --abort_on_uncaught_exception
|
|
1331
|
+
* // ...
|
|
1332
|
+
* });
|
|
1333
|
+
* ```
|
|
1334
|
+
*
|
|
1335
|
+
* The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail
|
|
1336
|
+
* silently.
|
|
1337
|
+
*
|
|
1338
|
+
* If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will
|
|
1339
|
+
* contain what _would have_ been allowable.
|
|
1340
|
+
* @since v10.10.0
|
|
341
1341
|
*/
|
|
342
1342
|
allowedNodeEnvironmentFlags: ReadonlySet<string>;
|
|
343
|
-
|
|
344
1343
|
/**
|
|
345
|
-
*
|
|
1344
|
+
* `process.report` is an object whose methods are used to generate diagnostic
|
|
1345
|
+
* reports for the current process. Additional documentation is available in the `report documentation`.
|
|
1346
|
+
* @since v11.8.0
|
|
1347
|
+
*/
|
|
1348
|
+
report?: ProcessReport | undefined;
|
|
1349
|
+
/**
|
|
1350
|
+
* ```js
|
|
1351
|
+
* import { resourceUsage } from 'process';
|
|
1352
|
+
*
|
|
1353
|
+
* console.log(resourceUsage());
|
|
1354
|
+
* /*
|
|
1355
|
+
* Will output:
|
|
1356
|
+
* {
|
|
1357
|
+
* userCPUTime: 82872,
|
|
1358
|
+
* systemCPUTime: 4143,
|
|
1359
|
+
* maxRSS: 33164,
|
|
1360
|
+
* sharedMemorySize: 0,
|
|
1361
|
+
* unsharedDataSize: 0,
|
|
1362
|
+
* unsharedStackSize: 0,
|
|
1363
|
+
* minorPageFault: 2469,
|
|
1364
|
+
* majorPageFault: 0,
|
|
1365
|
+
* swappedOut: 0,
|
|
1366
|
+
* fsRead: 0,
|
|
1367
|
+
* fsWrite: 8,
|
|
1368
|
+
* ipcSent: 0,
|
|
1369
|
+
* ipcReceived: 0,
|
|
1370
|
+
* signalsCount: 0,
|
|
1371
|
+
* voluntaryContextSwitches: 79,
|
|
1372
|
+
* involuntaryContextSwitches: 1
|
|
1373
|
+
* }
|
|
1374
|
+
*
|
|
1375
|
+
* ```
|
|
1376
|
+
* @since v12.6.0
|
|
1377
|
+
* @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t].
|
|
346
1378
|
*/
|
|
347
|
-
report?: ProcessReport;
|
|
348
|
-
|
|
349
1379
|
resourceUsage(): ResourceUsage;
|
|
350
|
-
|
|
1380
|
+
/**
|
|
1381
|
+
* The `process.traceDeprecation` property indicates whether the`--trace-deprecation` flag is set on the current Node.js process. See the
|
|
1382
|
+
* documentation for the `'warning' event` and the `emitWarning() method` for more information about this
|
|
1383
|
+
* flag's behavior.
|
|
1384
|
+
* @since v0.8.0
|
|
1385
|
+
*/
|
|
351
1386
|
traceDeprecation: boolean;
|
|
352
|
-
|
|
353
1387
|
/* EventEmitter */
|
|
354
|
-
addListener(event:
|
|
355
|
-
addListener(event:
|
|
356
|
-
addListener(event:
|
|
357
|
-
addListener(event:
|
|
358
|
-
addListener(event:
|
|
359
|
-
addListener(event:
|
|
360
|
-
addListener(event:
|
|
361
|
-
addListener(event:
|
|
362
|
-
addListener(event:
|
|
1388
|
+
addListener(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1389
|
+
addListener(event: 'disconnect', listener: DisconnectListener): this;
|
|
1390
|
+
addListener(event: 'exit', listener: ExitListener): this;
|
|
1391
|
+
addListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1392
|
+
addListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1393
|
+
addListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1394
|
+
addListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1395
|
+
addListener(event: 'warning', listener: WarningListener): this;
|
|
1396
|
+
addListener(event: 'message', listener: MessageListener): this;
|
|
363
1397
|
addListener(event: Signals, listener: SignalsListener): this;
|
|
364
|
-
addListener(event:
|
|
365
|
-
addListener(event:
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
emit(event:
|
|
369
|
-
emit(event:
|
|
370
|
-
emit(event:
|
|
371
|
-
emit(event:
|
|
372
|
-
emit(event:
|
|
373
|
-
emit(event:
|
|
374
|
-
emit(event:
|
|
375
|
-
emit(event:
|
|
376
|
-
emit(event:
|
|
377
|
-
emit(event:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
on(event:
|
|
383
|
-
on(event:
|
|
384
|
-
on(event:
|
|
385
|
-
on(event:
|
|
386
|
-
on(event:
|
|
387
|
-
on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
|
388
|
-
on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
|
389
|
-
on(event: "warning", listener: WarningListener): this;
|
|
390
|
-
on(event: "message", listener: MessageListener): this;
|
|
1398
|
+
addListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1399
|
+
addListener(event: 'worker', listener: WorkerListener): this;
|
|
1400
|
+
emit(event: 'beforeExit', code: number): boolean;
|
|
1401
|
+
emit(event: 'disconnect'): boolean;
|
|
1402
|
+
emit(event: 'exit', code: number): boolean;
|
|
1403
|
+
emit(event: 'rejectionHandled', promise: Promise<unknown>): boolean;
|
|
1404
|
+
emit(event: 'uncaughtException', error: Error): boolean;
|
|
1405
|
+
emit(event: 'uncaughtExceptionMonitor', error: Error): boolean;
|
|
1406
|
+
emit(event: 'unhandledRejection', reason: unknown, promise: Promise<unknown>): boolean;
|
|
1407
|
+
emit(event: 'warning', warning: Error): boolean;
|
|
1408
|
+
emit(event: 'message', message: unknown, sendHandle: unknown): this;
|
|
1409
|
+
emit(event: Signals, signal?: Signals): boolean;
|
|
1410
|
+
emit(event: 'multipleResolves', type: MultipleResolveType, promise: Promise<unknown>, value: unknown): this;
|
|
1411
|
+
emit(event: 'worker', listener: WorkerListener): this;
|
|
1412
|
+
on(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1413
|
+
on(event: 'disconnect', listener: DisconnectListener): this;
|
|
1414
|
+
on(event: 'exit', listener: ExitListener): this;
|
|
1415
|
+
on(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1416
|
+
on(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1417
|
+
on(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1418
|
+
on(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1419
|
+
on(event: 'warning', listener: WarningListener): this;
|
|
1420
|
+
on(event: 'message', listener: MessageListener): this;
|
|
391
1421
|
on(event: Signals, listener: SignalsListener): this;
|
|
392
|
-
on(event:
|
|
393
|
-
on(event:
|
|
394
|
-
on(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
1422
|
+
on(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1423
|
+
on(event: 'worker', listener: WorkerListener): this;
|
|
395
1424
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
396
|
-
|
|
397
|
-
once(event:
|
|
398
|
-
once(event:
|
|
399
|
-
once(event:
|
|
400
|
-
once(event:
|
|
401
|
-
once(event:
|
|
402
|
-
once(event:
|
|
403
|
-
once(event:
|
|
404
|
-
once(event:
|
|
405
|
-
once(event: "message", listener: MessageListener): this;
|
|
1425
|
+
once(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1426
|
+
once(event: 'disconnect', listener: DisconnectListener): this;
|
|
1427
|
+
once(event: 'exit', listener: ExitListener): this;
|
|
1428
|
+
once(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1429
|
+
once(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1430
|
+
once(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1431
|
+
once(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1432
|
+
once(event: 'warning', listener: WarningListener): this;
|
|
1433
|
+
once(event: 'message', listener: MessageListener): this;
|
|
406
1434
|
once(event: Signals, listener: SignalsListener): this;
|
|
407
|
-
once(event:
|
|
408
|
-
once(event:
|
|
409
|
-
once(event:
|
|
410
|
-
|
|
411
|
-
prependListener(event:
|
|
412
|
-
prependListener(event:
|
|
413
|
-
prependListener(event:
|
|
414
|
-
prependListener(event:
|
|
415
|
-
prependListener(event:
|
|
416
|
-
prependListener(event:
|
|
417
|
-
prependListener(event:
|
|
418
|
-
prependListener(event:
|
|
419
|
-
prependListener(event: "message", listener: MessageListener): this;
|
|
1435
|
+
once(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1436
|
+
once(event: 'worker', listener: WorkerListener): this;
|
|
1437
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1438
|
+
prependListener(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1439
|
+
prependListener(event: 'disconnect', listener: DisconnectListener): this;
|
|
1440
|
+
prependListener(event: 'exit', listener: ExitListener): this;
|
|
1441
|
+
prependListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1442
|
+
prependListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1443
|
+
prependListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1444
|
+
prependListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1445
|
+
prependListener(event: 'warning', listener: WarningListener): this;
|
|
1446
|
+
prependListener(event: 'message', listener: MessageListener): this;
|
|
420
1447
|
prependListener(event: Signals, listener: SignalsListener): this;
|
|
421
|
-
prependListener(event:
|
|
422
|
-
prependListener(event:
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
prependOnceListener(event:
|
|
426
|
-
prependOnceListener(event:
|
|
427
|
-
prependOnceListener(event:
|
|
428
|
-
prependOnceListener(event:
|
|
429
|
-
prependOnceListener(event:
|
|
430
|
-
prependOnceListener(event:
|
|
431
|
-
prependOnceListener(event:
|
|
432
|
-
prependOnceListener(event: "warning", listener: WarningListener): this;
|
|
433
|
-
prependOnceListener(event: "message", listener: MessageListener): this;
|
|
1448
|
+
prependListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1449
|
+
prependListener(event: 'worker', listener: WorkerListener): this;
|
|
1450
|
+
prependOnceListener(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1451
|
+
prependOnceListener(event: 'disconnect', listener: DisconnectListener): this;
|
|
1452
|
+
prependOnceListener(event: 'exit', listener: ExitListener): this;
|
|
1453
|
+
prependOnceListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1454
|
+
prependOnceListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1455
|
+
prependOnceListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1456
|
+
prependOnceListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1457
|
+
prependOnceListener(event: 'warning', listener: WarningListener): this;
|
|
1458
|
+
prependOnceListener(event: 'message', listener: MessageListener): this;
|
|
434
1459
|
prependOnceListener(event: Signals, listener: SignalsListener): this;
|
|
435
|
-
prependOnceListener(event:
|
|
436
|
-
prependOnceListener(event:
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
listeners(event:
|
|
440
|
-
listeners(event:
|
|
441
|
-
listeners(event:
|
|
442
|
-
listeners(event:
|
|
443
|
-
listeners(event:
|
|
444
|
-
listeners(event:
|
|
445
|
-
listeners(event:
|
|
446
|
-
listeners(event: "warning"): WarningListener[];
|
|
447
|
-
listeners(event: "message"): MessageListener[];
|
|
1460
|
+
prependOnceListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1461
|
+
prependOnceListener(event: 'worker', listener: WorkerListener): this;
|
|
1462
|
+
listeners(event: 'beforeExit'): BeforeExitListener[];
|
|
1463
|
+
listeners(event: 'disconnect'): DisconnectListener[];
|
|
1464
|
+
listeners(event: 'exit'): ExitListener[];
|
|
1465
|
+
listeners(event: 'rejectionHandled'): RejectionHandledListener[];
|
|
1466
|
+
listeners(event: 'uncaughtException'): UncaughtExceptionListener[];
|
|
1467
|
+
listeners(event: 'uncaughtExceptionMonitor'): UncaughtExceptionListener[];
|
|
1468
|
+
listeners(event: 'unhandledRejection'): UnhandledRejectionListener[];
|
|
1469
|
+
listeners(event: 'warning'): WarningListener[];
|
|
1470
|
+
listeners(event: 'message'): MessageListener[];
|
|
448
1471
|
listeners(event: Signals): SignalsListener[];
|
|
449
|
-
listeners(event:
|
|
450
|
-
listeners(event:
|
|
451
|
-
listeners(event: "multipleResolves"): MultipleResolveListener[];
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
interface Global {
|
|
455
|
-
process: Process;
|
|
1472
|
+
listeners(event: 'multipleResolves'): MultipleResolveListener[];
|
|
1473
|
+
listeners(event: 'worker'): WorkerListener[];
|
|
456
1474
|
}
|
|
457
1475
|
}
|
|
458
1476
|
}
|
|
459
|
-
|
|
1477
|
+
export = process;
|
|
1478
|
+
}
|
|
1479
|
+
declare module 'node:process' {
|
|
1480
|
+
import process = require('process');
|
|
460
1481
|
export = process;
|
|
461
1482
|
}
|