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

lib: runtime deprecate punycode #47202

Merged
merged 1 commit into from
Apr 3, 2023
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
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,9 @@ The [`require.extensions`][] property is deprecated.

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/47202
description: Runtime deprecation.
- version: v16.6.0
pr-url: https://github.com/nodejs/node/pull/38444
description: Added support for `--pending-deprecation`.
Expand All @@ -880,7 +883,7 @@ changes:
description: Documentation-only deprecation.
-->

Type: Documentation-only (supports [`--pending-deprecation`][])
Type: Runtime

The [`punycode`][] module is deprecated. Please use a userland alternative
instead.
Expand Down
15 changes: 6 additions & 9 deletions lib/punycode.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
'use strict';

const { getOptionValue } = require('internal/options');
if (getOptionValue('--pending-deprecation')){
process.emitWarning(
'The `punycode` module is deprecated. Please use a userland ' +
'alternative instead.',
'DeprecationWarning',
'DEP0040',
);
}
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
4 changes: 2 additions & 2 deletions test/message/core_line_numbers.out
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
node:punycode:52
node:punycode:49
anonrig marked this conversation as resolved.
Show resolved Hide resolved
throw new RangeError(errors[type]);
^

RangeError: Invalid input
at error (node:punycode:52:8)
at error (node:punycode:49:8)
anonrig marked this conversation as resolved.
Show resolved Hide resolved
at Object.decode (node:punycode:*:*)
at Object.<anonymous> (*test*message*core_line_numbers.js:*:*)

Expand Down