From 96e46d37c458ab3d6cf1148a471cfd1aac7aafe6 Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Mon, 15 Apr 2019 10:29:56 -0700 Subject: [PATCH] esm: replace --entry-type with --input-type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New flag is for string input only PR-URL: https://github.com/nodejs/node/pull/27184 Reviewed-By: Jan Krems Reviewed-By: Michaƫl Zasso Reviewed-By: Joyee Cheung Reviewed-By: Ruben Bridgewater Reviewed-By: Myles Borins --- doc/api/cli.md | 24 +++--- doc/api/errors.md | 32 +++++--- doc/api/esm.md | 80 ++++++++++++------- doc/node.1 | 6 +- lib/internal/errors.js | 20 +---- lib/internal/main/check_syntax.js | 2 +- lib/internal/main/eval_stdin.js | 2 +- lib/internal/main/eval_string.js | 2 +- lib/internal/main/repl.js | 6 +- lib/internal/modules/esm/default_resolve.js | 32 +++----- src/node_options.cc | 12 +-- test/es-module/test-esm-no-extension.js | 7 +- test/es-module/test-esm-type-flag-errors.js | 14 +--- test/es-module/test-esm-type-flag.mjs | 2 +- .../{ => package-type-module}/noext-esm | 0 test/parallel/test-cli-syntax-piped-bad.js | 4 +- test/parallel/test-cli-syntax-piped-good.js | 4 +- 17 files changed, 119 insertions(+), 130 deletions(-) rename test/fixtures/es-modules/{ => package-type-module}/noext-esm (100%) diff --git a/doc/api/cli.md b/doc/api/cli.md index f56eb981a986e4..79f2dcd2ba4596 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -134,19 +134,6 @@ added: v6.0.0 Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with `./configure --openssl-fips`.) -### `--entry-type=type` - - -Used with `--experimental-modules`, this configures Node.js to interpret the -initial entry point as CommonJS or as an ES module. - -Valid values are `"commonjs"` and `"module"`. The default is to infer from -the file extension and the `"type"` field in the nearest parent `package.json`. - -Works for executing a file as well as `--eval`, `--print`, `STDIN`. - ### `--es-module-specifier-resolution=mode` + +Used with `--experimental-modules`, this configures Node.js to interpret string +input as CommonJS or as an ES module. String input is input via `--eval`, +`--print`, or `STDIN`. + +Valid values are `"commonjs"` and `"module"`. The default is `"commonjs"`. + ### `--inspect-brk[=[host:]port]`