Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: deprecate process.mainModule #32232

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2617,6 +2617,22 @@ async function openAndClose() {
}
```

<a id="DEP0XXX"></a>
### DEP0XXX: `process.mainModule`
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32232
description: Documentation-only deprecation.
-->

Type: Documentation-only

[`process.mainModule`][] is a CJS-only feature while `process` global object is
shared with non-CJS environment.
aduh95 marked this conversation as resolved.
Show resolved Hide resolved

It's safe to use [`require.main`][] as a replacement.
aduh95 marked this conversation as resolved.
Show resolved Hide resolved

[`--pending-deprecation`]: cli.html#cli_pending_deprecation
[`--throw-deprecation`]: cli.html#cli_throw_deprecation
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
Expand Down Expand Up @@ -2674,8 +2690,10 @@ async function openAndClose() {
[`os.networkInterfaces()`]: os.html#os_os_networkinterfaces
[`os.tmpdir()`]: os.html#os_os_tmpdir
[`process.env`]: process.html#process_process_env
[`process.mainModule`]: process.html#process_process_mainmodule
[`punycode`]: punycode.html
[`require.extensions`]: modules.html#modules_require_extensions
[`require.main`]: modules.html#modules_accessing_the_main_module
[`request.socket`]: http.html#http_request_socket
[`request.connection`]: http.html#http_request_connection
[`response.socket`]: http.html#http_response_socket
Expand Down
3 changes: 3 additions & 0 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1499,8 +1499,11 @@ debugger. See [Signal Events][].
## `process.mainModule`
<!-- YAML
added: v0.1.17
deprecated: REPLACEME
-->

> Stability: 0 - Deprecated: Use [`require.main`][] instead.

aduh95 marked this conversation as resolved.
Show resolved Hide resolved
* {Object}

The `process.mainModule` property provides an alternative way of retrieving
Expand Down