From 4b0401ff382ca4dd5c8f2f08644f9d64cc2f90b0 Mon Sep 17 00:00:00 2001 From: Shubham Pandey Date: Mon, 4 Dec 2023 16:10:24 +0530 Subject: [PATCH] doc: add additional details about `--input-type` PR-URL: https://github.com/nodejs/node/pull/50796 Fixes: https://github.com/nodejs/node/issues/50781 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel Reviewed-By: Geoffrey Booth --- doc/api/cli.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index cbabd7b9358956..c17af97f38b3fd 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1079,12 +1079,13 @@ Modules preloaded with `--require` will run before modules preloaded with `--imp added: v12.0.0 --> -This configures Node.js to interpret string input as CommonJS or as an ES -module. String input is input via `--eval`, `--print`, or `STDIN`. +This configures Node.js to interpret `--eval` or `STDIN` input as CommonJS or +as an ES module. Valid values are `"commonjs"` or `"module"`. The default is +`"commonjs"` unless [`--experimental-default-type=module`][] is used. -Valid values are `"commonjs"` and `"module"`. The default is `"commonjs"`. - -The REPL does not support this option. +The REPL does not support this option. Usage of `--input-type=module` with +[`--print`][] will throw an error, as `--print` does not support ES module +syntax. ### `--insecure-http-parser` @@ -2876,6 +2877,7 @@ done [`--import`]: #--importmodule [`--openssl-config`]: #--openssl-configfile [`--preserve-symlinks`]: #--preserve-symlinks +[`--print`]: #-p---print-script [`--redirect-warnings`]: #--redirect-warningsfile [`--require`]: #-r---require-module [`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait