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:
authorAntoine du HAMEL <duhamelantoine1995@gmail.com>2020-03-12 01:44:31 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2020-05-24 04:38:39 +0300
commit6443ab9595de9e7f57144f063e42efb73e34d714 (patch)
treebd957f31165f9a9b433f9f69cba277912829cc3b /doc/api/modules.md
parent039cd00a9acfacd3a5a304be09bf17debd54aaaf (diff)
module: deprecate module.parent
This feature does not work when a module is imported using ECMAScript modules specification, therefore it is deprecated. Fixes: https://github.com/nodejs/modules/issues/469 PR-URL: https://github.com/nodejs/node/pull/32217 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'doc/api/modules.md')
-rw-r--r--doc/api/modules.md13
1 files changed, 10 insertions, 3 deletions
diff --git a/doc/api/modules.md b/doc/api/modules.md
index c57aa69c6d0..0718809d99b 100644
--- a/doc/api/modules.md
+++ b/doc/api/modules.md
@@ -690,7 +690,6 @@ Module {
id: '.',
path: '/absolute/path/to',
exports: {},
- parent: null,
filename: '/absolute/path/to/entry.js',
loaded: false,
children: [],
@@ -894,11 +893,17 @@ loading.
### `module.parent`
<!-- YAML
added: v0.1.16
+deprecated: REPLACEME
-->
-* {module}
+> Stability: 0 - Deprecated: Please use [`require.main`][] and
+> [`module.children`][] instead.
+
+* {module | null | undefined}
-The module that first required this one.
+The module that first required this one, or `null` if the current module is the
+entry point of the current process, or `undefined` if the module was loaded by
+something that is not a CommonJS module (E.G.: REPL or `import`). Read only.
### `module.path`
<!-- YAML
@@ -1122,6 +1127,7 @@ consists of the following keys:
[`createRequire()`]: #modules_module_createrequire_filename
[`module` object]: #modules_the_module_object
[`module.id`]: #modules_module_id
+[`module.children`]: #modules_module_children
[`path.dirname()`]: path.html#path_path_dirname_path
[ECMAScript Modules]: esm.html
[an error]: errors.html#errors_err_require_esm
@@ -1129,6 +1135,7 @@ consists of the following keys:
[module resolution]: #modules_all_together
[module wrapper]: #modules_the_module_wrapper
[native addons]: addons.html
+[`require.main`]: #modules_require_main
[source map include directives]: https://sourcemaps.info/spec.html#h.lmz475t4mvbx
[`--enable-source-maps`]: cli.html#cli_enable_source_maps
[`NODE_V8_COVERAGE=dir`]: cli.html#cli_node_v8_coverage_dir