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: add require.main to require properties #19573

Closed
wants to merge 1 commit into from
Closed

doc: add require.main to require properties #19573

wants to merge 1 commit into from

Conversation

vsemozhetbyt
Copy link
Contributor

@vsemozhetbyt vsemozhetbyt commented Mar 24, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

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 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 added: attribution? (see #19573 (comment))

@vsemozhetbyt vsemozhetbyt added the fast-track PRs that do not need to wait for 48 hours to land. label Mar 24, 2018
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem. labels Mar 24, 2018
@@ -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: ???
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Updating...

@vsemozhetbyt
Copy link
Contributor Author


* {Object}

The main module of the entry script.
Copy link
Member

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' ] }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@vsemozhetbyt
Copy link
Contributor Author

`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.
@vsemozhetbyt
Copy link
Contributor Author

@vsemozhetbyt
Copy link
Contributor Author

Landed in 610dd79

vsemozhetbyt added a commit that referenced this pull request Mar 24, 2018
`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 <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@vsemozhetbyt vsemozhetbyt deleted the doc-modules-require-main branch March 24, 2018 16:28
targos pushed a commit that referenced this pull request Mar 27, 2018
`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 <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. fast-track PRs that do not need to wait for 48 hours to land. module Issues and PRs related to the module subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants