From b88ad687328d3234ebd6781934830fcbe95fd707 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 15 Sep 2021 01:09:47 -0700 Subject: [PATCH 1/2] module: runtime deprecate trailing slash patterns --- doc/api/deprecations.md | 6 +++++- 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, 5 insertions(+), 6 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index e25e855c085e9b..3bb130ba47ab66 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2816,6 +2816,10 @@ 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 167f55ab3e9115..1f40fe4f09c438 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -40,7 +40,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, @@ -108,7 +107,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 8c7a07b0204b9a..fd92dd3d78d14e 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 8d946b6650ed3b..a9030b40912ddb 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'; From ca1a75d97f9e7dfeb07bff9ddfd566bb12943187 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 15 Sep 2021 01:19:32 -0700 Subject: [PATCH 2/2] fixup: code review Co-authored-by: Antoine du Hamel --- doc/api/deprecations.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 3bb130ba47ab66..0c64468e1f8116 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2818,9 +2818,8 @@ and `'mgf1HashAlgorithm'`.