Skip to content

Commit

Permalink
module: unflag resolve self
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
guybedford authored and BethGriggs committed Feb 6, 2020
1 parent 7f4ee67 commit 657a8af
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 30 deletions.
9 changes: 0 additions & 9 deletions doc/api/cli.md
Expand Up @@ -200,14 +200,6 @@ added: v11.8.0

Enable experimental diagnostic report feature.

### `--experimental-resolve-self`
<!-- YAML
added: REPLACEME
-->

Enable experimental support for a package using `require` or `import` to load
itself.

### `--experimental-specifier-resolution=mode`
<!-- YAML
added: REPLACEME
Expand Down Expand Up @@ -1089,7 +1081,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-wasm-modules`
Expand Down
3 changes: 0 additions & 3 deletions doc/node.1
Expand Up @@ -135,9 +135,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.
.
Expand Down
4 changes: 1 addition & 3 deletions lib/internal/modules/cjs/loader.js
Expand Up @@ -58,7 +58,6 @@ const enableSourceMaps = getOptionValue('--enable-source-maps');
const preserveSymlinks = getOptionValue('--preserve-symlinks');
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
const experimentalModules = getOptionValue('--experimental-modules');
const experimentalSelf = getOptionValue('--experimental-resolve-self');
const experimentalConditionalExports =
getOptionValue('--experimental-conditional-exports');
const manifest = getOptionValue('--experimental-policy') ?
Expand Down Expand Up @@ -421,10 +420,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;
Expand Down
3 changes: 0 additions & 3 deletions src/module_wrap.cc
Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions src/node_options.cc
Expand Up @@ -362,10 +362,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"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,
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Expand Up @@ -104,7 +104,6 @@ class EnvironmentOptions : public Options {
bool experimental_conditional_exports = false;
bool experimental_json_modules = false;
bool experimental_modules = false;
bool experimental_resolve_self = false;
std::string experimental_specifier_resolution;
std::string es_module_specifier_resolution;
bool experimental_wasm_modules = false;
Expand Down
9 changes: 2 additions & 7 deletions test/es-module/test-esm-exports.mjs
@@ -1,4 +1,4 @@
// Flags: --experimental-modules --experimental-resolve-self --experimental-conditional-exports
// Flags: --experimental-modules --experimental-conditional-exports

import { mustCall } from '../common/index.mjs';
import { path } from '../common/fixtures.mjs';
Expand Down Expand Up @@ -171,12 +171,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, [
'--experimental-modules',
Expand Down

0 comments on commit 657a8af

Please sign in to comment.