Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-12-24 15:36:34 +0300
committerRich Trott <rtrott@gmail.com>2019-12-27 08:39:27 +0300
commit248f057509adb1c9ca6bd456b9ae98b885db11a8 (patch)
tree8e1b63edd995fb51ff0999e4c60c880b1d6544d6 /doc/api/modules.md
parentfc949343bf1fd6ec1222e152414209c1881899d6 (diff)
doc,module: use code markup/markdown in headers
PR-URL: https://github.com/nodejs/node/pull/31086 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'doc/api/modules.md')
-rw-r--r--doc/api/modules.md48
1 files changed, 24 insertions, 24 deletions
diff --git a/doc/api/modules.md b/doc/api/modules.md
index 5653fe8f424..9dc5cd22248 100644
--- a/doc/api/modules.md
+++ b/doc/api/modules.md
@@ -132,7 +132,7 @@ variable. Since the module lookups using `node_modules` folders are all
relative, and based on the real path of the files making the calls to
`require()`, the packages themselves can be anywhere.
-## Addenda: The .mjs extension
+## Addenda: The `.mjs` extension
It is not possible to `require()` files that have the `.mjs` extension.
Attempting to do so will throw [an error][]. The `.mjs` extension is
@@ -518,7 +518,7 @@ the module rather than the global object.
## The module scope
-### \_\_dirname
+### `__dirname`
<!-- YAML
added: v0.1.27
-->
@@ -539,7 +539,7 @@ console.log(path.dirname(__filename));
// Prints: /Users/mjr
```
-### \_\_filename
+### `__filename`
<!-- YAML
added: v0.0.1
-->
@@ -577,7 +577,7 @@ References to `__filename` within `b.js` will return
`/Users/mjr/app/node_modules/b/b.js` while references to `__filename` within
`a.js` will return `/Users/mjr/app/a.js`.
-### exports
+### `exports`
<!-- YAML
added: v0.1.12
-->
@@ -590,7 +590,7 @@ A reference to the `module.exports` that is shorter to type.
See the section about the [exports shortcut][] for details on when to use
`exports` and when to use `module.exports`.
-### module
+### `module`
<!-- YAML
added: v0.1.16
-->
@@ -603,7 +603,7 @@ A reference to the current module, see the section about the
[`module` object][]. In particular, `module.exports` is used for defining what
a module exports and makes available through `require()`.
-### require(id)
+### `require(id)`
<!-- YAML
added: v0.1.13
-->
@@ -630,7 +630,7 @@ const jsonData = require('./path/filename.json');
const crypto = require('crypto');
```
-#### require.cache
+#### `require.cache`
<!-- YAML
added: v0.3.0
-->
@@ -647,7 +647,7 @@ native modules and if a name matching a native module is added to the cache,
no require call is
going to receive the native module anymore. Use with care!
-#### require.extensions
+#### `require.extensions`
<!-- YAML
added: v0.3.0
deprecated: v0.10.6
@@ -673,7 +673,7 @@ program, or compiling them to JavaScript ahead of time.
Avoid using `require.extensions`. Use could cause subtle bugs and resolving the
extensions gets slower with each registered extension.
-#### require.main
+#### `require.main`
<!-- YAML
added: v0.1.17
-->
@@ -710,7 +710,7 @@ Module {
'/node_modules' ] }
```
-#### require.resolve(request\[, options\])
+#### `require.resolve(request[, options])`
<!-- YAML
added: v0.3.0
changes:
@@ -732,7 +732,7 @@ changes:
Use the internal `require()` machinery to look up the location of a module,
but rather than loading the module, just return the resolved filename.
-##### require.resolve.paths(request)
+##### `require.resolve.paths(request)`
<!-- YAML
added: v8.9.0
-->
@@ -759,7 +759,7 @@ representing the current module. For convenience, `module.exports` is
also accessible via the `exports` module-global. `module` is not actually
a global but rather local to each module.
-### module.children
+### `module.children`
<!-- YAML
added: v0.1.16
-->
@@ -768,7 +768,7 @@ added: v0.1.16
The module objects required for the first time by this one.
-### module.exports
+### `module.exports`
<!-- YAML
added: v0.1.16
-->
@@ -822,7 +822,7 @@ const x = require('./x');
console.log(x.a);
```
-#### exports shortcut
+#### `exports` shortcut
<!-- YAML
added: v0.1.16
-->
@@ -869,7 +869,7 @@ function require(/* ... */) {
}
```
-### module.filename
+### `module.filename`
<!-- YAML
added: v0.1.16
-->
@@ -878,7 +878,7 @@ added: v0.1.16
The fully resolved filename of the module.
-### module.id
+### `module.id`
<!-- YAML
added: v0.1.16
-->
@@ -888,7 +888,7 @@ added: v0.1.16
The identifier for the module. Typically this is the fully resolved
filename.
-### module.loaded
+### `module.loaded`
<!-- YAML
added: v0.1.16
-->
@@ -898,7 +898,7 @@ added: v0.1.16
Whether or not the module is done loading, or is in the process of
loading.
-### module.parent
+### `module.parent`
<!-- YAML
added: v0.1.16
-->
@@ -907,7 +907,7 @@ added: v0.1.16
The module that first required this one.
-### module.paths
+### `module.paths`
<!-- YAML
added: v0.4.0
-->
@@ -916,7 +916,7 @@ added: v0.4.0
The search paths for the module.
-### module.require(id)
+### `module.require(id)`
<!-- YAML
added: v0.5.1
-->
@@ -944,7 +944,7 @@ Provides general utility methods when interacting with instances of
`Module` — the `module` variable often seen in file modules. Accessed
via `require('module')`.
-### module.builtinModules
+### `module.builtinModules`
<!-- YAML
added:
- v9.3.0
@@ -964,7 +964,7 @@ by the [module wrapper][]. To access it, require the `Module` module:
const builtin = require('module').builtinModules;
```
-### module.createRequire(filename)
+### `module.createRequire(filename)`
<!-- YAML
added: v12.2.0
-->
@@ -982,7 +982,7 @@ const require = createRequire(import.meta.url);
const siblingModule = require('./sibling-module');
```
-### module.createRequireFromPath(filename)
+### `module.createRequireFromPath(filename)`
<!-- YAML
added: v10.12.0
deprecated: v12.2.0
@@ -1002,7 +1002,7 @@ const requireUtil = createRequireFromPath('../src/utils/');
requireUtil('./some-tool');
```
-### module.syncBuiltinESMExports()
+### `module.syncBuiltinESMExports()`
<!-- YAML
added: v12.12.0
-->