summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDavid Goldstein <dgoldstein@dropbox.com>2018-04-10 07:40:56 +0000
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2018-05-13 00:28:16 +0300
commit236596590ce5746c66a36bee9ca81203553bd7a2 (patch)
tree6d077b2859a268a689d30068afa6c28208a22b64 /doc
parent20509ebee681233443ebc7dc1b58c2fab6d2b12f (diff)
downloadandroid-node-v8-236596590ce5746c66a36bee9ca81203553bd7a2.tar.gz
android-node-v8-236596590ce5746c66a36bee9ca81203553bd7a2.tar.bz2
android-node-v8-236596590ce5746c66a36bee9ca81203553bd7a2.zip
module: add --preserve-symlinks-main
Add `--preserve-symlinks-main` option which behaves like `--preserve-symlinks` but for `require.main`. PR-URL: https://github.com/nodejs/node/pull/19911 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/cli.md23
-rw-r--r--doc/node.15
2 files changed, 27 insertions, 1 deletions
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 6d055d9d03..d76c49615c 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -217,6 +217,29 @@ are linked from more than one location in the dependency tree (Node.js would
see those as two separate modules and would attempt to load the module multiple
times, causing an exception to be thrown).
+The `--preserve-symlinks` flag does not apply to the main module, which allows
+`node --preserve-symlinks node_module/.bin/<foo>` to work. To apply the same
+behavior for the main module, also use `--preserve-symlinks-main`.
+
+### `--preserve-symlinks-main`
+<!-- YAML
+added: REPLACEME
+-->
+
+Instructs the module loader to preserve symbolic links when resolving and
+caching the main module (`require.main`).
+
+This flag exists so that the main module can be opted-in to the same behavior
+that `--preserve-symlinks` gives to all other imports; they are separate flags,
+however, for backward compatibility with older Node.js versions.
+
+Note that `--preserve-symlinks-main` does not imply `--preserve-symlinks`; it
+is expected that `--preserve-symlinks-main` will be used in addition to
+`--preserve-symlinks` when it is not desirable to follow symlinks before
+resolving relative paths.
+
+See `--preserve-symlinks` for more information.
+
### `--prof-process`
<!-- YAML
added: v5.2.0
diff --git a/doc/node.1 b/doc/node.1
index 238572c74c..f22e475d84 100644
--- a/doc/node.1
+++ b/doc/node.1
@@ -143,7 +143,10 @@ Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is
Emit pending deprecation warnings.
.
.It Fl -preserve-symlinks
-Instructs the module loader to preserve symbolic links when resolving and caching modules.
+Instructs the module loader to preserve symbolic links when resolving and caching modules other than the main module.
+.
+.It F1 -preserve-symlinks-main
+Instructs the module loader to preserve symbolic links when resolving and caching the main module.
.
.It Fl -prof-process
Process V8 profiler output generated using the V8 option