-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: add require.main
to require
properties
#19573
Conversation
doc/api/modules.md
Outdated
@@ -600,6 +600,16 @@ filename scales linearly with the number of registered extensions. | |||
In other words, adding extensions slows down the module loader and | |||
should be discouraged. | |||
|
|||
#### require.main | |||
<!-- YAML | |||
added: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it was added in 1020efb.
That means v0.1.17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Updating...
doc/api/modules.md
Outdated
|
||
* {Object} | ||
|
||
The main module of the entry script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description isn't overly useful. Perhaps something like...
The `Module` object representing the entry script loaded when
the Node.js process launched.
Then include a quick example:
$ node entry.js
console.log(reqiure.main)
// Prints
// Module {
// id: '.',
// exports: {},
// parent: null,
// filename: '/absolute/path/to/entry.js',
// loaded: false,
// children: [],
// paths:
// [ '/absolute/path/to/node_modules',
// '/absolute/path/node_modules',
// '/absolute/node_modules',
// '/node_modules' ] }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
`require.main` was documented in a non-standard way. With this PR, the previous section is left as is to not break all the possible link references inside and outside Node.js docs. A standard section is added to the `require` properties with a reference to the old description.
Removed CI-lite: https://ci.nodejs.org/job/node-test-pull-request-lite/313/ |
Landed in 610dd79 |
`require.main` was documented in a non-standard way. With this PR, the previous section is left as is to not break all the possible link references inside and outside Node.js docs. A standard section is added to the `require` properties with a reference to the old description. PR-URL: #19573 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
`require.main` was documented in a non-standard way. With this PR, the previous section is left as is to not break all the possible link references inside and outside Node.js docs. A standard section is added to the `require` properties with a reference to the old description. PR-URL: #19573 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesrequire.main
was documented in a non-standard way.With this PR, the previous section is left as is to not break all the possible link references inside and outside Node.js docs.
A standard section is added to the
require
properties with a reference to the remaining description.I cannot define when this property was added. I can only dig up to this mention of a fix in the 0.3.8. Can anybody help with(see #19573 (comment))added:
attribution?