Skip to content

Commit 0c7391c

Browse files
guybedfordBridgeAR
authored andcommittedApr 28, 2020
module: remove experimental modules warning
PR-URL: #31974 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 5dba49d commit 0c7391c

10 files changed

+4
-33
lines changed
 

‎lib/internal/process/esm_loader.js

-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const {
44
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
55
} = require('internal/errors').codes;
6-
const assert = require('internal/assert');
76
const { Loader } = require('internal/modules/esm/loader');
87
const { pathToFileURL } = require('internal/url');
98
const {
@@ -23,13 +22,6 @@ exports.initializeImportMetaObject = function(wrap, meta) {
2322
};
2423

2524
exports.importModuleDynamicallyCallback = async function(wrap, specifier) {
26-
assert(calledInitialize === true || !userLoader);
27-
if (!calledInitialize) {
28-
process.emitWarning(
29-
'The ESM module loader is experimental.',
30-
'ExperimentalWarning', undefined);
31-
calledInitialize = true;
32-
}
3325
const { callbackMap } = internalBinding('module_wrap');
3426
if (callbackMap.has(wrap)) {
3527
const { importModuleDynamically } = callbackMap.get(wrap);
@@ -44,14 +36,8 @@ exports.importModuleDynamicallyCallback = async function(wrap, specifier) {
4436
let ESMLoader = new Loader();
4537
exports.ESMLoader = ESMLoader;
4638

47-
let calledInitialize = false;
4839
exports.initializeLoader = initializeLoader;
4940
async function initializeLoader() {
50-
assert(calledInitialize === false);
51-
process.emitWarning(
52-
'The ESM module loader is experimental.',
53-
'ExperimentalWarning', undefined);
54-
calledInitialize = true;
5541
if (!userLoader)
5642
return;
5743
let cwd;

‎test/es-module/test-esm-dynamic-import.js

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ function expectFsNamespace(result) {
4242
// For direct use of import expressions inside of CJS or ES modules, including
4343
// via eval, all kinds of specifiers should work without issue.
4444
(function testScriptOrModuleImport() {
45-
common.expectWarning('ExperimentalWarning',
46-
'The ESM module loader is experimental.');
47-
4845
// Importing another file, both direct & via eval
4946
// expectOkNamespace(import(relativePath));
5047
expectOkNamespace(eval(`import("${relativePath}")`));

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ child.stderr.on('data', (data) => {
1616
child.on('close', (code, signal) => {
1717
strictEqual(code, 0);
1818
strictEqual(signal, null);
19-
ok(stderr.toString().includes(
19+
ok(!stderr.toString().includes(
2020
'ExperimentalWarning: The ESM module loader is experimental'
2121
));
2222
ok(!stderr.toString().includes(

‎test/message/async_error_sync_esm.out

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2-
(Use `node --trace-warnings ...` to show where the warning was created)
31
Error: test
42
at one (*fixtures*async-error.js:4:9)
53
at two (*fixtures*async-error.js:17:9)

‎test/message/esm_display_syntax_error.out

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2-
(Use `node --trace-warnings ...` to show where the warning was created)
31
file:///*/test/message/esm_display_syntax_error.mjs:2
42
await async () => 0;
53
^^^^^

‎test/message/esm_display_syntax_error_import.out

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2-
(Use `node --trace-warnings ...` to show where the warning was created)
31
file:///*/test/message/esm_display_syntax_error_import.mjs:5
42
notfound
53
^^^^^^^^

‎test/message/esm_display_syntax_error_import_module.out

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2-
(Use `node --trace-warnings ...` to show where the warning was created)
31
file:///*/test/fixtures/es-module-loaders/syntax-error-import.mjs:1
42
import { foo, notfound } from './module-named-exports.mjs';
53
^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2-
(Use `node --trace-warnings ...` to show where the warning was created)
31
file:///*/test/fixtures/es-module-loaders/syntax-error.mjs:2
42
await async () => 0;
53
^^^^^
64

75
SyntaxError: Unexpected reserved word
8-
at Loader.moduleStrategy (internal/modules/esm/translators.js:*:*)
6+
at Loader.moduleStrategy (internal/modules/esm/translators.js:*:*)

‎test/message/esm_loader_not_found.out

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2-
(Use `node --trace-warnings ...` to show where the warning was created)
31
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
2+
(Use `node --trace-warnings ...` to show where the warning was created)
43
internal/modules/run_main.js:*
54
internalBinding('errors').triggerUncaughtException(
65
^

‎test/message/esm_loader_syntax_error.out

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2-
(Use `node --trace-warnings ...` to show where the warning was created)
31
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
2+
(Use `node --trace-warnings ...` to show where the warning was created)
43
file://*/test/fixtures/es-module-loaders/syntax-error.mjs:2
54
await async () => 0;
65
^^^^^

0 commit comments

Comments
 (0)