Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1ff956f

Browse filesBrowse files
guybedfordMylesBorins
authored andcommitted
module: remove experimental modules warning
Backport-PR-URL: #35757 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>
1 parent 985b96a commit 1ff956f
Copy full SHA for 1ff956f
Expand file treeCollapse file tree

12 files changed

+4
-32
lines changed
Open diff view settings
Collapse file

‎lib/internal/process/esm_loader.js‎

Copy file name to clipboardExpand all lines: lib/internal/process/esm_loader.js
+3-19Lines changed: 3 additions & 19 deletions
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 {
98
hasUncaughtExceptionCaptureCallback,
@@ -26,13 +25,6 @@ exports.initializeImportMetaObject = function(wrap, meta) {
2625
};
2726

2827
exports.importModuleDynamicallyCallback = async function(wrap, specifier) {
29-
assert(calledInitialize === true || !userLoader);
30-
if (!calledInitialize) {
31-
process.emitWarning(
32-
'The ESM module loader is experimental.',
33-
'ExperimentalWarning', undefined);
34-
calledInitialize = true;
35-
}
3628
const { callbackMap } = internalBinding('module_wrap');
3729
if (callbackMap.has(wrap)) {
3830
const { importModuleDynamically } = callbackMap.get(wrap);
@@ -47,15 +39,7 @@ exports.importModuleDynamicallyCallback = async function(wrap, specifier) {
4739
let ESMLoader = new Loader();
4840
exports.ESMLoader = ESMLoader;
4941

50-
let calledInitialize = false;
51-
async function initializeLoader(emitWarning) {
52-
assert(calledInitialize === false);
53-
if (emitWarning) {
54-
process.emitWarning(
55-
'The ESM module loader is experimental.',
56-
'ExperimentalWarning', undefined);
57-
}
58-
calledInitialize = true;
42+
async function initializeLoader() {
5943
if (!userLoader)
6044
return;
6145
let cwd;
@@ -78,9 +62,9 @@ async function initializeLoader(emitWarning) {
7862
})();
7963
}
8064

81-
exports.loadESM = async function loadESM(callback, emitWarning = true) {
65+
exports.loadESM = async function loadESM(callback) {
8266
try {
83-
await initializeLoader(emitWarning);
67+
await initializeLoader();
8468
await callback(ESMLoader);
8569
} catch (err) {
8670
if (hasUncaughtExceptionCaptureCallback()) {
Collapse file

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

Copy file name to clipboardExpand all lines: test/es-module/test-esm-dynamic-import.js
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ function expectFsNamespace(result) {
3838
// For direct use of import expressions inside of CJS or ES modules, including
3939
// via eval, all kinds of specifiers should work without issue.
4040
(function testScriptOrModuleImport() {
41-
common.expectWarning('ExperimentalWarning',
42-
'The ESM module loader is experimental.');
43-
4441
// Importing another file, both direct & via eval
4542
// expectOkNamespace(import(relativePath));
4643
expectOkNamespace(eval(`import("${relativePath}")`));
Collapse file

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

Copy file name to clipboardExpand all lines: test/es-module/test-esm-nowarn-exports.mjs
+1-1Lines changed: 1 addition & 1 deletion
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(
Collapse file

‎test/message/async_error_sync_esm.out‎

Copy file name to clipboardExpand all lines: test/message/async_error_sync_esm.out
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
21
Error: test
32
at one (*fixtures*async-error.js:4:9)
43
at two (*fixtures*async-error.js:17:9)
Collapse file

‎test/message/esm_display_syntax_error.out‎

Copy file name to clipboardExpand all lines: test/message/esm_display_syntax_error.out
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
21
file:///*/test/message/esm_display_syntax_error.mjs:2
32
await async () => 0;
43
^^^^^
Collapse file

‎test/message/esm_display_syntax_error_import.out‎

Copy file name to clipboardExpand all lines: test/message/esm_display_syntax_error_import.out
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
21
file:///*/test/message/esm_display_syntax_error_import.mjs:5
32
notfound
43
^^^^^^^^
Collapse file

‎test/message/esm_display_syntax_error_import_module.out‎

Copy file name to clipboardExpand all lines: test/message/esm_display_syntax_error_import_module.out
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
21
file:///*/test/fixtures/es-module-loaders/syntax-error-import.mjs:1
32
import { foo, notfound } from './module-named-exports.mjs';
43
^^^^^^^^
Collapse file

‎test/message/esm_display_syntax_error_module.out‎

Copy file name to clipboardExpand all lines: test/message/esm_display_syntax_error_module.out
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
21
file:///*/test/fixtures/es-module-loaders/syntax-error.mjs:2
32
await async () => 0;
43
^^^^^
Collapse file

‎test/message/esm_loader_not_found.out‎

Copy file name to clipboardExpand all lines: test/message/esm_loader_not_found.out
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
21
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
32
internal/process/esm_loader.js:*
43
internalBinding('errors').triggerUncaughtException(
Collapse file

‎test/message/esm_loader_not_found_cjs_hint_bare.out‎

Copy file name to clipboardExpand all lines: test/message/esm_loader_not_found_cjs_hint_bare.out
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(node:*) ExperimentalWarning: The ESM module loader is experimental.
21
internal/process/esm_loader.js:*
32
internalBinding('errors').triggerUncaughtException(
43
^

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.