diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index c9bfabdaefe8ea..a7b70b6b567d5f 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2815,6 +2815,12 @@ The `'hash'` and `'mgf1Hash'` options are replaced with `'hashAlgorithm'` and `'mgf1HashAlgorithm'`. ### DEP0155: Trailing slashes in pattern specifier resolutions + Type: Runtime diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 05e68e38a871e3..627e17afce69d9 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -40,6 +40,7 @@ const { sep, relative, resolve } = require('path'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const typeFlag = getOptionValue('--input-type'); +const pendingDeprecation = getOptionValue('--pending-deprecation'); const { URL, pathToFileURL, fileURLToPath } = require('internal/url'); const { ERR_INPUT_TYPE_NOT_ALLOWED, @@ -98,6 +99,7 @@ function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { } function emitTrailingSlashPatternDeprecation(match, pjsonUrl, isExports, base) { + if (!pendingDeprecation) return; const pjsonPath = fileURLToPath(pjsonUrl); if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return; diff --git a/test/es-module/test-esm-exports-deprecations.mjs b/test/es-module/test-esm-exports-deprecations.mjs index 58146d4300a69c..48c191a5fab2df 100644 --- a/test/es-module/test-esm-exports-deprecations.mjs +++ b/test/es-module/test-esm-exports-deprecations.mjs @@ -1,3 +1,4 @@ +// Flags: --pending-deprecation import { mustCall } from '../common/index.mjs'; import assert from 'assert'; diff --git a/test/es-module/test-esm-local-deprecations.mjs b/test/es-module/test-esm-local-deprecations.mjs index a9030b40912ddb..8d946b6650ed3b 100644 --- a/test/es-module/test-esm-local-deprecations.mjs +++ b/test/es-module/test-esm-local-deprecations.mjs @@ -1,3 +1,5 @@ +// Flags: --pending-deprecation + import '../common/index.mjs'; import assert from 'assert'; import fixtures from '../common/fixtures.js';