rdapper 0.5.0 → 0.6.0
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/README.md +14 -0
- package/dist/index.js +9 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -53,6 +53,20 @@ toRegistrableDomain("192.168.0.1"); // => null
|
|
|
53
53
|
- `isRegistered(domain, options?) => Promise<boolean>`
|
|
54
54
|
- `isAvailable(domain, options?) => Promise<boolean>`
|
|
55
55
|
|
|
56
|
+
### Edge runtimes (e.g., Vercel Edge)
|
|
57
|
+
|
|
58
|
+
WHOIS requires a raw TCP connection over port 43 via `node:net`, which is not available on edge runtimes. This package lazily loads `node:net` only when the WHOIS code path runs. To use rdapper safely on edge:
|
|
59
|
+
|
|
60
|
+
- Prefer RDAP only:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { lookupDomain } from "rdapper";
|
|
64
|
+
|
|
65
|
+
const res = await lookupDomain("example.com", { rdapOnly: true });
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- If `rdapOnly` is omitted and the code path reaches WHOIS on edge, rdapper throws a clear runtime error indicating WHOIS is unsupported on edge and to run in Node or set `rdapOnly: true`.
|
|
69
|
+
|
|
56
70
|
### Options
|
|
57
71
|
|
|
58
72
|
- `timeoutMs?: number` – Total timeout budget per network operation (default `15000`).
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { parse } from "tldts";
|
|
2
|
-
import { createConnection } from "node:net";
|
|
3
2
|
|
|
4
3
|
//#region src/lib/domain.ts
|
|
5
4
|
/**
|
|
@@ -562,9 +561,16 @@ async function whoisQuery(server, query, options) {
|
|
|
562
561
|
text
|
|
563
562
|
};
|
|
564
563
|
}
|
|
565
|
-
function queryTcp(host, port, query, options) {
|
|
564
|
+
async function queryTcp(host, port, query, options) {
|
|
565
|
+
let net;
|
|
566
|
+
try {
|
|
567
|
+
net = await import("net");
|
|
568
|
+
} catch {
|
|
569
|
+
net = null;
|
|
570
|
+
}
|
|
571
|
+
if (!net?.createConnection) throw new Error("WHOIS client is only available in Node.js runtimes; try setting `rdapOnly: true`.");
|
|
566
572
|
return new Promise((resolve, reject) => {
|
|
567
|
-
const socket = createConnection({
|
|
573
|
+
const socket = net.createConnection({
|
|
568
574
|
host,
|
|
569
575
|
port
|
|
570
576
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rdapper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "🎩 RDAP/WHOIS fetcher, parser, and normalizer for Node",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@biomejs/biome": "2.2.5",
|
|
46
|
-
"@types/node": "24.7.
|
|
46
|
+
"@types/node": "24.7.2",
|
|
47
47
|
"tsdown": "0.15.6",
|
|
48
48
|
"typescript": "5.9.3",
|
|
49
49
|
"vitest": "^3.2.4"
|