rdapper 0.6.0 → 0.7.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 CHANGED
@@ -53,6 +53,15 @@ toRegistrableDomain("192.168.0.1"); // => null
53
53
  - `isRegistered(domain, options?) => Promise<boolean>`
54
54
  - `isAvailable(domain, options?) => Promise<boolean>`
55
55
 
56
+ ### CLI
57
+
58
+ For quick checks, a minimal CLI is included:
59
+
60
+ ```bash
61
+ npx rdapper example.com
62
+ echo "example.com" | npx rdapper
63
+ ```
64
+
56
65
  ### Edge runtimes (e.g., Vercel Edge)
57
66
 
58
67
  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:
@@ -196,7 +205,7 @@ Project layout:
196
205
  - `src/whois/` – WHOIS TCP client, discovery/referral, normalization, exceptions
197
206
  - `src/lib/` – utilities for dates, text parsing, domain processing, async
198
207
  - `src/types.ts` – public types; `src/index.ts` re‑exports API and types
199
- - `cli.mjs` – local CLI helper for quick testing
208
+ - `bin/cli.js` – simple CLI for quick checks
200
209
 
201
210
  ## Caveats
202
211
 
package/bin/cli.js ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Quick informal command-line interface for rdapper
4
+ // Usage:
5
+ // npx rdapper example.com
6
+ // echo "example.com" | npx rdapper
7
+
8
+ import { createInterface } from "node:readline";
9
+ import { lookupDomain } from "../dist/index.js";
10
+
11
+ async function main() {
12
+ if (process.argv.length > 2) {
13
+ // URL(s) specified in the command arguments
14
+ console.log(
15
+ JSON.stringify(
16
+ await lookupDomain(process.argv[process.argv.length - 1]),
17
+ null,
18
+ 2,
19
+ ),
20
+ );
21
+ } else {
22
+ // No domain passed as argument, read from each line of stdin
23
+ const rlInterface = createInterface({
24
+ input: process.stdin,
25
+ });
26
+ rlInterface.on("line", async (line) => {
27
+ console.log(JSON.stringify(await lookupDomain(line), null, 2));
28
+ });
29
+ }
30
+ }
31
+
32
+ main();
package/dist/index.js CHANGED
@@ -966,7 +966,11 @@ async function followWhoisReferrals(initialServer, domain, opts) {
966
966
  if (visited.has(normalized)) break;
967
967
  visited.add(normalized);
968
968
  try {
969
- current = await whoisQuery(next, domain, opts);
969
+ const res = await whoisQuery(next, domain, opts);
970
+ const registeredBefore = !isWhoisAvailable(current.text);
971
+ const registeredAfter = !isWhoisAvailable(res.text);
972
+ if (registeredBefore && !registeredAfter) break;
973
+ current = res;
970
974
  } catch {
971
975
  break;
972
976
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdapper",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "license": "MIT",
5
5
  "description": "🎩 RDAP/WHOIS fetcher, parser, and normalizer for Node",
6
6
  "repository": {
@@ -15,15 +15,19 @@
15
15
  "email": "jake@jarv.is",
16
16
  "url": "https://jarv.is"
17
17
  },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
18
21
  "type": "module",
19
22
  "main": "./dist/index.js",
20
23
  "module": "./dist/index.js",
21
24
  "types": "./dist/index.d.ts",
25
+ "bin": "./bin/cli.js",
22
26
  "exports": {
23
27
  ".": {
24
- "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js",
25
29
  "import": "./dist/index.js",
26
- "default": "./dist/index.js"
30
+ "types": "./dist/index.d.ts"
27
31
  }
28
32
  },
29
33
  "files": [
@@ -32,6 +36,7 @@
32
36
  "scripts": {
33
37
  "build": "tsdown",
34
38
  "dev": "tsdown --watch",
39
+ "cli": "node bin/cli.js",
35
40
  "typecheck": "tsc --noEmit",
36
41
  "test": "vitest",
37
42
  "test:run": "vitest run",