Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
punycode: add pending deprecation
  • Loading branch information
aduh95 committed Apr 27, 2021
commit f6d0ee60c41c891b6e7d3358e2b57ce703ec131f
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -831,12 +831,15 @@ The [`require.extensions`][] property is deprecated.
### DEP0040: `punycode` module
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/35092
Comment thread
aduh95 marked this conversation as resolved.
Outdated
description: Added support for `--pending-deprecation`.
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/7941
description: Documentation-only deprecation.
-->

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

The [`punycode`][] module is deprecated. Please use a userland alternative
instead.
Expand Down
10 changes: 10 additions & 0 deletions lib/punycode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
'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',
);
}

/** Highest positive signed 32-bit float value */
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1

Expand Down
10 changes: 9 additions & 1 deletion test/parallel/test-punycode.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Flags: --pending-deprecation

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
Expand All @@ -20,7 +22,13 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');

const punycodeWarning =
'The `punycode` module is deprecated. Please use a userland alternative ' +
'instead.';
common.expectWarning('DeprecationWarning', punycodeWarning, 'DEP0040');

const punycode = require('punycode');
const assert = require('assert');

Expand Down