mirror of https://github.com/nodejs/node.git
punycode: limit deprecation warning
DEP0040 is an extremely annoying warning. Most of the people seeing it cannot do anything about it. This commit updates the warning logic to only emit outside of node_modules. This is similar to other warnings such as the Buffer() constructor warning. Ideally, this should be backported to Node 22. Refs: https://github.com/nodejs/node/pull/47202 PR-URL: https://github.com/nodejs/node/pull/56632 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>actions/tools-update-zlib
parent
6f946c95b9
commit
840f952268
|
@ -1,11 +1,16 @@
|
|||
'use strict';
|
||||
const {
|
||||
isInsideNodeModules,
|
||||
} = internalBinding('util');
|
||||
|
||||
process.emitWarning(
|
||||
'The `punycode` module is deprecated. Please use a userland ' +
|
||||
'alternative instead.',
|
||||
'DeprecationWarning',
|
||||
'DEP0040',
|
||||
);
|
||||
if (!isInsideNodeModules(100, true)) {
|
||||
process.emitWarning(
|
||||
'The `punycode` module is deprecated. Please use a userland ' +
|
||||
'alternative instead.',
|
||||
'DeprecationWarning',
|
||||
'DEP0040',
|
||||
);
|
||||
}
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
node:punycode:49
|
||||
node:punycode:54
|
||||
throw new RangeError(errors[type]);
|
||||
^
|
||||
|
||||
RangeError: Invalid input
|
||||
at error (node:punycode:49:8)
|
||||
at Object.decode (node:punycode:242:5)
|
||||
at error (node:punycode:54:8)
|
||||
at Object.decode (node:punycode:247:5)
|
||||
at Object.<anonymous> (*core_line_numbers.js:13:10)
|
||||
|
||||
Node.js *
|
||||
|
|
Loading…
Reference in New Issue