mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 07:07:33 +00:00
feat: remove punycode package (#630)
* feat: remove punycode package * fix(deno): specify node scope in import
This commit is contained in:
parent
ba2f373986
commit
54f51ebc73
3 changed files with 9 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import dns from 'node:dns'
|
||||
import { isIP } from 'node:net'
|
||||
import punycode from 'punycode/punycode.js'
|
||||
import { domainToASCII } from 'node:url'
|
||||
|
||||
export default class DnsResolver {
|
||||
/**
|
||||
|
|
@ -30,7 +30,11 @@ export default class DnsResolver {
|
|||
return { address: host }
|
||||
}
|
||||
|
||||
const asciiForm = punycode.toASCII(host)
|
||||
const asciiForm = domainToASCII(host)
|
||||
if (!asciiForm) {
|
||||
throw new Error('Invalid domain')
|
||||
}
|
||||
|
||||
if (asciiForm !== host) {
|
||||
this.logger.debug('Encoded punycode: ' + host + ' -> ' + asciiForm)
|
||||
host = asciiForm
|
||||
|
|
|
|||
5
package-lock.json
generated
5
package-lock.json
generated
|
|
@ -15,7 +15,6 @@
|
|||
"iconv-lite": "0.6.3",
|
||||
"long": "5.2.3",
|
||||
"minimist": "1.2.8",
|
||||
"punycode": "2.3.1",
|
||||
"seek-bzip": "2.0.0",
|
||||
"varint": "6.0.0"
|
||||
},
|
||||
|
|
@ -2839,6 +2838,7 @@
|
|||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
|
|
@ -5440,7 +5440,8 @@
|
|||
"punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"dev": true
|
||||
},
|
||||
"queue-microtask": {
|
||||
"version": "1.2.3",
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@
|
|||
"iconv-lite": "0.6.3",
|
||||
"long": "5.2.3",
|
||||
"minimist": "1.2.8",
|
||||
"punycode": "2.3.1",
|
||||
"seek-bzip": "2.0.0",
|
||||
"varint": "6.0.0"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue