Skip to content

Commit 72c6460

Browse files
guybedfordBridgeAR
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 827d3fe commit 72c6460

File tree

7 files changed

+4
-32
lines changed

7 files changed

+4
-32
lines changed

doc/api/cli.md

+1-10
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ added: v8.5.0
178178
-->
179179

180180
Enable latest experimental modules features (currently
181-
`--experimental-conditional-exports` and `--experimental-resolve-self`).
181+
`--experimental-conditional-exports`).
182182

183183
### `--experimental-policy`
184184
<!-- YAML
@@ -201,14 +201,6 @@ added: v11.8.0
201201

202202
Enable experimental diagnostic report feature.
203203

204-
### `--experimental-resolve-self`
205-
<!-- YAML
206-
added: v13.1.0
207-
-->
208-
209-
Enable experimental support for a package using `require` or `import` to load
210-
itself.
211-
212204
### `--experimental-specifier-resolution=mode`
213205
<!-- YAML
214206
added: v13.4.0
@@ -1091,7 +1083,6 @@ Node.js options that are allowed are:
10911083
* `--experimental-policy`
10921084
* `--experimental-repl-await`
10931085
* `--experimental-report`
1094-
* `--experimental-resolve-self`
10951086
* `--experimental-specifier-resolution`
10961087
* `--experimental-vm-modules`
10971088
* `--experimental-wasi-unstable-preview1`

doc/node.1

-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ Enable experimental
138138
.Sy diagnostic report
139139
feature.
140140
.
141-
.It Fl -experimental-resolve-self
142-
Enable experimental support for a package to load itself.
143-
.
144141
.It Fl -experimental-vm-modules
145142
Enable experimental ES module support in VM module.
146143
.

lib/internal/modules/cjs/loader.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ const { getOptionValue } = require('internal/options');
6464
const enableSourceMaps = getOptionValue('--enable-source-maps');
6565
const preserveSymlinks = getOptionValue('--preserve-symlinks');
6666
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
67-
const experimentalSelf = getOptionValue('--experimental-resolve-self');
6867
const experimentalConditionalExports =
6968
getOptionValue('--experimental-conditional-exports');
7069
const manifest = getOptionValue('--experimental-policy') ?
@@ -429,10 +428,9 @@ function resolveBasePath(basePath, exts, isMain, trailingSlash, request) {
429428
}
430429

431430
function trySelf(parentPath, isMain, request) {
432-
if (!experimentalSelf) {
431+
if (!experimentalConditionalExports) {
433432
return false;
434433
}
435-
436434
const { data: pkg, path: basePath } = readPackageScope(parentPath) || {};
437435
if (!pkg || 'exports' in pkg === false) return false;
438436
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

+1-6
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
325325
&EnvironmentOptions::userland_loader,
326326
kAllowedInEnvironment);
327327
AddAlias("--loader", "--experimental-loader");
328-
AddAlias("--experimental-modules", { "--experimental-conditional-exports",
329-
"--experimental-resolve-self" });
328+
AddAlias("--experimental-modules", { "--experimental-conditional-exports" });
330329
AddOption("--experimental-conditional-exports",
331330
"experimental support for conditional exports targets",
332331
&EnvironmentOptions::experimental_conditional_exports,
333332
kAllowedInEnvironment);
334-
AddOption("--experimental-resolve-self",
335-
"experimental support for require/import of the current package",
336-
&EnvironmentOptions::experimental_resolve_self,
337-
kAllowedInEnvironment);
338333
AddOption("--experimental-wasm-modules",
339334
"experimental ES Module support for webassembly modules",
340335
&EnvironmentOptions::experimental_wasm_modules,

src/node_options.h

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ class EnvironmentOptions : public Options {
103103
bool enable_source_maps = false;
104104
bool experimental_conditional_exports = false;
105105
bool experimental_json_modules = false;
106-
bool experimental_resolve_self = false;
107106
std::string experimental_specifier_resolution;
108107
std::string es_module_specifier_resolution;
109108
bool experimental_wasm_modules = false;

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,7 @@ function assertIncludes(actual, expected) {
170170
'--experimental-conditional-exports',
171171
'/es-modules/conditional-exports.js',
172172
'Conditional exports',
173-
],
174-
[
175-
'--experimental-resolve-self',
176-
'/node_modules/pkgexports/resolve-self.js',
177-
'Package name self resolution',
178-
],
173+
]
179174
].forEach(([flag, file, message]) => {
180175
const child = spawn(process.execPath, [flag, path(file)]);
181176

0 commit comments

Comments
 (0)