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

module: remove experimental modules warning #31974

Closed
wants to merge 1 commit into from
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
14 changes: 0 additions & 14 deletions lib/internal/process/esm_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const {
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
} = require('internal/errors').codes;
const assert = require('internal/assert');
const { Loader } = require('internal/modules/esm/loader');
const { pathToFileURL } = require('internal/url');
const {
Expand All @@ -23,13 +22,6 @@ exports.initializeImportMetaObject = function(wrap, meta) {
};

exports.importModuleDynamicallyCallback = async function(wrap, specifier) {
assert(calledInitialize === true || !userLoader);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion seems unrelated, should it be retained? Not sure how likely that mistake is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calledInitialize variable was entirely removed because this was what tracks if the warning has already been shown.

if (!calledInitialize) {
process.emitWarning(
'The ESM module loader is experimental.',
'ExperimentalWarning', undefined);
calledInitialize = true;
}
const { callbackMap } = internalBinding('module_wrap');
if (callbackMap.has(wrap)) {
const { importModuleDynamically } = callbackMap.get(wrap);
Expand All @@ -44,14 +36,8 @@ exports.importModuleDynamicallyCallback = async function(wrap, specifier) {
let ESMLoader = new Loader();
exports.ESMLoader = ESMLoader;

let calledInitialize = false;
exports.initializeLoader = initializeLoader;
async function initializeLoader() {
assert(calledInitialize === false);
process.emitWarning(
'The ESM module loader is experimental.',
'ExperimentalWarning', undefined);
calledInitialize = true;
if (!userLoader)
return;
let cwd;
Expand Down
3 changes: 0 additions & 3 deletions test/es-module/test-esm-dynamic-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ function expectFsNamespace(result) {
// For direct use of import expressions inside of CJS or ES modules, including
// via eval, all kinds of specifiers should work without issue.
(function testScriptOrModuleImport() {
common.expectWarning('ExperimentalWarning',
'The ESM module loader is experimental.');

// Importing another file, both direct & via eval
// expectOkNamespace(import(relativePath));
expectOkNamespace(eval(`import("${relativePath}")`));
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-nowarn-exports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ child.stderr.on('data', (data) => {
child.on('close', (code, signal) => {
strictEqual(code, 0);
strictEqual(signal, null);
ok(stderr.toString().includes(
ok(!stderr.toString().includes(
'ExperimentalWarning: The ESM module loader is experimental'
));
ok(!stderr.toString().includes(
Expand Down
2 changes: 0 additions & 2 deletions test/message/async_error_sync_esm.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(node:*) ExperimentalWarning: The ESM module loader is experimental.
(Use `node --trace-warnings ...` to show where the warning was created)
Error: test
at one (*fixtures*async-error.js:4:9)
at two (*fixtures*async-error.js:17:9)
Expand Down
2 changes: 0 additions & 2 deletions test/message/esm_display_syntax_error.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(node:*) ExperimentalWarning: The ESM module loader is experimental.
(Use `node --trace-warnings ...` to show where the warning was created)
file:///*/test/message/esm_display_syntax_error.mjs:2
await async () => 0;
^^^^^
Expand Down
2 changes: 0 additions & 2 deletions test/message/esm_display_syntax_error_import.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(node:*) ExperimentalWarning: The ESM module loader is experimental.
(Use `node --trace-warnings ...` to show where the warning was created)
file:///*/test/message/esm_display_syntax_error_import.mjs:5
notfound
^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions test/message/esm_display_syntax_error_import_module.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(node:*) ExperimentalWarning: The ESM module loader is experimental.
(Use `node --trace-warnings ...` to show where the warning was created)
file:///*/test/fixtures/es-module-loaders/syntax-error-import.mjs:1
import { foo, notfound } from './module-named-exports.mjs';
^^^^^^^^
Expand Down
4 changes: 1 addition & 3 deletions test/message/esm_display_syntax_error_module.out
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(node:*) ExperimentalWarning: The ESM module loader is experimental.
(Use `node --trace-warnings ...` to show where the warning was created)
file:///*/test/fixtures/es-module-loaders/syntax-error.mjs:2
await async () => 0;
^^^^^

SyntaxError: Unexpected reserved word
at Loader.moduleStrategy (internal/modules/esm/translators.js:*:*)
at Loader.moduleStrategy (internal/modules/esm/translators.js:*:*)
3 changes: 1 addition & 2 deletions test/message/esm_loader_not_found.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(node:*) ExperimentalWarning: The ESM module loader is experimental.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
internal/modules/run_main.js:*
internalBinding('errors').triggerUncaughtException(
^
Expand Down
3 changes: 1 addition & 2 deletions test/message/esm_loader_syntax_error.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(node:*) ExperimentalWarning: The ESM module loader is experimental.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
file://*/test/fixtures/es-module-loaders/syntax-error.mjs:2
await async () => 0;
^^^^^
Expand Down