codemod 2.0.0-alpha.1 → 2.0.0-alpha.3
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/README.md +56 -2
- package/codemod +17 -30
- package/package.json +80 -10
- package/register.d.mts +2 -0
- package/register.mjs +67 -0
- package/runtime/addon.d.mts +114 -0
- package/runtime/addon.mjs +55 -0
- package/runtime/ast-grep.d.mts +20 -0
- package/runtime/ast-grep.mjs +82 -0
- package/runtime/context.d.mts +49 -0
- package/runtime/context.mjs +59 -0
- package/runtime/hooks.d.mts +2 -0
- package/runtime/hooks.mjs +7 -0
- package/runtime/host.d.mts +121 -0
- package/runtime/host.mjs +450 -0
- package/runtime/llm.d.mts +2 -0
- package/runtime/llm.mjs +5 -0
- package/runtime/metrics.d.mts +9 -0
- package/runtime/metrics.mjs +42 -0
- package/runtime/modules.d.mts +3 -0
- package/runtime/modules.mjs +17 -0
- package/runtime/orchestrator-version.d.mts +2 -0
- package/runtime/orchestrator-version.mjs +3 -0
- package/runtime/orchestrator.d.mts +261 -0
- package/runtime/orchestrator.mjs +879 -0
- package/runtime/runtime.d.mts +15 -0
- package/runtime/runtime.mjs +40 -0
- package/runtime/workflow.d.mts +19 -0
- package/runtime/workflow.mjs +126 -0
- package/testing/index.d.mts +157 -0
- package/testing/index.mjs +648 -0
- package/types/index.d.ts +8 -0
- package/types/langs/angular.d.ts +5 -0
- package/types/langs/c.d.ts +5 -0
- package/types/langs/c_sharp.d.ts +5 -0
- package/types/langs/cpp.d.ts +5 -0
- package/types/langs/css.d.ts +5 -0
- package/types/langs/elixir.d.ts +5 -0
- package/types/langs/go.d.ts +5 -0
- package/types/langs/html.d.ts +5 -0
- package/types/langs/java.d.ts +5 -0
- package/types/langs/javascript.d.ts +5 -0
- package/types/langs/json.d.ts +5 -0
- package/types/langs/kotlin.d.ts +5 -0
- package/types/langs/package.json +3 -0
- package/types/langs/php.d.ts +5 -0
- package/types/langs/python.d.ts +5 -0
- package/types/langs/ruby.d.ts +5 -0
- package/types/langs/rust.d.ts +5 -0
- package/types/langs/scala.d.ts +5 -0
- package/types/langs/toml.d.ts +5 -0
- package/types/langs/tsx.d.ts +5 -0
- package/types/langs/typescript.d.ts +5 -0
- package/types/langs/xml.d.ts +5 -0
- package/types/langs/yaml.d.ts +5 -0
- package/types/llm.d.ts +6 -0
- package/types/llrt/abort.d.ts +69 -0
- package/types/llrt/assert.d.ts +39 -0
- package/types/llrt/async_hooks.d.ts +210 -0
- package/types/llrt/buffer.d.ts +1186 -0
- package/types/llrt/child_process.d.ts +447 -0
- package/types/llrt/console.d.ts +210 -0
- package/types/llrt/crypto.d.ts +854 -0
- package/types/llrt/dgram.d.ts +381 -0
- package/types/llrt/dns.d.ts +124 -0
- package/types/llrt/dom-events.d.ts +51 -0
- package/types/llrt/events.d.ts +245 -0
- package/types/llrt/exceptions.d.ts +26 -0
- package/types/llrt/fetch.d.ts +332 -0
- package/types/llrt/fs/promises.d.ts +554 -0
- package/types/llrt/fs.d.ts +360 -0
- package/types/llrt/globals.d.ts +23 -0
- package/types/llrt/https.d.ts +27 -0
- package/types/llrt/index.d.ts +33 -0
- package/types/llrt/module.d.ts +285 -0
- package/types/llrt/navigator.d.ts +9 -0
- package/types/llrt/net.d.ts +488 -0
- package/types/llrt/os.d.ts +293 -0
- package/types/llrt/path.d.ts +150 -0
- package/types/llrt/perf_hooks.d.ts +23 -0
- package/types/llrt/process.d.ts +502 -0
- package/types/llrt/stream/web.d.ts +526 -0
- package/types/llrt/stream.d.ts +366 -0
- package/types/llrt/string_decoder.d.ts +63 -0
- package/types/llrt/timers.d.ts +72 -0
- package/types/llrt/timezone.d.ts +101 -0
- package/types/llrt/tty.d.ts +11 -0
- package/types/llrt/url.d.ts +774 -0
- package/types/llrt/util.d.ts +240 -0
- package/types/llrt/zlib.d.ts +177 -0
- package/types/main.d.ts +5 -0
- package/types/metrics.d.ts +5 -0
- package/types/modules/ast-grep.d.ts +634 -0
- package/types/modules/langs.d.ts +87 -0
- package/types/modules/llm.d.ts +23 -0
- package/types/modules/metrics.d.ts +107 -0
- package/types/modules/runtime.d.ts +66 -0
- package/types/modules/workflow.d.ts +915 -0
- package/types/runtime.d.ts +6 -0
- package/types/workflow.d.ts +5 -0
- package/vite.d.mts +7 -0
- package/vite.mjs +32 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
declare module "process" {
|
|
2
|
+
import { EventEmitter } from "events";
|
|
3
|
+
|
|
4
|
+
global {
|
|
5
|
+
var process: Process;
|
|
6
|
+
|
|
7
|
+
namespace QuickJS {
|
|
8
|
+
type Signals =
|
|
9
|
+
| "SIGABRT"
|
|
10
|
+
| "SIGALRM"
|
|
11
|
+
| "SIGFPE"
|
|
12
|
+
| "SIGHUP"
|
|
13
|
+
| "SIGILL"
|
|
14
|
+
| "SIGINT"
|
|
15
|
+
| "SIGKILL"
|
|
16
|
+
| "SIGPIPE"
|
|
17
|
+
| "SIGQUIT"
|
|
18
|
+
| "SIGSEGV"
|
|
19
|
+
| "SIGTERM";
|
|
20
|
+
}
|
|
21
|
+
type Platform = "darwin" | "linux" | "win32";
|
|
22
|
+
type Architecture = "arm64" | "x64";
|
|
23
|
+
}
|
|
24
|
+
interface Dict<T> {
|
|
25
|
+
[key: string]: T | undefined;
|
|
26
|
+
}
|
|
27
|
+
// Alias for compatibility
|
|
28
|
+
interface ProcessEnv extends Dict<string> {}
|
|
29
|
+
interface HRTime {
|
|
30
|
+
(): [number, number];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The `bigint` version of the `{@link process.hrtime()}` method returning the current high-resolution real time in nanoseconds as a `bigint`.
|
|
34
|
+
*/
|
|
35
|
+
bigint(): bigint;
|
|
36
|
+
}
|
|
37
|
+
interface ProcessRelease {
|
|
38
|
+
name: string;
|
|
39
|
+
}
|
|
40
|
+
interface ProcessVersions extends Dict<string> {
|
|
41
|
+
llrt: string;
|
|
42
|
+
}
|
|
43
|
+
interface Process extends EventEmitter {
|
|
44
|
+
hrtime: HRTime;
|
|
45
|
+
/**
|
|
46
|
+
* The `process.cwd()` method returns the current working directory of the llrt
|
|
47
|
+
* process.
|
|
48
|
+
*
|
|
49
|
+
* ```js
|
|
50
|
+
* import { cwd } from 'process';
|
|
51
|
+
*
|
|
52
|
+
* console.log(`Current directory: ${cwd()}`);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
cwd(): string;
|
|
56
|
+
/**
|
|
57
|
+
* The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when llrt starts.
|
|
58
|
+
*
|
|
59
|
+
* ```console
|
|
60
|
+
* $ ./llrt -e 'console.log(process.argv[0])'
|
|
61
|
+
* ./llrt
|
|
62
|
+
* $ ./llrt -e 'console.log(process.argv0)'
|
|
63
|
+
* ./llrt
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
argv0: string;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the OS-assigned process identifier associated with this process.
|
|
69
|
+
*/
|
|
70
|
+
id: number;
|
|
71
|
+
/**
|
|
72
|
+
* The `process.argv` property returns an array containing the command-line
|
|
73
|
+
* arguments passed when the llrt process was launched. The first element will
|
|
74
|
+
* be {@link execPath}. See `process.argv0` if access to the original value
|
|
75
|
+
* of `argv[0]` is needed. The second element will be the path to the JavaScript
|
|
76
|
+
* file being executed. The remaining elements will be any additional command-line
|
|
77
|
+
* arguments.
|
|
78
|
+
*
|
|
79
|
+
* For example, assuming the following script for `process-args.js`:
|
|
80
|
+
*
|
|
81
|
+
* ```js
|
|
82
|
+
* import { argv } from 'process';
|
|
83
|
+
*
|
|
84
|
+
* // print process.argv
|
|
85
|
+
* argv.forEach((val, index) => {
|
|
86
|
+
* console.log(`${index}: ${val}`);
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
argv: string[];
|
|
92
|
+
/**
|
|
93
|
+
* The operating system CPU architecture for which the llrt binary was compiled.
|
|
94
|
+
* Possible values are: `'arm64'` and `'x64'`.
|
|
95
|
+
*
|
|
96
|
+
* ```js
|
|
97
|
+
* import { arch } from 'process';
|
|
98
|
+
*
|
|
99
|
+
* console.log(`This processor architecture is ${arch}`);
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
readonly arch: Architecture;
|
|
103
|
+
/**
|
|
104
|
+
* The `process.platform` property returns a string identifying the operating
|
|
105
|
+
* system platform for which the llrt binary was compiled.
|
|
106
|
+
*
|
|
107
|
+
* Currently possible values are:
|
|
108
|
+
*
|
|
109
|
+
* * `'darwin'`
|
|
110
|
+
* * `'linux'`
|
|
111
|
+
* * `'win32'`
|
|
112
|
+
*
|
|
113
|
+
* ```js
|
|
114
|
+
* import { platform } from 'process';
|
|
115
|
+
*
|
|
116
|
+
* console.log(`This platform is ${platform}`);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
readonly platform: Platform;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The `process.release` property returns an `Object` containing metadata related
|
|
123
|
+
* to the current release, including URLs for the source tarball and headers-only
|
|
124
|
+
* tarball.
|
|
125
|
+
*
|
|
126
|
+
* `process.release` contains the following properties:
|
|
127
|
+
*
|
|
128
|
+
* ```js
|
|
129
|
+
* {
|
|
130
|
+
* name: 'llrt',
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* In custom builds from non-release versions of the source tree, only the `name` property may be present. The additional properties should not be
|
|
135
|
+
* relied upon to exist.
|
|
136
|
+
*/
|
|
137
|
+
readonly release: ProcessRelease;
|
|
138
|
+
/**
|
|
139
|
+
* The `process.version` property contains the llrt version string.
|
|
140
|
+
*
|
|
141
|
+
* ```js
|
|
142
|
+
* import { version } from 'process';
|
|
143
|
+
*
|
|
144
|
+
* console.log(`Version: ${version}`);
|
|
145
|
+
* // Version: 0.1.15
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
readonly version: string;
|
|
149
|
+
/**
|
|
150
|
+
* The `process.versions` property returns an object listing the version strings of
|
|
151
|
+
* llrt and its dependencies. `process.versions.modules` indicates the current
|
|
152
|
+
* ABI version, which is increased whenever a C++ API changes. llrt will refuse
|
|
153
|
+
* to load modules that were compiled against a different module ABI version.
|
|
154
|
+
*
|
|
155
|
+
* ```js
|
|
156
|
+
* import { versions } from 'process';
|
|
157
|
+
*
|
|
158
|
+
* console.log(versions);
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* Will generate an object similar to:
|
|
162
|
+
*
|
|
163
|
+
* ```console
|
|
164
|
+
* {
|
|
165
|
+
* llrt:'0.1.15'
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
readonly versions: ProcessVersions;
|
|
170
|
+
/**
|
|
171
|
+
* The `process.exit()` method instructs llrt to terminate the process
|
|
172
|
+
* synchronously with an exit status of `code`. If `code` is omitted, exit uses
|
|
173
|
+
* either the 'success' code `0` or the value of `process.exitCode` if it has been
|
|
174
|
+
* set. llrt will not terminate until all the `'exit'` event listeners are
|
|
175
|
+
* called.
|
|
176
|
+
*
|
|
177
|
+
* To exit with a 'failure' code:
|
|
178
|
+
*
|
|
179
|
+
* ```js
|
|
180
|
+
* import { exit } from 'process';
|
|
181
|
+
*
|
|
182
|
+
* exit(1);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
exit(code?: number | string | null | undefined): never;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The `process.kill()` method sends the `signal` to the process identified by `pid`.
|
|
189
|
+
*
|
|
190
|
+
* Signal names are strings such as 'SIGINT' or 'SIGHUP'. See Signal Events and kill(2)
|
|
191
|
+
* for more information.
|
|
192
|
+
*
|
|
193
|
+
* This method will throw an error if the target pid does not exist. As a special case,
|
|
194
|
+
* a signal of 0 can be used to test for the existence of a process. Windows platforms
|
|
195
|
+
* will throw an error if the pid is used to kill a process group.
|
|
196
|
+
*
|
|
197
|
+
* Even though the name of this function is process.kill(), it is really just a signal
|
|
198
|
+
* sender, like the kill system call. The signal sent may do something other than kill
|
|
199
|
+
* the target process.
|
|
200
|
+
*
|
|
201
|
+
* ```js
|
|
202
|
+
* import { kill } from 'process';
|
|
203
|
+
*
|
|
204
|
+
* process.on('SIGHUP', () => {
|
|
205
|
+
* console.log('Got SIGHUP signal.');
|
|
206
|
+
* });
|
|
207
|
+
*
|
|
208
|
+
* setTimeout(() => {
|
|
209
|
+
* console.log('Exiting.');
|
|
210
|
+
* process.exit(0);
|
|
211
|
+
* }, 100);
|
|
212
|
+
*
|
|
213
|
+
* kill(process.pid, 'SIGHUP');
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* When `SIGUSR1` is received by a Node.js process, Node.js will start the debugger.
|
|
217
|
+
* See the debugger documentation for more information.
|
|
218
|
+
*
|
|
219
|
+
* @since v0.1.31
|
|
220
|
+
* @param pid A process ID
|
|
221
|
+
* @param signal The signal to send, either as a string or number. Default: 'SIGTERM'.
|
|
222
|
+
*/
|
|
223
|
+
kill(pid: number, signal?: QuickJS.Signals | number): void;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The `process.exitCode` property indicates the exit code that will be used
|
|
227
|
+
* when the llrt process eventually exits. If it is not specified, the default
|
|
228
|
+
* exit code is `undefined` and will be 0 on exit.
|
|
229
|
+
*
|
|
230
|
+
* ```js
|
|
231
|
+
* import { exitCode, exit } from 'process';
|
|
232
|
+
*
|
|
233
|
+
* exitCode = 42;
|
|
234
|
+
* exit();
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* This will cause the llrt process to exit with the exit code `42`.
|
|
238
|
+
*/
|
|
239
|
+
exitCode: number | null;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The `process.getgid()` method returns the numerical group identity of the
|
|
243
|
+
* process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
|
|
244
|
+
*
|
|
245
|
+
* ```js
|
|
246
|
+
* import process from 'process';
|
|
247
|
+
*
|
|
248
|
+
* if (process.getgid) {
|
|
249
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
250
|
+
* }
|
|
251
|
+
* ```
|
|
252
|
+
*
|
|
253
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
254
|
+
* Android).
|
|
255
|
+
* @since v0.1.31
|
|
256
|
+
*/
|
|
257
|
+
getgid?: () => number;
|
|
258
|
+
/**
|
|
259
|
+
* 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
|
|
260
|
+
* numeric ID or a group name
|
|
261
|
+
* string. If a group name is specified, this method blocks while resolving the
|
|
262
|
+
* associated numeric ID.
|
|
263
|
+
*
|
|
264
|
+
* ```js
|
|
265
|
+
* import process from 'process';
|
|
266
|
+
*
|
|
267
|
+
* if (process.getgid && process.setgid) {
|
|
268
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
269
|
+
* try {
|
|
270
|
+
* process.setgid(501);
|
|
271
|
+
* console.log(`New gid: ${process.getgid()}`);
|
|
272
|
+
* } catch (err) {
|
|
273
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
274
|
+
* }
|
|
275
|
+
* }
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
279
|
+
* Android).
|
|
280
|
+
* This feature is not available in `Worker` threads.
|
|
281
|
+
* @since v0.1.31
|
|
282
|
+
* @param id The group name or ID
|
|
283
|
+
*/
|
|
284
|
+
setgid?: (id: number) => void;
|
|
285
|
+
/**
|
|
286
|
+
* The `process.getuid()` method returns the numeric user identity of the process.
|
|
287
|
+
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
|
288
|
+
*
|
|
289
|
+
* ```js
|
|
290
|
+
* import process from 'process';
|
|
291
|
+
*
|
|
292
|
+
* if (process.getuid) {
|
|
293
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
294
|
+
* }
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
298
|
+
* Android).
|
|
299
|
+
* @since v0.1.28
|
|
300
|
+
*/
|
|
301
|
+
getuid?: () => number;
|
|
302
|
+
/**
|
|
303
|
+
* 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
|
|
304
|
+
* numeric ID or a username string.
|
|
305
|
+
* If a username is specified, the method blocks while resolving the associated
|
|
306
|
+
* numeric ID.
|
|
307
|
+
*
|
|
308
|
+
* ```js
|
|
309
|
+
* import process from 'process';
|
|
310
|
+
*
|
|
311
|
+
* if (process.getuid && process.setuid) {
|
|
312
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
313
|
+
* try {
|
|
314
|
+
* process.setuid(501);
|
|
315
|
+
* console.log(`New uid: ${process.getuid()}`);
|
|
316
|
+
* } catch (err) {
|
|
317
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
318
|
+
* }
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
323
|
+
* Android).
|
|
324
|
+
* This feature is not available in `Worker` threads.
|
|
325
|
+
* @since v0.1.28
|
|
326
|
+
*/
|
|
327
|
+
setuid?: (id: number) => void;
|
|
328
|
+
/**
|
|
329
|
+
* The `process.geteuid()` method returns the numerical effective user identity of
|
|
330
|
+
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
|
331
|
+
*
|
|
332
|
+
* ```js
|
|
333
|
+
* import process from 'process';
|
|
334
|
+
*
|
|
335
|
+
* if (process.geteuid) {
|
|
336
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
341
|
+
* Android).
|
|
342
|
+
* @since v2.0.0
|
|
343
|
+
*/
|
|
344
|
+
geteuid?: () => number;
|
|
345
|
+
/**
|
|
346
|
+
* The `process.seteuid()` method sets the effective user identity of the process.
|
|
347
|
+
* (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
|
|
348
|
+
* string. If a username is specified, the method blocks while resolving the
|
|
349
|
+
* associated numeric ID.
|
|
350
|
+
*
|
|
351
|
+
* ```js
|
|
352
|
+
* import process from 'process';
|
|
353
|
+
*
|
|
354
|
+
* if (process.geteuid && process.seteuid) {
|
|
355
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
356
|
+
* try {
|
|
357
|
+
* process.seteuid(501);
|
|
358
|
+
* console.log(`New uid: ${process.geteuid()}`);
|
|
359
|
+
* } catch (err) {
|
|
360
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
361
|
+
* }
|
|
362
|
+
* }
|
|
363
|
+
* ```
|
|
364
|
+
*
|
|
365
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
366
|
+
* Android).
|
|
367
|
+
* This feature is not available in `Worker` threads.
|
|
368
|
+
* @since v2.0.0
|
|
369
|
+
* @param id A user name or ID
|
|
370
|
+
*/
|
|
371
|
+
seteuid?: (id: number) => void;
|
|
372
|
+
/**
|
|
373
|
+
* The `process.getegid()` method returns the numerical effective group identity
|
|
374
|
+
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
|
375
|
+
*
|
|
376
|
+
* ```js
|
|
377
|
+
* import process from 'process';
|
|
378
|
+
*
|
|
379
|
+
* if (process.getegid) {
|
|
380
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
381
|
+
* }
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
385
|
+
* Android).
|
|
386
|
+
* @since v2.0.0
|
|
387
|
+
*/
|
|
388
|
+
getegid?: () => number;
|
|
389
|
+
/**
|
|
390
|
+
* The `process.setegid()` method sets the effective group identity of the process.
|
|
391
|
+
* (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
|
|
392
|
+
* name string. If a group name is specified, this method blocks while resolving
|
|
393
|
+
* the associated a numeric ID.
|
|
394
|
+
*
|
|
395
|
+
* ```js
|
|
396
|
+
* import process from 'process';
|
|
397
|
+
*
|
|
398
|
+
* if (process.getegid && process.setegid) {
|
|
399
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
400
|
+
* try {
|
|
401
|
+
* process.setegid(501);
|
|
402
|
+
* console.log(`New gid: ${process.getegid()}`);
|
|
403
|
+
* } catch (err) {
|
|
404
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
405
|
+
* }
|
|
406
|
+
* }
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
410
|
+
* Android).
|
|
411
|
+
* This feature is not available in `Worker` threads.
|
|
412
|
+
* @since v2.0.0
|
|
413
|
+
* @param id A group name or ID
|
|
414
|
+
*/
|
|
415
|
+
setegid?: (id: number) => void;
|
|
416
|
+
/**
|
|
417
|
+
* The `process.env` property returns an object containing the user environment.
|
|
418
|
+
* See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html).
|
|
419
|
+
*
|
|
420
|
+
* An example of this object looks like:
|
|
421
|
+
*
|
|
422
|
+
* ```js
|
|
423
|
+
* {
|
|
424
|
+
* TERM: 'xterm-256color',
|
|
425
|
+
* SHELL: '/usr/local/bin/bash',
|
|
426
|
+
* USER: 'maciej',
|
|
427
|
+
* PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
|
|
428
|
+
* PWD: '/Users/maciej',
|
|
429
|
+
* EDITOR: 'vim',
|
|
430
|
+
* SHLVL: '1',
|
|
431
|
+
* HOME: '/Users/maciej',
|
|
432
|
+
* LOGNAME: 'maciej',
|
|
433
|
+
* _: '/usr/local/bin/node'
|
|
434
|
+
* }
|
|
435
|
+
* ```
|
|
436
|
+
*
|
|
437
|
+
* It is possible to modify this object, but such modifications will not be
|
|
438
|
+
* reflected outside the Node.js process, or (unless explicitly requested)
|
|
439
|
+
* to other `Worker` threads.
|
|
440
|
+
* In other words, the following example would not work:
|
|
441
|
+
*
|
|
442
|
+
* ```bash
|
|
443
|
+
* node -e 'process.env.foo = "bar"' && echo $foo
|
|
444
|
+
* ```
|
|
445
|
+
*
|
|
446
|
+
* While the following will:
|
|
447
|
+
*
|
|
448
|
+
* ```js
|
|
449
|
+
* import { env } from 'node:process';
|
|
450
|
+
*
|
|
451
|
+
* env.foo = 'bar';
|
|
452
|
+
* console.log(env.foo);
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
455
|
+
* Assigning a property on `process.env` will implicitly convert the value
|
|
456
|
+
* to a string. **This behavior is deprecated.** Future versions of Node.js may
|
|
457
|
+
* throw an error when the value is not a string, number, or boolean.
|
|
458
|
+
*
|
|
459
|
+
* ```js
|
|
460
|
+
* import { env } from 'node:process';
|
|
461
|
+
*
|
|
462
|
+
* env.test = null;
|
|
463
|
+
* console.log(env.test);
|
|
464
|
+
* // => 'null'
|
|
465
|
+
* env.test = undefined;
|
|
466
|
+
* console.log(env.test);
|
|
467
|
+
* // => 'undefined'
|
|
468
|
+
* ```
|
|
469
|
+
*
|
|
470
|
+
* Use `delete` to delete a property from `process.env`.
|
|
471
|
+
*
|
|
472
|
+
* ```js
|
|
473
|
+
* import { env } from 'node:process';
|
|
474
|
+
*
|
|
475
|
+
* env.TEST = 1;
|
|
476
|
+
* delete env.TEST;
|
|
477
|
+
* console.log(env.TEST);
|
|
478
|
+
* // => undefined
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* On Windows operating systems, environment variables are case-insensitive.
|
|
482
|
+
*
|
|
483
|
+
* ```js
|
|
484
|
+
* import { env } from 'node:process';
|
|
485
|
+
*
|
|
486
|
+
* env.TEST = 1;
|
|
487
|
+
* console.log(env.test);
|
|
488
|
+
* // => 1
|
|
489
|
+
* ```
|
|
490
|
+
*
|
|
491
|
+
* Unless explicitly specified when creating a `Worker` instance,
|
|
492
|
+
* each `Worker` thread has its own copy of `process.env`, based on its
|
|
493
|
+
* parent thread's `process.env`, or whatever was specified as the `env` option
|
|
494
|
+
* to the `Worker` constructor. Changes to `process.env` will not be visible
|
|
495
|
+
* across `Worker` threads, and only the main thread can make changes that
|
|
496
|
+
* are visible to the operating system or to native add-ons. On Windows, a copy of `process.env` on a `Worker` instance operates in a case-sensitive manner
|
|
497
|
+
* unlike the main thread.
|
|
498
|
+
* @since v0.1.27
|
|
499
|
+
*/
|
|
500
|
+
env: ProcessEnv;
|
|
501
|
+
}
|
|
502
|
+
}
|