File
Blob: src/node/internal/legacy_process.ts
| 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. |
| 9 | import { default as processImpl } from 'node-internal:process'; |
| 10 | |
| 11 | import { |
| 12 | platform, |
| 13 | nextTick, |
| 14 | env, |
| 15 | features, |
| 16 | _setEventsProcess, |
| 17 | } from 'node-internal:internal_process'; |
| 18 | |
| 19 | export { platform, nextTick, env, features }; |
| 20 | |
| 21 | export function getBuiltinModule(id: string): object { |
| 22 | return processImpl.getBuiltinModule(id); |
| 23 | } |
| 24 | |
| 25 | export function exit(code: number): void { |
| 26 | processImpl.exitImpl(code); |
| 27 | } |
| 28 | |
| 29 | const process = { |
| 30 | nextTick, |
| 31 | env, |
| 32 | exit, |
| 33 | getBuiltinModule, |
| 34 | platform, |
| 35 | features, |
| 36 | }; |
| 37 | |
| 38 | _setEventsProcess(process); |
| 39 | |
| 40 | export default process; |