From 581bb51368e7e91adaee63338f789b6b00fba4db Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 8 Nov 2024 16:16:15 +0000 Subject: [PATCH] util: do not mark experimental feature as deprecated PR-URL: https://github.com/nodejs/node/pull/55740 Reviewed-By: Chengzhong Wu Reviewed-By: Chemi Atlow Reviewed-By: Marco Ippolito --- doc/api/deprecations.md | 14 +------------- doc/api/util.md | 4 ++++ lib/internal/util.js | 4 +++- lib/util.js | 4 ++-- test/parallel/test-util-getcallsite.js | 4 ++-- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 0c78de426b2f08..4a8a882ab84f11 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3685,18 +3685,7 @@ Instantiating classes without the `new` qualifier exported by the `node:repl` mo It is recommended to use the `new` qualifier instead. This applies to all REPL classes, including `REPLServer` and `Recoverable`. -### DEP0186: `util.getCallSite` - - - -Type: Runtime - -The `util.getCallSite` API has been removed. Please use [`util.getCallSites()`][] instead. + [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 @@ -3824,7 +3813,6 @@ The `util.getCallSite` API has been removed. Please use [`util.getCallSites()`][ [`url.parse()`]: url.md#urlparseurlstring-parsequerystring-slashesdenotehost [`url.resolve()`]: url.md#urlresolvefrom-to [`util._extend()`]: util.md#util_extendtarget-source -[`util.getCallSites()`]: util.md#utilgetcallsitesframecount [`util.getSystemErrorName()`]: util.md#utilgetsystemerrornameerr [`util.inspect()`]: util.md#utilinspectobject-options [`util.inspect.custom`]: util.md#utilinspectcustom diff --git a/doc/api/util.md b/doc/api/util.md index cf9d5ca8ad1f37..9fb1c04ed11f55 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -370,6 +370,10 @@ util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); * `frameCount` {number} Number of frames to capture as call site objects. diff --git a/lib/internal/util.js b/lib/internal/util.js index 14ce9fcfc95490..58294a9ece274f 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -105,7 +105,9 @@ function getDeprecationWarningEmitter( return function() { if (!warned && shouldEmitWarning()) { warned = true; - if (code !== undefined) { + if (code === 'ExperimentalWarning') { + process.emitWarning(msg, code, deprecated); + } else if (code !== undefined) { if (!codesWarned.has(code)) { const emitWarning = useEmitSync ? require('internal/process/warning').emitWarningSync : diff --git a/lib/util.js b/lib/util.js index e289999df90207..574855401d7ae5 100644 --- a/lib/util.js +++ b/lib/util.js @@ -502,8 +502,8 @@ module.exports = { // Deprecated getCallSite. // This API can be removed in next semver-minor release. getCallSite: deprecate(getCallSites, - 'The `util.getCallSite` API is deprecated. Please use `util.getCallSites()` instead.', - 'DEP0186'), + 'The `util.getCallSite` API has been renamed to `util.getCallSites()`.', + 'ExperimentalWarning'), getCallSites, getSystemErrorMap, getSystemErrorName, diff --git a/test/parallel/test-util-getcallsite.js b/test/parallel/test-util-getcallsite.js index 5c9570fe32d42b..34b52e9b20a6bb 100644 --- a/test/parallel/test-util-getcallsite.js +++ b/test/parallel/test-util-getcallsite.js @@ -4,6 +4,6 @@ require('../common'); const { getCallSite } = require('node:util'); const { expectWarning } = require('../common'); -const warning = 'The `util.getCallSite` API is deprecated. Please use `util.getCallSites()` instead.'; -expectWarning('DeprecationWarning', warning, 'DEP0186'); +const warning = 'The `util.getCallSite` API has been renamed to `util.getCallSites()`.'; +expectWarning('ExperimentalWarning', warning); getCallSite();