Skip to content

Commit

Permalink
module: remove experimental modules warning
Browse files Browse the repository at this point in the history
PR-URL: #31974
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
guybedford authored and BridgeAR committed Apr 28, 2020
1 parent 5dba49d commit 0c7391c
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 33 deletions.
14 changes: 0 additions & 14 deletions lib/internal/process/esm_loader.js
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);
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
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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

0 comments on commit 0c7391c

Please sign in to comment.