From 64287e4d459f771d9aa03fc65441f1ddf12c2535 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 15 Sep 2021 01:09:47 -0700 Subject: [PATCH] module: runtime deprecate trailing slash patterns PR-URL: https://github.com/nodejs/node/pull/40117 Reviewed-By: Antoine du Hamel Reviewed-By: James M Snell --- doc/api/deprecations.md | 5 ++++- lib/internal/modules/esm/resolve.js | 2 -- test/es-module/test-esm-exports-deprecations.mjs | 1 - test/es-module/test-esm-local-deprecations.mjs | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index c0f1d38d555..d1ed3a23c26 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2820,13 +2820,16 @@ and `'mgf1HashAlgorithm'`. ### DEP0155: Trailing slashes in pattern specifier resolutions -Type: Documentation-only (supports [`--pending-deprecation`][]) +Type: Runtime The remapping of specifiers ending in `"/"` like `import 'pkg/x/'` is deprecated for package `"exports"` and `"imports"` pattern resolutions. diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index b0a7cec5c59..dcb7d10a479 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -39,7 +39,6 @@ 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, @@ -107,7 +106,6 @@ 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 8c7a07b0204..fd92dd3d78d 100644 --- a/test/es-module/test-esm-exports-deprecations.mjs +++ b/test/es-module/test-esm-exports-deprecations.mjs @@ -1,4 +1,3 @@ -// 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 8d946b6650e..a9030b40912 100644 --- a/test/es-module/test-esm-local-deprecations.mjs +++ b/test/es-module/test-esm-local-deprecations.mjs @@ -1,5 +1,3 @@ -// Flags: --pending-deprecation - import '../common/index.mjs'; import assert from 'assert'; import fixtures from '../common/fixtures.js';