domain-alive 0.1.8 → 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,17 +2,16 @@ 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
- var asyncRetry = require('async-retry');
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
 
15
- var asyncRetry__default = /*#__PURE__*/_interopDefault(asyncRetry);
16
15
  var net__default = /*#__PURE__*/_interopDefault(net);
17
16
  var debug__default = /*#__PURE__*/_interopDefault(debug);
18
17
 
@@ -1140,7 +1139,8 @@ const whoiserNoWhoisSymbol = Symbol('"whoiser" library returns "No WHOIS data fo
1140
1139
  *
1141
1140
  * We expect this function to only be called within `isRegisterableDomainAlive`. If you are trying
1142
1141
  * to do this yourself, please implement the necessary extraction first, we recommend using both
1143
- * `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.
1144
1144
  */ async function domainHasBeenRegistered(registerableDomain, options = {}) {
1145
1145
  const tld = tldts.getPublicSuffix(registerableDomain, getIcannTldOptions);
1146
1146
  if (!tld) {
@@ -1157,7 +1157,7 @@ const whoiserNoWhoisSymbol = Symbol('"whoiser" library returns "No WHOIS data fo
1157
1157
  };
1158
1158
  let whois;
1159
1159
  try {
1160
- whois = await asyncRetry__default.default((bail)=>whoisDomain(registerableDomain, {
1160
+ whois = await asyncRetry.asyncRetry((bail)=>whoisDomain(registerableDomain, {
1161
1161
  raw: true,
1162
1162
  timeout,
1163
1163
  host: cachedWhoisServer || undefined
@@ -1320,7 +1320,7 @@ const sharedNullResponse = Object.freeze({
1320
1320
  };
1321
1321
  const mutex = createAsyncMutex();
1322
1322
  return async function isRegisterableDomainAlive(domain) {
1323
- domain = _.toASCII(domain);
1323
+ domain = url.domainToASCII(domain);
1324
1324
  return mutex(domain, ()=>cacheApply(registerableDomainResultCache, domain, async ()=>{
1325
1325
  // Step 0: we normalize the domain and find the registerable part
1326
1326
  const registerableDomain = tldts.getDomain(domain, getRegisterableDomainTldtsOption);
@@ -1364,7 +1364,7 @@ tencentcloud.com. 86400 IN SOA ns-tel1.qq.com. webmaster.qq.com. 165111089
1364
1364
  const resolve = shuffledDnsClients[attempts % shuffledDnsClients.length];
1365
1365
  try {
1366
1366
  // eslint-disable-next-line no-await-in-loop -- attempt servers one by one
1367
- const resp = await asyncRetry__default.default(()=>resolve(registerableDomain, 'NS'), dnsRetryOption);
1367
+ const resp = await asyncRetry.asyncRetry(()=>resolve(registerableDomain, 'NS'), dnsRetryOption);
1368
1368
  // if we found any NS records, the domain is alive
1369
1369
  if (resp.answers.length > 0) {
1370
1370
  confirmations++;
@@ -1424,7 +1424,7 @@ function createDomainAliveChecker(options = {}) {
1424
1424
  };
1425
1425
  const mutex = createAsyncMutex();
1426
1426
  return async function isDomainAlive(domain) {
1427
- domain = _.toASCII(domain);
1427
+ domain = url.domainToASCII(domain);
1428
1428
  const registerableDomainAliveResult = await isRegisterableDomainAlive(domain);
1429
1429
  if (registerableDomainAliveResult.registerableDomain === null) {
1430
1430
  return sharedNullishResult;
@@ -1464,7 +1464,7 @@ function createDomainAliveChecker(options = {}) {
1464
1464
  const resolve = shuffledDnsClients[attempts % shuffledDnsClients.length];
1465
1465
  try {
1466
1466
  // eslint-disable-next-line no-await-in-loop -- attempt servers one by one
1467
- const resp = await asyncRetry__default.default(()=>resolve(domain, 'A'), dnsRetryOption);
1467
+ const resp = await asyncRetry.asyncRetry(()=>resolve(domain, 'A'), dnsRetryOption);
1468
1468
  // if we found any NS records, the domain is alive
1469
1469
  if (resp.answers.length > 0) {
1470
1470
  confirmations++;
@@ -1497,7 +1497,7 @@ function createDomainAliveChecker(options = {}) {
1497
1497
  const resolve = shuffledDnsClients[attempts % shuffledDnsClients.length];
1498
1498
  try {
1499
1499
  // eslint-disable-next-line no-await-in-loop -- attempt servers one by one
1500
- const resp = await asyncRetry__default.default(()=>resolve(domain, 'AAAA'), dnsRetryOption);
1500
+ const resp = await asyncRetry.asyncRetry(()=>resolve(domain, 'AAAA'), dnsRetryOption);
1501
1501
  // if we found any NS records, the domain is alive
1502
1502
  if (resp.answers.length > 0) {
1503
1503
  confirmations++;
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
- import asyncRetry from 'async-retry';
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.8",
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",
@@ -30,27 +30,23 @@
30
30
  "author": "SukkaW <https://skk.moe>",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "async-retry": "^1.3.3",
34
33
  "debug": "4.4.1",
35
34
  "dns2": "github:lsongdev/node-dns#3adb7e91b3101c0e4f43ebaca3a568269ea04d11",
36
- "foxts": "^3.13.0",
37
- "punycode": "^2.3.1",
38
- "tldts": "^7.0.14"
35
+ "foxts": "^4.1.0",
36
+ "tldts": "^7.0.16"
39
37
  },
40
38
  "devDependencies": {
41
- "@eslint-sukka/node": "^7.0.2",
39
+ "@eslint-sukka/node": "^7.2.1",
42
40
  "@swc-node/register": "^1.11.1",
43
- "@types/async-retry": "^1.4.9",
44
41
  "@types/debug": "^4.1.12",
45
42
  "@types/dns2": "^2.0.10",
46
- "@types/node": "^24.3.3",
47
- "@types/punycode": "^2.1.4",
43
+ "@types/node": "^24.6.2",
48
44
  "bumpp": "^10.2.3",
49
45
  "bunchee": "^6.6.0",
50
- "eslint": "^9.35.0",
51
- "eslint-config-sukka": "^7.0.2",
52
- "eslint-formatter-sukka": "^7.0.2",
53
- "typescript": "^5.9.2",
46
+ "eslint": "^9.37.0",
47
+ "eslint-config-sukka": "^7.2.1",
48
+ "eslint-formatter-sukka": "^7.2.1",
49
+ "typescript": "^5.9.3",
54
50
  "whoiser": "2.0.0-beta.8"
55
51
  },
56
52
  "scripts": {