mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
module: remove experimental modules warning
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
5e807c1fd2
commit
22b6997aba
@ -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;
|
||||
|
@ -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}")`));
|
||||
|
@ -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(
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
^^^^^
|
||||
|
@ -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
|
||||
^^^^^^^^
|
||||
|
@ -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';
|
||||
^^^^^^^^
|
||||
|
@ -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:*:*)
|
@ -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(
|
||||
^
|
||||
|
@ -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;
|
||||
^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user