Skip to content
File

Blob: src/node/internal/legacy_process.ts

typescript41 lines
1// Copyright (c) 2017-2022 Cloudflare, Inc.
2// Licensed under the Apache 2.0 license found in the LICENSE file or at:
3// https://opensource.org/licenses/Apache-2.0
4//
5 
6// Legacy process wrapper only exports limited process exports.
7// This is used when the enable_nodejs_process_v2 compat flag is disabled.
8// node:process re-mapping for this flag is done via module resolution.
9import { default as processImpl } from 'node-internal:process';
10 
11import {
12 platform,
13 nextTick,
14 env,
15 features,
16 _setEventsProcess,
17} from 'node-internal:internal_process';
18 
19export { platform, nextTick, env, features };
20 
21export function getBuiltinModule(id: string): object {
22 return processImpl.getBuiltinModule(id);
23}
24 
25export function exit(code: number): void {
26 processImpl.exitImpl(code);
27}
28 
29const process = {
30 nextTick,
31 env,
32 exit,
33 getBuiltinModule,
34 platform,
35 features,
36};
37 
38_setEventsProcess(process);
39 
40export default process;