Skip to content

Commit

Permalink
idna: use url module instead of punycode
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Mar 1, 2021
1 parent 5d240c5 commit 2efbc12
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/api/intl.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ option:
| `String.prototype.toLocale*Case()` | partial (not locale-aware) | full | full | full |
| [`Number.prototype.toLocaleString()`][] | partial (not locale-aware) | partial/full (depends on OS) | partial (English-only) | full |
| `Date.prototype.toLocale*String()` | partial (not locale-aware) | partial/full (depends on OS) | partial (English-only) | full |
| [Legacy URL Parser][] | partial (no IDN support) | full | full | full |
| [WHATWG URL Parser][] | partial (no IDN support) | full | full | full |
| [`require('buffer').transcode()`][] | none (function does not exist) | full | full | full |
| [REPL][] | partial (inaccurate line editing) | full | full | full |
Expand Down Expand Up @@ -195,6 +196,7 @@ to be helpful:
[ICU]: http://site.icu-project.org/
[REPL]: repl.md#repl_repl
[Test262]: https://github.com/tc39/test262/tree/HEAD/test/intl402
[Legacy URL parser]: url.md#url_legacy_url_api
[WHATWG URL parser]: url.md#url_the_whatwg_url_api
[`--icu-data-dir`]: cli.md#cli_icu_data_dir_file
[`Date.prototype.toLocaleString()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/idna.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ if (internalBinding('config').hasIntl) {
const { toASCII, toUnicode } = internalBinding('icu');
module.exports = { toASCII, toUnicode };
} else {
const { toASCII, toUnicode } = require('punycode');
module.exports = { toASCII, toUnicode };
const { domainToASCII, domainToUnicode } = require('internal/url');
module.exports = { toASCII: domainToASCII, toUnicode: domainToUnicode };
}
2 changes: 1 addition & 1 deletion test/parallel/test-bootstrap-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ if (!common.isMainThread) {
if (common.hasIntl) {
expectedModules.add('Internal Binding icu');
} else {
expectedModules.add('NativeModule punycode');
expectedModules.add('NativeModule url');
}

if (process.features.inspector) {
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-url-format.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const url = require('url');

if (!common.hasIntl)
common.skip('missing Intl');

// Formatting tests to verify that it'll format slightly wonky content to a
// valid URL.
const formatTests = {
Expand Down

0 comments on commit 2efbc12

Please sign in to comment.