diff options
author | Guy Bedford <guybedford@gmail.com> | 2019-12-17 09:16:39 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2020-01-03 19:47:43 +0300 |
commit | 72c64605c95e7fc1d4b327b180f14bf70fcbfb24 (patch) | |
tree | 91a23b7f3880d610068fd105caa67e4a7e94f757 | |
parent | 827d3fea0e17ba1db642df43fb92b7d6f51e8d4a (diff) |
module: unflag resolve self
PR-URL: https://github.com/nodejs/node/pull/31002
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
-rw-r--r-- | doc/api/cli.md | 11 | ||||
-rw-r--r-- | doc/node.1 | 3 | ||||
-rw-r--r-- | lib/internal/modules/cjs/loader.js | 4 | ||||
-rw-r--r-- | src/module_wrap.cc | 3 | ||||
-rw-r--r-- | src/node_options.cc | 7 | ||||
-rw-r--r-- | src/node_options.h | 1 | ||||
-rw-r--r-- | test/es-module/test-esm-exports.mjs | 7 |
7 files changed, 4 insertions, 32 deletions
diff --git a/doc/api/cli.md b/doc/api/cli.md index d098a199e05..dfb7ec87568 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -178,7 +178,7 @@ added: v8.5.0 --> Enable latest experimental modules features (currently -`--experimental-conditional-exports` and `--experimental-resolve-self`). +`--experimental-conditional-exports`). ### `--experimental-policy` <!-- YAML @@ -201,14 +201,6 @@ added: v11.8.0 Enable experimental diagnostic report feature. -### `--experimental-resolve-self` -<!-- YAML -added: v13.1.0 ---> - -Enable experimental support for a package using `require` or `import` to load -itself. - ### `--experimental-specifier-resolution=mode` <!-- YAML added: v13.4.0 @@ -1091,7 +1083,6 @@ Node.js options that are allowed are: * `--experimental-policy` * `--experimental-repl-await` * `--experimental-report` -* `--experimental-resolve-self` * `--experimental-specifier-resolution` * `--experimental-vm-modules` * `--experimental-wasi-unstable-preview1` diff --git a/doc/node.1 b/doc/node.1 index 4f59dc7d269..96a2df9151c 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -138,9 +138,6 @@ Enable experimental .Sy diagnostic report feature. . -.It Fl -experimental-resolve-self -Enable experimental support for a package to load itself. -. .It Fl -experimental-vm-modules Enable experimental ES module support in VM module. . diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 445297449c7..5f46db6249f 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -64,7 +64,6 @@ const { getOptionValue } = require('internal/options'); const enableSourceMaps = getOptionValue('--enable-source-maps'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); -const experimentalSelf = getOptionValue('--experimental-resolve-self'); const experimentalConditionalExports = getOptionValue('--experimental-conditional-exports'); const manifest = getOptionValue('--experimental-policy') ? @@ -429,10 +428,9 @@ function resolveBasePath(basePath, exts, isMain, trailingSlash, request) { } function trySelf(parentPath, isMain, request) { - if (!experimentalSelf) { + if (!experimentalConditionalExports) { return false; } - const { data: pkg, path: basePath } = readPackageScope(parentPath) || {}; if (!pkg || 'exports' in pkg === false) return false; if (typeof pkg.name !== 'string') return false; diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 454476a1e97..74eacf198f7 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -1153,9 +1153,6 @@ Maybe<URL> ResolveSelf(Environment* env, const std::string& pkg_name, const std::string& pkg_subpath, const URL& base) { - if (!env->options()->experimental_resolve_self) { - return Nothing<URL>(); - } const PackageConfig* pcfg; if (GetPackageScopeConfig(env, base, base).To(&pcfg) && pcfg->exists == Exists::Yes) { diff --git a/src/node_options.cc b/src/node_options.cc index de1649d8569..eb3cb58ed5d 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -325,16 +325,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { &EnvironmentOptions::userland_loader, kAllowedInEnvironment); AddAlias("--loader", "--experimental-loader"); - AddAlias("--experimental-modules", { "--experimental-conditional-exports", - "--experimental-resolve-self" }); + AddAlias("--experimental-modules", { "--experimental-conditional-exports" }); AddOption("--experimental-conditional-exports", "experimental support for conditional exports targets", &EnvironmentOptions::experimental_conditional_exports, kAllowedInEnvironment); - AddOption("--experimental-resolve-self", - "experimental support for require/import of the current package", - &EnvironmentOptions::experimental_resolve_self, - kAllowedInEnvironment); AddOption("--experimental-wasm-modules", "experimental ES Module support for webassembly modules", &EnvironmentOptions::experimental_wasm_modules, diff --git a/src/node_options.h b/src/node_options.h index 218fb4ac238..1e156a7edc5 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -103,7 +103,6 @@ class EnvironmentOptions : public Options { bool enable_source_maps = false; bool experimental_conditional_exports = false; bool experimental_json_modules = false; - bool experimental_resolve_self = false; std::string experimental_specifier_resolution; std::string es_module_specifier_resolution; bool experimental_wasm_modules = false; diff --git a/test/es-module/test-esm-exports.mjs b/test/es-module/test-esm-exports.mjs index 1595d1f6a1e..d55d8ffac47 100644 --- a/test/es-module/test-esm-exports.mjs +++ b/test/es-module/test-esm-exports.mjs @@ -170,12 +170,7 @@ function assertIncludes(actual, expected) { '--experimental-conditional-exports', '/es-modules/conditional-exports.js', 'Conditional exports', - ], - [ - '--experimental-resolve-self', - '/node_modules/pkgexports/resolve-self.js', - 'Package name self resolution', - ], + ] ].forEach(([flag, file, message]) => { const child = spawn(process.execPath, [flag, path(file)]); |