Skip to content

Commit 3d0e33e

Browse files
guybedfordMylesBorins
authored andcommitted
module: unflag resolve self
PR-URL: #31002 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 801ea12 commit 3d0e33e

File tree

7 files changed

+3
-30
lines changed

7 files changed

+3
-30
lines changed

doc/api/cli.md

-9
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,6 @@ added: v11.8.0
200200

201201
Enable experimental diagnostic report feature.
202202

203-
### `--experimental-resolve-self`
204-
<!-- YAML
205-
added: REPLACEME
206-
-->
207-
208-
Enable experimental support for a package using `require` or `import` to load
209-
itself.
210-
211203
### `--experimental-specifier-resolution=mode`
212204
<!-- YAML
213205
added: REPLACEME
@@ -1079,7 +1071,6 @@ Node.js options that are allowed are:
10791071
* `--experimental-policy`
10801072
* `--experimental-repl-await`
10811073
* `--experimental-report`
1082-
* `--experimental-resolve-self`
10831074
* `--experimental-specifier-resolution`
10841075
* `--experimental-vm-modules`
10851076
* `--experimental-wasm-modules`

doc/node.1

-3
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ Enable experimental
135135
.Sy diagnostic report
136136
feature.
137137
.
138-
.It Fl -experimental-resolve-self
139-
Enable experimental support for a package to load itself.
140-
.
141138
.It Fl -experimental-vm-modules
142139
Enable experimental ES module support in VM module.
143140
.

lib/internal/modules/cjs/loader.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const enableSourceMaps = getOptionValue('--enable-source-maps');
5858
const preserveSymlinks = getOptionValue('--preserve-symlinks');
5959
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
6060
const experimentalModules = getOptionValue('--experimental-modules');
61-
const experimentalSelf = getOptionValue('--experimental-resolve-self');
6261
const experimentalConditionalExports =
6362
getOptionValue('--experimental-conditional-exports');
6463
const manifest = getOptionValue('--experimental-policy') ?
@@ -421,10 +420,9 @@ function resolveBasePath(basePath, exts, isMain, trailingSlash, request) {
421420
}
422421

423422
function trySelf(parentPath, isMain, request) {
424-
if (!experimentalSelf) {
423+
if (!experimentalConditionalExports) {
425424
return false;
426425
}
427-
428426
const { data: pkg, path: basePath } = readPackageScope(parentPath) || {};
429427
if (!pkg || 'exports' in pkg === false) return false;
430428
if (typeof pkg.name !== 'string') return false;

src/module_wrap.cc

-3
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,6 @@ Maybe<URL> ResolveSelf(Environment* env,
11531153
const std::string& pkg_name,
11541154
const std::string& pkg_subpath,
11551155
const URL& base) {
1156-
if (!env->options()->experimental_resolve_self) {
1157-
return Nothing<URL>();
1158-
}
11591156
const PackageConfig* pcfg;
11601157
if (GetPackageScopeConfig(env, base, base).To(&pcfg) &&
11611158
pcfg->exists == Exists::Yes) {

src/node_options.cc

-4
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
362362
"experimental support for conditional exports targets",
363363
&EnvironmentOptions::experimental_conditional_exports,
364364
kAllowedInEnvironment);
365-
AddOption("--experimental-resolve-self",
366-
"experimental support for require/import of the current package",
367-
&EnvironmentOptions::experimental_resolve_self,
368-
kAllowedInEnvironment);
369365
AddOption("--experimental-wasm-modules",
370366
"experimental ES Module support for webassembly modules",
371367
&EnvironmentOptions::experimental_wasm_modules,

src/node_options.h

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ class EnvironmentOptions : public Options {
104104
bool experimental_conditional_exports = false;
105105
bool experimental_json_modules = false;
106106
bool experimental_modules = false;
107-
bool experimental_resolve_self = false;
108107
std::string experimental_specifier_resolution;
109108
std::string es_module_specifier_resolution;
110109
bool experimental_wasm_modules = false;

test/es-module/test-esm-exports.mjs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Flags: --experimental-modules --experimental-resolve-self --experimental-conditional-exports
1+
// Flags: --experimental-modules --experimental-conditional-exports
22

33
import { mustCall } from '../common/index.mjs';
44
import { path } from '../common/fixtures.mjs';
@@ -171,12 +171,7 @@ function assertIncludes(actual, expected) {
171171
'--experimental-conditional-exports',
172172
'/es-modules/conditional-exports.js',
173173
'Conditional exports',
174-
],
175-
[
176-
'--experimental-resolve-self',
177-
'/node_modules/pkgexports/resolve-self.js',
178-
'Package name self resolution',
179-
],
174+
]
180175
].forEach(([flag, file, message]) => {
181176
const child = spawn(process.execPath, [
182177
'--experimental-modules',

0 commit comments

Comments
 (0)