From 0c7391c9b8dcedc7b08dfc027a02f740601ec6e1 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 26 Feb 2020 22:32:08 +0200 Subject: [PATCH] module: remove experimental modules warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/31974 Reviewed-By: Myles Borins Reviewed-By: Jan Krems Reviewed-By: Geoffrey Booth Reviewed-By: Michaƫl Zasso --- lib/internal/process/esm_loader.js | 14 -------------- test/es-module/test-esm-dynamic-import.js | 3 --- test/es-module/test-esm-nowarn-exports.mjs | 2 +- test/message/async_error_sync_esm.out | 2 -- test/message/esm_display_syntax_error.out | 2 -- test/message/esm_display_syntax_error_import.out | 2 -- .../esm_display_syntax_error_import_module.out | 2 -- test/message/esm_display_syntax_error_module.out | 4 +--- test/message/esm_loader_not_found.out | 3 +-- test/message/esm_loader_syntax_error.out | 3 +-- 10 files changed, 4 insertions(+), 33 deletions(-) diff --git a/lib/internal/process/esm_loader.js b/lib/internal/process/esm_loader.js index cca1e3e07956a1..996532a930496f 100644 --- a/lib/internal/process/esm_loader.js +++ b/lib/internal/process/esm_loader.js @@ -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 { @@ -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); @@ -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; diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index e01b86eed143ed..e72922d31c0b18 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -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}")`)); diff --git a/test/es-module/test-esm-nowarn-exports.mjs b/test/es-module/test-esm-nowarn-exports.mjs index 13bfaf9b4f3527..5e0927f4674f84 100644 --- a/test/es-module/test-esm-nowarn-exports.mjs +++ b/test/es-module/test-esm-nowarn-exports.mjs @@ -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( diff --git a/test/message/async_error_sync_esm.out b/test/message/async_error_sync_esm.out index abaa2524cff3b8..6054fc7cc22de0 100644 --- a/test/message/async_error_sync_esm.out +++ b/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) diff --git a/test/message/esm_display_syntax_error.out b/test/message/esm_display_syntax_error.out index 382d459c2e67dd..b7d2008540adf3 100644 --- a/test/message/esm_display_syntax_error.out +++ b/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; ^^^^^ diff --git a/test/message/esm_display_syntax_error_import.out b/test/message/esm_display_syntax_error_import.out index d24891bd2c0df0..387a63a734b512 100644 --- a/test/message/esm_display_syntax_error_import.out +++ b/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 ^^^^^^^^ diff --git a/test/message/esm_display_syntax_error_import_module.out b/test/message/esm_display_syntax_error_import_module.out index aaf65069bc4f18..ae8b99d55fef20 100644 --- a/test/message/esm_display_syntax_error_import_module.out +++ b/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'; ^^^^^^^^ diff --git a/test/message/esm_display_syntax_error_module.out b/test/message/esm_display_syntax_error_module.out index c22bf0437c56a7..708257fcaf5792 100644 --- a/test/message/esm_display_syntax_error_module.out +++ b/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:*:*) \ No newline at end of file diff --git a/test/message/esm_loader_not_found.out b/test/message/esm_loader_not_found.out index 0949c4d0e3ace6..1d2aa957150082 100644 --- a/test/message/esm_loader_not_found.out +++ b/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( ^ diff --git a/test/message/esm_loader_syntax_error.out b/test/message/esm_loader_syntax_error.out index cde6bd0aa811f8..3aee72d423b1a1 100644 --- a/test/message/esm_loader_syntax_error.out +++ b/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; ^^^^^