Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

punycode: limit deprecation warning #56632

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions lib/punycode.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
'use strict';

process.emitWarning(
'The `punycode` module is deprecated. Please use a userland ' +
'alternative instead.',
'DeprecationWarning',
'DEP0040',
);
const {
isInsideNodeModules,
} = internalBinding('util');

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
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/errors/core_line_numbers.snapshot
Original file line number Diff line number Diff line change
@@ -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