Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esm: unflag import.meta.resolve #33464

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,6 @@ Enable experimental Source Map V3 support for stack traces.
Currently, overriding `Error.prepareStackTrace` is ignored when the
`--enable-source-maps` flag is set.

### `--experimental-import-meta-resolve`
<!-- YAML
added:
- v13.9.0
- v12.16.2
-->

Enable experimental `import.meta.resolve()` support.

### `--experimental-json-modules`
<!-- YAML
added: v12.9.0
Expand Down Expand Up @@ -1180,7 +1171,6 @@ Node.js options that are allowed are:
* `--disable-proto`
* `--enable-fips`
* `--enable-source-maps`
* `--experimental-import-meta-resolve`
* `--experimental-json-modules`
* `--experimental-loader`
* `--experimental-modules`
Expand Down
3 changes: 1 addition & 2 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -894,8 +894,7 @@ const __dirname = dirname(__filename);
### No `require.resolve`

Former use cases relying on `require.resolve` to determine the resolved path
of a module can be supported via `import.meta.resolve`, which is experimental
and supported via the `--experimental-import-meta-resolve` flag:
of a module can be supported via `import.meta.resolve`:

```js
(async () => {
Expand Down
3 changes: 0 additions & 3 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ Requires Node.js to be built with
.It Fl -enable-source-maps
Enable experimental Source Map V3 support for stack traces.
.
.It Fl -experimental-import-meta-resolve
Enable experimental ES modules support for import.meta.resolve().
.
.It Fl -experimental-json-modules
Enable experimental JSON interop support for the ES Module loader.
.
Expand Down
6 changes: 1 addition & 5 deletions lib/internal/modules/esm/translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ const { ERR_UNKNOWN_BUILTIN_MODULE } = require('internal/errors').codes;
const { maybeCacheSourceMap } = require('internal/source_map/source_map_cache');
const moduleWrap = internalBinding('module_wrap');
const { ModuleWrap } = moduleWrap;
const { getOptionValue } = require('internal/options');
const experimentalImportMetaResolve =
getOptionValue('--experimental-import-meta-resolve');

const debug = debuglog('esm');

Expand Down Expand Up @@ -71,8 +68,7 @@ function createImportMetaResolve(defaultParentUrl) {

function initializeImportMeta(meta, { url }) {
// Alphabetical
if (experimentalImportMetaResolve)
meta.resolve = createImportMetaResolve(url);
meta.resolve = createImportMetaResolve(url);
meta.url = url;
}

Expand Down
4 changes: 0 additions & 4 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental ES Module support for webassembly modules",
&EnvironmentOptions::experimental_wasm_modules,
kAllowedInEnvironment);
AddOption("--experimental-import-meta-resolve",
"experimental ES Module import.meta.resolve() support",
&EnvironmentOptions::experimental_import_meta_resolve,
kAllowedInEnvironment);
AddOption("--experimental-policy",
"use the specified file as a "
"security policy",
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class EnvironmentOptions : public Options {
std::string experimental_specifier_resolution;
std::string es_module_specifier_resolution;
bool experimental_wasm_modules = false;
bool experimental_import_meta_resolve = false;
std::string module_type;
std::string experimental_policy;
std::string experimental_policy_integrity;
Expand Down
1 change: 0 additions & 1 deletion test/es-module/test-esm-import-meta-resolve.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-import-meta-resolve
import '../common/index.mjs';
import assert from 'assert';

Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-import-meta.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import assert from 'assert';

assert.strictEqual(Object.getPrototypeOf(import.meta), null);

const keys = ['url'];
const keys = ['resolve', 'url'];
assert.deepStrictEqual(Reflect.ownKeys(import.meta), keys);

const descriptors = Object.getOwnPropertyDescriptors(import.meta);
Expand Down
1 change: 0 additions & 1 deletion test/es-module/test-esm-nowarn-exports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { strictEqual, ok } from 'assert';
import { spawn } from 'child_process';

const child = spawn(process.execPath, [
'--experimental-import-meta-resolve',
path('/es-modules/import-resolve-exports.mjs')
]);

Expand Down