Skip to content

Commit 3a9733c

Browse files
committed
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 db0d648 commit 3a9733c

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
@@ -3754,18 +3754,7 @@ Instantiating classes without the `new` qualifier exported by the `node:repl` mo
37543754
It is recommended to use the `new` qualifier instead. This applies to all REPL classes, including
37553755
`REPLServer` and `Recoverable`.
37563756

3757-
### DEP0186: `util.getCallSite`
3758-
3759-
<!-- YAML
3760-
changes:
3761-
- version: REPLACEME
3762-
pr-url: https://github.com/nodejs/node/pull/55626
3763-
description: Runtime deprecation.
3764-
-->
3765-
3766-
Type: Runtime
3767-
3768-
The `util.getCallSite` API has been removed. Please use [`util.getCallSites()`][] instead.
3757+
<!-- md-lint skip-deprecation DEP0186 -->
37693758

37703759
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
37713760
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -3892,7 +3881,6 @@ The `util.getCallSite` API has been removed. Please use [`util.getCallSites()`][
38923881
[`url.parse()`]: url.md#urlparseurlstring-parsequerystring-slashesdenotehost
38933882
[`url.resolve()`]: url.md#urlresolvefrom-to
38943883
[`util._extend()`]: util.md#util_extendtarget-source
3895-
[`util.getCallSites()`]: util.md#utilgetcallsitesframecountoroptions-options
38963884
[`util.getSystemErrorName()`]: util.md#utilgetsystemerrornameerr
38973885
[`util.inspect()`]: util.md#utilinspectobject-options
38983886
[`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} Optional number of frames to capture as call site objects.

lib/internal/util.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ function getDeprecationWarningEmitter(
107107
return function() {
108108
if (!warned && shouldEmitWarning()) {
109109
warned = true;
110-
if (code !== undefined) {
110+
if (code === 'ExperimentalWarning') {
111+
process.emitWarning(msg, code, deprecated);
112+
} else if (code !== undefined) {
111113
if (!codesWarned.has(code)) {
112114
const emitWarning = useEmitSync ?
113115
require('internal/process/warning').emitWarningSync :

lib/util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ module.exports = {
436436
// Deprecated getCallSite.
437437
// This API can be removed in next semver-minor release.
438438
getCallSite: deprecate(getCallSites,
439-
'The `util.getCallSite` API is deprecated. Please use `util.getCallSites()` instead.',
440-
'DEP0186'),
439+
'The `util.getCallSite` API has been renamed to `util.getCallSites()`.',
440+
'ExperimentalWarning'),
441441
getCallSites,
442442
getSystemErrorMap,
443443
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)