domain-alive 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,13 +2,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
3
  var tldts = require('tldts');
4
4
  var dns2 = require('dns2');
5
- var _ = require('punycode/');
6
5
  var asyncRetry = require('foxts/async-retry');
7
6
  var net = require('node:net');
8
7
  var retrie = require('foxts/retrie');
9
8
  var extractErrorMessage = require('foxts/extract-error-message');
10
9
  var debug = require('debug');
11
10
  var shuffleArray = require('foxts/shuffle-array');
11
+ var url = require('url');
12
12
 
13
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
14
 
@@ -1139,7 +1139,8 @@ const whoiserNoWhoisSymbol = Symbol('"whoiser" library returns "No WHOIS data fo
1139
1139
  *
1140
1140
  * We expect this function to only be called within `isRegisterableDomainAlive`. If you are trying
1141
1141
  * to do this yourself, please implement the necessary extraction first, we recommend using both
1142
- * `punycode` & `tldts` library, which we also use in the `isRegisterableDomainAlive` function.
1142
+ * `require('node:url').domainToASCII` API & `tldts` library, which we also use in the
1143
+ * `isRegisterableDomainAlive` function.
1143
1144
  */ async function domainHasBeenRegistered(registerableDomain, options = {}) {
1144
1145
  const tld = tldts.getPublicSuffix(registerableDomain, getIcannTldOptions);
1145
1146
  if (!tld) {
@@ -1319,7 +1320,7 @@ const sharedNullResponse = Object.freeze({
1319
1320
  };
1320
1321
  const mutex = createAsyncMutex();
1321
1322
  return async function isRegisterableDomainAlive(domain) {
1322
- domain = _.toASCII(domain);
1323
+ domain = url.domainToASCII(domain);
1323
1324
  return mutex(domain, ()=>cacheApply(registerableDomainResultCache, domain, async ()=>{
1324
1325
  // Step 0: we normalize the domain and find the registerable part
1325
1326
  const registerableDomain = tldts.getDomain(domain, getRegisterableDomainTldtsOption);
@@ -1423,7 +1424,7 @@ function createDomainAliveChecker(options = {}) {
1423
1424
  };
1424
1425
  const mutex = createAsyncMutex();
1425
1426
  return async function isDomainAlive(domain) {
1426
- domain = _.toASCII(domain);
1427
+ domain = url.domainToASCII(domain);
1427
1428
  const registerableDomainAliveResult = await isRegisterableDomainAlive(domain);
1428
1429
  if (registerableDomainAliveResult.registerableDomain === null) {
1429
1430
  return sharedNullishResult;
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { getPublicSuffix, getDomain } from 'tldts';
2
2
  import { UDPClient, TCPClient, DOHClient } from 'dns2';
3
- import { toASCII as toASCII$1 } from 'punycode/';
4
3
  import { asyncRetry } from 'foxts/async-retry';
5
4
  import net from 'node:net';
6
5
  import { createRetrieKeywordFilter } from 'foxts/retrie';
7
6
  import { extractErrorMessage } from 'foxts/extract-error-message';
8
7
  import debug from 'debug';
9
8
  import { shuffleArray } from 'foxts/shuffle-array';
9
+ import { domainToASCII } from 'url';
10
10
 
11
11
  const defaultDnsServers = [
12
12
  'https://1.1.1.1',
@@ -1132,7 +1132,8 @@ const whoiserNoWhoisSymbol = Symbol('"whoiser" library returns "No WHOIS data fo
1132
1132
  *
1133
1133
  * We expect this function to only be called within `isRegisterableDomainAlive`. If you are trying
1134
1134
  * to do this yourself, please implement the necessary extraction first, we recommend using both
1135
- * `punycode` & `tldts` library, which we also use in the `isRegisterableDomainAlive` function.
1135
+ * `require('node:url').domainToASCII` API & `tldts` library, which we also use in the
1136
+ * `isRegisterableDomainAlive` function.
1136
1137
  */ async function domainHasBeenRegistered(registerableDomain, options = {}) {
1137
1138
  const tld = getPublicSuffix(registerableDomain, getIcannTldOptions);
1138
1139
  if (!tld) {
@@ -1312,7 +1313,7 @@ const sharedNullResponse = Object.freeze({
1312
1313
  };
1313
1314
  const mutex = createAsyncMutex();
1314
1315
  return async function isRegisterableDomainAlive(domain) {
1315
- domain = toASCII$1(domain);
1316
+ domain = domainToASCII(domain);
1316
1317
  return mutex(domain, ()=>cacheApply(registerableDomainResultCache, domain, async ()=>{
1317
1318
  // Step 0: we normalize the domain and find the registerable part
1318
1319
  const registerableDomain = getDomain(domain, getRegisterableDomainTldtsOption);
@@ -1416,7 +1417,7 @@ function createDomainAliveChecker(options = {}) {
1416
1417
  };
1417
1418
  const mutex = createAsyncMutex();
1418
1419
  return async function isDomainAlive(domain) {
1419
- domain = toASCII$1(domain);
1420
+ domain = domainToASCII(domain);
1420
1421
  const registerableDomainAliveResult = await isRegisterableDomainAlive(domain);
1421
1422
  if (registerableDomainAliveResult.registerableDomain === null) {
1422
1423
  return sharedNullishResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domain-alive",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "A Node.js library for checking if an FQDN (Fully Qualified Domain Name) is alive or not, uses a combination techniques of `NS` records, WHOIS/RDAP lookups, `A/AAAA` records",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,6 @@
33
33
  "debug": "4.4.1",
34
34
  "dns2": "github:lsongdev/node-dns#3adb7e91b3101c0e4f43ebaca3a568269ea04d11",
35
35
  "foxts": "^4.1.0",
36
- "punycode": "^2.3.1",
37
36
  "tldts": "^7.0.16"
38
37
  },
39
38
  "devDependencies": {
@@ -42,7 +41,6 @@
42
41
  "@types/debug": "^4.1.12",
43
42
  "@types/dns2": "^2.0.10",
44
43
  "@types/node": "^24.6.2",
45
- "@types/punycode": "^2.1.4",
46
44
  "bumpp": "^10.2.3",
47
45
  "bunchee": "^6.6.0",
48
46
  "eslint": "^9.37.0",