From c3a6af200c1f3f422a29b6e9754192bcda84b59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Louren=C3=A7o?= Date: Wed, 31 May 2023 21:17:51 -0300 Subject: [PATCH] lib: add hot path for noDeprecation for esm --- benchmark/esm/esm-loader-defaultResolve.js | 2 +- lib/internal/modules/esm/resolve.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/benchmark/esm/esm-loader-defaultResolve.js b/benchmark/esm/esm-loader-defaultResolve.js index 85409a122637d5..8b48f457b58f29 100644 --- a/benchmark/esm/esm-loader-defaultResolve.js +++ b/benchmark/esm/esm-loader-defaultResolve.js @@ -26,7 +26,7 @@ const configs = { }; const options = { - flags: ['--expose-internals'], + flags: ['--expose-internals', '--no-deprecation'], }; const bench = common.createBenchmark(main, configs, options); diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 927b118f8ede2b..4078e5f1e4eeb7 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -103,6 +103,10 @@ function emitInvalidSegmentDeprecation(target, request, match, pjsonUrl, interna * @returns {void} */ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) { + if (process.noDeprecation) { + return; + } + const format = defaultGetFormatWithoutErrors(url); if (format !== 'module') return;