Skip to content

Commit fce8c32

Browse files
aduh95ruyadorno
authored andcommitted
util: do not mark experimental feature as deprecated
PR-URL: #55740 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent f11d93d commit fce8c32

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

doc/api/deprecations.md

+1-13
Original file line numberDiff line numberDiff line change
@@ -3685,18 +3685,7 @@ Instantiating classes without the `new` qualifier exported by the `node:repl` mo
36853685
It is recommended to use the `new` qualifier instead. This applies to all REPL classes, including
36863686
`REPLServer` and `Recoverable`.
36873687

3688-
### DEP0186: `util.getCallSite`
3689-
3690-
<!-- YAML
3691-
changes:
3692-
- version: REPLACEME
3693-
pr-url: https://github.com/nodejs/node/pull/55626
3694-
description: Runtime deprecation.
3695-
-->
3696-
3697-
Type: Runtime
3698-
3699-
The `util.getCallSite` API has been removed. Please use [`util.getCallSites()`][] instead.
3688+
<!-- md-lint skip-deprecation DEP0186 -->
37003689

37013690
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
37023691
[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()`][
38243813
[`url.parse()`]: url.md#urlparseurlstring-parsequerystring-slashesdenotehost
38253814
[`url.resolve()`]: url.md#urlresolvefrom-to
38263815
[`util._extend()`]: util.md#util_extendtarget-source
3827-
[`util.getCallSites()`]: util.md#utilgetcallsitesframecount
38283816
[`util.getSystemErrorName()`]: util.md#utilgetsystemerrornameerr
38293817
[`util.inspect()`]: util.md#utilinspectobject-options
38303818
[`util.inspect.custom`]: util.md#utilinspectcustom

doc/api/util.md

+4
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 });
370370
371371
<!-- YAML
372372
added: v22.9.0
373+
changes:
374+
- version: REPLACEME
375+
pr-url: https://github.com/nodejs/node/pull/55626
376+
description: The API is renamed from `util.getCallSite` to `util.getCallSites()`.
373377
-->
374378

375379
* `frameCount` {number} Number of frames to capture as call site objects.

lib/internal/util.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ function getDeprecationWarningEmitter(
105105
return function() {
106106
if (!warned && shouldEmitWarning()) {
107107
warned = true;
108-
if (code !== undefined) {
108+
if (code === 'ExperimentalWarning') {
109+
process.emitWarning(msg, code, deprecated);
110+
} else if (code !== undefined) {
109111
if (!codesWarned.has(code)) {
110112
const emitWarning = useEmitSync ?
111113
require('internal/process/warning').emitWarningSync :

lib/util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ module.exports = {
502502
// Deprecated getCallSite.
503503
// This API can be removed in next semver-minor release.
504504
getCallSite: deprecate(getCallSites,
505-
'The `util.getCallSite` API is deprecated. Please use `util.getCallSites()` instead.',
506-
'DEP0186'),
505+
'The `util.getCallSite` API has been renamed to `util.getCallSites()`.',
506+
'ExperimentalWarning'),
507507
getCallSites,
508508
getSystemErrorMap,
509509
getSystemErrorName,

test/parallel/test-util-getcallsite.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ require('../common');
44
const { getCallSite } = require('node:util');
55
const { expectWarning } = require('../common');
66

7-
const warning = 'The `util.getCallSite` API is deprecated. Please use `util.getCallSites()` instead.';
8-
expectWarning('DeprecationWarning', warning, 'DEP0186');
7+
const warning = 'The `util.getCallSite` API has been renamed to `util.getCallSites()`.';
8+
expectWarning('ExperimentalWarning', warning);
99
getCallSite();

0 commit comments

Comments
 (0)