@mytld/engine 0.0.0-stage → 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 my.tld contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,117 @@
1
- # Temporary Holding Version
1
+ # @mytld/engine
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Fast, honest domain availability checks for Node.js. This is the engine behind [my.tld](https://mytld.dev).
4
+
5
+ - **Fast:** hundreds of parallel DNS queries via c-ares. They don't go through libuv's 4-thread pool, so nothing waits in line. Taken names come back in ~20 ms.
6
+ - **Honest:** a missing DNS record does **not** mean a domain is free. Registered names can be on hold, parked or reserved. A name is only reported `available` after the registry confirms it via RDAP or WHOIS.
7
+ - **Polite:** concurrency limits per registry, pacing that slows down on HTTP 429, and `Retry-After` cooldowns that can be shared across instances.
8
+ - **Pluggable cache:** in-memory by default, Redis adapter included, or bring your own.
9
+ - **640 curated TLDs:** the lists are validated against the IANA root zone.
10
+
11
+ ```sh
12
+ npm install @mytld/engine
13
+ ```
14
+
15
+ Node.js ≥ 20.3. ESM only.
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { createEngine, TOP_TLDS } from "@mytld/engine";
21
+
22
+ const engine = createEngine();
23
+
24
+ // one domain
25
+ await engine.check("example.com");
26
+ // → { domain: "example.com", status: "taken", verified: true, source: "dns" }
27
+
28
+ // many domains, results as they arrive
29
+ for await (const r of engine.stream(TOP_TLDS.map((t) => `myidea.${t}`))) {
30
+ console.log(r.domain, r.status);
31
+ }
32
+
33
+ // or with a callback (e.g. to write Server-Sent Events)
34
+ await engine.checkMany(domains, (r) => res.write(`data: ${JSON.stringify(r)}\n\n`), { signal });
35
+ ```
36
+
37
+ ### Results
38
+
39
+ ```ts
40
+ interface DomainResult {
41
+ domain: string;
42
+ status: "available" | "taken" | "unknown";
43
+ verified: boolean; // true = definitive (NS delegation or a registry answer)
44
+ source: "cache" | "dns" | "rdap" | "whois";
45
+ noDns?: boolean; // on "unknown": no DNS record, but no registry confirmed it either
46
+ }
47
+ ```
48
+
49
+ `unknown` with `noDns: true` means the name is *possibly* free. Show it as "unverified", never as available.
50
+
51
+ ### How a lookup works
52
+
53
+ 1. **Cache:** an in-process L1 cache, then one `mget` on your store for the whole batch.
54
+ 2. **DNS NS query:** NS records present means **taken**, and that answer is final.
55
+ 3. **RDAP:** from the IANA bootstrap, plus overrides for registries missing from it (`.de`, `.ch`, `.li`). A 404 means available, a 200 means taken.
56
+ 4. **WHOIS:** fallback on port 43. Servers are discovered via `whois.iana.org`. The engine only reports *taken* when it finds positive evidence in the reply.
57
+
58
+ ### Shared cache with Redis
59
+
60
+ ```ts
61
+ import Redis from "ioredis";
62
+ import { createEngine, redisStore } from "@mytld/engine";
63
+
64
+ const redis = new Redis(process.env.REDIS_URL, { enableOfflineQueue: false, maxRetriesPerRequest: 1 });
65
+ const engine = createEngine({ store: redisStore(redis) });
66
+ ```
67
+
68
+ If Redis is down, cache reads count as misses and writes are dropped. Lookups never wait on the cache.
69
+
70
+ Implement `CacheStore` (`get`, `mget`, `set`, `pttl`, optional `setMany`) to use anything else.
71
+
72
+ ### Options
73
+
74
+ | option | default | |
75
+ |---|---|---|
76
+ | `store` | `memoryStore()` | results, IANA bootstrap, WHOIS servers, registry cooldowns |
77
+ | `keyPrefix` | `""` | prefix for all store keys |
78
+ | `dnsServers` | Cloudflare + Google | a local Unbound is ideal in production |
79
+ | `dnsConcurrency` | `256` | max in-flight DNS queries |
80
+ | `dnsTimeoutMs` | `1200` | |
81
+ | `rdapPerHost` | `6` | concurrent requests per RDAP host |
82
+ | `rdapRps` | `8` | starting/max requests per second per host, halves on 429 |
83
+ | `rdapTimeoutMs` | `4000` | |
84
+ | `rdapOverrides` | `.de`, `.ch`, `.li` | `{ tld: baseUrl }` |
85
+ | `whoisPerHost` | `3` | |
86
+ | `whoisTimeoutMs` | `4000` | |
87
+ | `whoisServers` | a few ccTLDs | `{ tld: host }`; others are auto-discovered |
88
+ | `ttl` | `{ taken: 21600, available: 600 }` | seconds; only verified answers are cached |
89
+ | `fetch` | `globalThis.fetch` | |
90
+ | `userAgent` | none | sent to registries |
91
+
92
+ ### Browser-safe helpers
93
+
94
+ The main entry uses `node:dns` and `node:net`. Parsing and TLD lists have their own entry points that are safe to import in client code:
95
+
96
+ ```ts
97
+ import { parseQuery, isValidDomain, tldOf } from "@mytld/engine/domain";
98
+ import { TOP_TLDS, EXTENDED_TLDS, ALL_TLDS } from "@mytld/engine/tlds";
99
+
100
+ parseQuery("https://www.Müller.dev/x"); // → { name: "xn--mller-kva", tld: "dev" }
101
+ ```
102
+
103
+ ## Good citizenship
104
+
105
+ Registries rate-limit, and some block an IP for a full day if you burst them. Keep the defaults unless you know a registry's limits. Cache aggressively, and don't run bulk scans.
106
+
107
+ ## Development
108
+
109
+ ```sh
110
+ pnpm install
111
+ pnpm test # unit tests (offline)
112
+ pnpm smoke # live check of the top 25 TLDs against real registries
113
+ ```
114
+
115
+ ## License
116
+
117
+ MIT
@@ -0,0 +1,26 @@
1
+ import type { DomainResult, DomainStatus } from "../core/domain.js";
2
+ import type { SafeStore } from "./safe-store.js";
3
+ /** What we persist per domain. Only definitive answers are ever stored. */
4
+ interface CachedAnswer {
5
+ status: DomainStatus;
6
+ verified: true;
7
+ }
8
+ export interface ResultTtl {
9
+ taken: number;
10
+ available: number;
11
+ }
12
+ /**
13
+ * Two-level cache for lookup results: an in-process L1 in front of the shared store,
14
+ * so hot names don't need a store round-trip at all.
15
+ */
16
+ export declare class ResultCache {
17
+ private readonly store;
18
+ private readonly ttl;
19
+ private readonly l1;
20
+ constructor(store: SafeStore, ttl: ResultTtl);
21
+ /** Looks up many domains at once: L1 first, then a single `mget()` for the rest. */
22
+ getMany(domains: string[]): Promise<Map<string, CachedAnswer>>;
23
+ /** Stores a result if it's definitive. Writes to the shared store are batched per tick. */
24
+ remember(result: DomainResult): void;
25
+ }
26
+ export {};
@@ -0,0 +1,66 @@
1
+ import { memoryStore } from "./store.js";
2
+ const KEY_PREFIX = "dom:v2:";
3
+ /** L1 entries live at most this long, so instances pick up shared-store changes. */
4
+ const L1_MAX_TTL_SEC = 600;
5
+ /** L1 lifetime for values pulled up from the shared store. */
6
+ const L1_PROMOTED_TTL_SEC = 60;
7
+ const L1_MAX_ENTRIES = 50_000;
8
+ /**
9
+ * Two-level cache for lookup results: an in-process L1 in front of the shared store,
10
+ * so hot names don't need a store round-trip at all.
11
+ */
12
+ export class ResultCache {
13
+ store;
14
+ ttl;
15
+ l1 = memoryStore({ maxEntries: L1_MAX_ENTRIES });
16
+ constructor(store, ttl) {
17
+ this.store = store;
18
+ this.ttl = ttl;
19
+ }
20
+ /** Looks up many domains at once: L1 first, then a single `mget()` for the rest. */
21
+ async getMany(domains) {
22
+ const found = new Map();
23
+ const misses = [];
24
+ const l1Values = await this.l1.mget(domains);
25
+ domains.forEach((domain, i) => {
26
+ const raw = l1Values[i];
27
+ if (raw) {
28
+ found.set(domain, JSON.parse(raw));
29
+ }
30
+ else {
31
+ misses.push(domain);
32
+ }
33
+ });
34
+ if (!misses.length) {
35
+ return found;
36
+ }
37
+ const storeValues = await this.store.mget(misses.map((domain) => KEY_PREFIX + domain));
38
+ storeValues.forEach((raw, i) => {
39
+ const answer = raw ? tryParse(raw) : null;
40
+ if (!answer) {
41
+ return;
42
+ }
43
+ found.set(misses[i], answer);
44
+ void this.l1.set(misses[i], raw, L1_PROMOTED_TTL_SEC);
45
+ });
46
+ return found;
47
+ }
48
+ /** Stores a result if it's definitive. Writes to the shared store are batched per tick. */
49
+ remember(result) {
50
+ if (result.status === "unknown" || !result.verified) {
51
+ return;
52
+ }
53
+ const ttl = result.status === "taken" ? this.ttl.taken : this.ttl.available;
54
+ const raw = JSON.stringify({ status: result.status, verified: true });
55
+ void this.l1.set(result.domain, raw, Math.min(ttl, L1_MAX_TTL_SEC));
56
+ this.store.queue(KEY_PREFIX + result.domain, raw, ttl);
57
+ }
58
+ }
59
+ function tryParse(raw) {
60
+ try {
61
+ return JSON.parse(raw);
62
+ }
63
+ catch {
64
+ return null;
65
+ }
66
+ }
@@ -0,0 +1,17 @@
1
+ import type { CacheStore } from "./store.js";
2
+ /**
3
+ * Wraps a user-supplied store so that:
4
+ *
5
+ * - nothing it does can throw into a lookup (errors become cache misses or no-ops),
6
+ * - every key gets the configured prefix,
7
+ * - fire-and-forget writes are coalesced into one `setMany()` per tick.
8
+ */
9
+ export declare function safeStore(store: CacheStore, prefix: string): {
10
+ get: (key: string) => Promise<string | null>;
11
+ set: (key: string, value: string, ttlSec: number) => Promise<void>;
12
+ mget: (keys: string[]) => Promise<(string | null)[]>;
13
+ pttl: (key: string) => Promise<number>;
14
+ queue: (key: string, value: string, ttlSec: number) => void;
15
+ json: <T>(key: string, ttlSec: number, load: () => Promise<T>) => Promise<T>;
16
+ };
17
+ export type SafeStore = ReturnType<typeof safeStore>;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Wraps a user-supplied store so that:
3
+ *
4
+ * - nothing it does can throw into a lookup (errors become cache misses or no-ops),
5
+ * - every key gets the configured prefix,
6
+ * - fire-and-forget writes are coalesced into one `setMany()` per tick.
7
+ */
8
+ export function safeStore(store, prefix) {
9
+ const prefixed = (key) => prefix + key;
10
+ const pendingWrites = [];
11
+ let flushScheduled = false;
12
+ function flush() {
13
+ flushScheduled = false;
14
+ const batch = pendingWrites.splice(0);
15
+ if (!batch.length) {
16
+ return;
17
+ }
18
+ const write = store.setMany
19
+ ? store.setMany(batch)
20
+ : Promise.all(batch.map((entry) => store.set(entry.key, entry.value, entry.ttlSec)));
21
+ Promise.resolve(write).catch(() => { });
22
+ }
23
+ async function get(key) {
24
+ try {
25
+ return await store.get(prefixed(key));
26
+ }
27
+ catch {
28
+ return null;
29
+ }
30
+ }
31
+ async function set(key, value, ttlSec) {
32
+ try {
33
+ await store.set(prefixed(key), value, ttlSec);
34
+ }
35
+ catch {
36
+ // best effort
37
+ }
38
+ }
39
+ async function mget(keys) {
40
+ if (!keys.length) {
41
+ return [];
42
+ }
43
+ try {
44
+ return await store.mget(keys.map(prefixed));
45
+ }
46
+ catch {
47
+ return keys.map(() => null);
48
+ }
49
+ }
50
+ async function pttl(key) {
51
+ try {
52
+ return await store.pttl(prefixed(key));
53
+ }
54
+ catch {
55
+ return -2;
56
+ }
57
+ }
58
+ /** Buffered write, flushed on the next macrotask together with its siblings. */
59
+ function queue(key, value, ttlSec) {
60
+ pendingWrites.push({ key: prefixed(key), value, ttlSec });
61
+ if (flushScheduled) {
62
+ return;
63
+ }
64
+ flushScheduled = true;
65
+ setTimeout(flush, 0);
66
+ }
67
+ /** Read-through JSON cache: returns the stored value, or loads, stores and returns it. */
68
+ async function json(key, ttlSec, load) {
69
+ const hit = await get(key);
70
+ if (hit) {
71
+ try {
72
+ return JSON.parse(hit);
73
+ }
74
+ catch {
75
+ // corrupt entry: reload below
76
+ }
77
+ }
78
+ const value = await load();
79
+ void set(key, JSON.stringify(value), ttlSec);
80
+ return value;
81
+ }
82
+ return { get, set, mget, pttl, queue, json };
83
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Pluggable key/value store for results, the IANA bootstrap, WHOIS server discovery
3
+ * and rate-limit cooldowns.
4
+ *
5
+ * Implementations should not throw. The engine wraps every call anyway (see
6
+ * `safe-store.ts`), because a cache must never be able to break a lookup.
7
+ */
8
+ export interface CacheStore {
9
+ get(key: string): Promise<string | null>;
10
+ mget(keys: string[]): Promise<(string | null)[]>;
11
+ set(key: string, value: string, ttlSec: number): Promise<void>;
12
+ /** Optional batched write, e.g. one Redis pipeline per tick. */
13
+ setMany?(entries: {
14
+ key: string;
15
+ value: string;
16
+ ttlSec: number;
17
+ }[]): Promise<void>;
18
+ /** Remaining lifetime in milliseconds; <= 0 when the key doesn't exist. */
19
+ pttl(key: string): Promise<number>;
20
+ }
21
+ /** In-process store with TTLs and a size cap. When full, the oldest ~10% are evicted. */
22
+ export declare function memoryStore({ maxEntries }?: {
23
+ maxEntries?: number | undefined;
24
+ }): CacheStore;
25
+ /** The subset of an ioredis-compatible client the adapter needs. */
26
+ export interface RedisLike {
27
+ get(key: string): Promise<string | null>;
28
+ mget(...keys: string[]): Promise<(string | null)[]>;
29
+ set(key: string, value: string, mode: "EX", seconds: number): Promise<unknown>;
30
+ pttl(key: string): Promise<number>;
31
+ pipeline?(): {
32
+ set(key: string, value: string, mode: "EX", seconds: number): unknown;
33
+ exec(): Promise<unknown>;
34
+ };
35
+ status?: string;
36
+ }
37
+ /**
38
+ * Redis adapter for ioredis. Shares results and registry cooldowns across instances.
39
+ *
40
+ * If the client isn't connected (`status !== "ready"`), calls resolve as cache misses
41
+ * instead of waiting. Lookups must never block on the cache.
42
+ */
43
+ export declare function redisStore(client: RedisLike): CacheStore;
@@ -0,0 +1,100 @@
1
+ /* ───────────────────────────── memory ───────────────────────────── */
2
+ /** In-process store with TTLs and a size cap. When full, the oldest ~10% are evicted. */
3
+ export function memoryStore({ maxEntries = 50_000 } = {}) {
4
+ const entries = new Map();
5
+ function read(key) {
6
+ const entry = entries.get(key);
7
+ if (!entry) {
8
+ return undefined;
9
+ }
10
+ if (entry.expiresAt < Date.now()) {
11
+ entries.delete(key);
12
+ return undefined;
13
+ }
14
+ return entry;
15
+ }
16
+ function write(key, value, ttlSec) {
17
+ if (entries.size >= maxEntries) {
18
+ evictOldest(Math.ceil(maxEntries / 10));
19
+ }
20
+ entries.set(key, { value, expiresAt: Date.now() + ttlSec * 1000 });
21
+ }
22
+ /** Map iterates in insertion order, so the first keys are the oldest. */
23
+ function evictOldest(count) {
24
+ for (const key of entries.keys()) {
25
+ entries.delete(key);
26
+ if (--count <= 0) {
27
+ break;
28
+ }
29
+ }
30
+ }
31
+ return {
32
+ async get(key) {
33
+ return read(key)?.value ?? null;
34
+ },
35
+ async mget(keys) {
36
+ return keys.map((key) => read(key)?.value ?? null);
37
+ },
38
+ async set(key, value, ttlSec) {
39
+ write(key, value, ttlSec);
40
+ },
41
+ async setMany(batch) {
42
+ for (const entry of batch) {
43
+ write(entry.key, entry.value, entry.ttlSec);
44
+ }
45
+ },
46
+ async pttl(key) {
47
+ const entry = read(key);
48
+ return entry ? entry.expiresAt - Date.now() : -2;
49
+ },
50
+ };
51
+ }
52
+ /**
53
+ * Redis adapter for ioredis. Shares results and registry cooldowns across instances.
54
+ *
55
+ * If the client isn't connected (`status !== "ready"`), calls resolve as cache misses
56
+ * instead of waiting. Lookups must never block on the cache.
57
+ */
58
+ export function redisStore(client) {
59
+ const isReady = () => client.status === undefined || client.status === "ready";
60
+ return {
61
+ async get(key) {
62
+ if (!isReady()) {
63
+ return null;
64
+ }
65
+ return client.get(key).catch(() => null);
66
+ },
67
+ async mget(keys) {
68
+ if (!keys.length || !isReady()) {
69
+ return keys.map(() => null);
70
+ }
71
+ return client.mget(...keys).catch(() => keys.map(() => null));
72
+ },
73
+ async set(key, value, ttlSec) {
74
+ if (!isReady()) {
75
+ return;
76
+ }
77
+ await client.set(key, value, "EX", ttlSec).catch(() => { });
78
+ },
79
+ async setMany(batch) {
80
+ if (!batch.length || !isReady()) {
81
+ return;
82
+ }
83
+ if (client.pipeline) {
84
+ const pipeline = client.pipeline();
85
+ for (const entry of batch) {
86
+ pipeline.set(entry.key, entry.value, "EX", entry.ttlSec);
87
+ }
88
+ await pipeline.exec().catch(() => { });
89
+ return;
90
+ }
91
+ await Promise.all(batch.map((entry) => client.set(entry.key, entry.value, "EX", entry.ttlSec).catch(() => { })));
92
+ },
93
+ async pttl(key) {
94
+ if (!isReady()) {
95
+ return -2;
96
+ }
97
+ return client.pttl(key).catch(() => -2);
98
+ },
99
+ };
100
+ }
@@ -0,0 +1,27 @@
1
+ /** Domain parsing/validation and result types. Browser-safe: no Node APIs. */
2
+ export type DomainStatus = "available" | "taken" | "unknown";
3
+ export type LookupSource = "cache" | "dns" | "rdap" | "whois";
4
+ export interface DomainResult {
5
+ domain: string;
6
+ status: DomainStatus;
7
+ /** true = definitive answer (NS delegation, or the registry via RDAP/WHOIS). */
8
+ verified: boolean;
9
+ /**
10
+ * Set on "unknown": the name has no DNS delegation, but no registry confirmed it.
11
+ * That is NOT "available" — registered names can lack DNS (on hold, parked, reserved).
12
+ */
13
+ noDns?: boolean;
14
+ source: LookupSource;
15
+ }
16
+ export declare function isValidLabel(label: string): boolean;
17
+ export interface ParsedQuery {
18
+ /** ASCII/punycode second-level label, e.g. "hello" */
19
+ name: string;
20
+ /** TLD the user typed, if any ("hello.dev" → "dev") */
21
+ tld: string | null;
22
+ }
23
+ /** Accepts "Hello", "hello.dev", "https://www.hello.dev/x", "müller" … */
24
+ export declare function parseQuery(raw: string): ParsedQuery | null;
25
+ /** Strict validation of a full "label.tld" domain (server-side input check). */
26
+ export declare function isValidDomain(domain: string): boolean;
27
+ export declare function tldOf(domain: string): string;
@@ -0,0 +1,60 @@
1
+ /** Domain parsing/validation and result types. Browser-safe: no Node APIs. */
2
+ const LABEL_RE = /^(?!-)[a-z0-9-]{1,63}(?<!-)$/;
3
+ const TLD_RE = /^[a-z0-9-]{2,63}$/;
4
+ /** IDN-safe → punycode via the WHATWG URL parser (works in browser and Node). */
5
+ function toAscii(host) {
6
+ try {
7
+ return new URL(`http://${host}`).hostname;
8
+ }
9
+ catch {
10
+ return null;
11
+ }
12
+ }
13
+ export function isValidLabel(label) {
14
+ if (!LABEL_RE.test(label)) {
15
+ return false;
16
+ }
17
+ // "ab--" is reserved for A-labels (xn--) only.
18
+ if (label.slice(2, 4) === "--" && !label.startsWith("xn--")) {
19
+ return false;
20
+ }
21
+ return true;
22
+ }
23
+ /** Accepts "Hello", "hello.dev", "https://www.hello.dev/x", "müller" … */
24
+ export function parseQuery(raw) {
25
+ let input = raw.trim().toLowerCase();
26
+ if (!input) {
27
+ return null;
28
+ }
29
+ input = input
30
+ .replace(/^[a-z]+:\/\//, "") // scheme
31
+ .replace(/[/?#].*$/, "") // path, query, fragment
32
+ .replace(/^www\./, "")
33
+ .replace(/\s+/g, "-")
34
+ .replace(/\.+$/, "");
35
+ const ascii = toAscii(input);
36
+ if (!ascii) {
37
+ return null;
38
+ }
39
+ const [name, ...rest] = ascii.split(".");
40
+ if (!isValidLabel(name)) {
41
+ return null;
42
+ }
43
+ const tld = rest.length ? rest.join(".") : null;
44
+ return { name, tld: tld && TLD_RE.test(tld) ? tld : null };
45
+ }
46
+ /** Strict validation of a full "label.tld" domain (server-side input check). */
47
+ export function isValidDomain(domain) {
48
+ if (domain.length > 253) {
49
+ return false;
50
+ }
51
+ const dot = domain.indexOf(".");
52
+ const hasExactlyOneDot = dot > 0 && domain.indexOf(".", dot + 1) === -1;
53
+ if (!hasExactlyOneDot) {
54
+ return false;
55
+ }
56
+ return isValidLabel(domain.slice(0, dot)) && TLD_RE.test(domain.slice(dot + 1));
57
+ }
58
+ export function tldOf(domain) {
59
+ return domain.slice(domain.indexOf(".") + 1);
60
+ }
@@ -0,0 +1,5 @@
1
+ /** Curated TLD lists, validated against the IANA root zone. Browser-safe. */
2
+ export declare const TOP_TLDS: readonly ["com", "net", "org", "de", "io", "ai", "dev", "app", "co", "xyz", "me", "eu", "tech", "so", "sh", "gg", "info", "online", "site", "store", "cloud", "at", "ch", "tv", "cc"];
3
+ /** Extended set (~600 common, publicly registrable TLDs), excluding TOP_TLDS. */
4
+ export declare const EXTENDED_TLDS: readonly string[];
5
+ export declare const ALL_TLDS: readonly string[];
@@ -0,0 +1,69 @@
1
+ /** Curated TLD lists, validated against the IANA root zone. Browser-safe. */
2
+ export const TOP_TLDS = [
3
+ "com", "net", "org", "de", "io", "ai", "dev", "app", "co", "xyz", "me", "eu", "tech", "so",
4
+ "sh", "gg", "info", "online", "site", "store", "cloud", "at", "ch", "tv", "cc",
5
+ ];
6
+ /** Extended set (~600 common, publicly registrable TLDs), excluding TOP_TLDS. */
7
+ export const EXTENDED_TLDS = [
8
+ "academy", "accountant", "accountants", "actor", "adult", "ae", "ag", "agency", "airforce",
9
+ "am", "apartments", "archi", "army", "art", "associates", "attorney", "auction", "audio",
10
+ "auto", "autos", "baby", "band", "bar", "bargains", "basketball", "be", "beauty", "beer",
11
+ "berlin", "best", "bet", "bid", "bike", "bingo", "bio", "black", "blackfriday", "blog",
12
+ "blue", "boats", "bond", "boo", "book", "boston", "boutique", "box", "broker", "build",
13
+ "builders", "business", "buzz", "bz", "ca", "cab", "cafe", "cam", "camera", "camp", "capital",
14
+ "car", "cards", "care", "career", "careers", "cars", "casa", "cash", "casino", "catering",
15
+ "center", "ceo", "charity", "chat", "cheap", "christmas", "church", "city", "claims",
16
+ "cleaning", "click", "clinic", "clothing", "club", "cl", "coach", "codes", "coffee",
17
+ "college", "community", "company", "compare", "computer", "condos", "construction",
18
+ "consulting", "contact", "contractors", "cooking", "cool", "country", "coupons", "courses",
19
+ "credit", "creditcard", "cricket", "cruises", "cx", "cyou", "cymru", "cz", "dance", "date",
20
+ "dating", "day", "deals", "degree", "delivery", "democrat", "dental", "dentist", "design",
21
+ "desi", "diamonds", "diet", "digital", "direct", "directory", "discount", "dk", "doctor",
22
+ "dog", "domains", "download", "earth", "eco", "education", "email", "energy", "engineer",
23
+ "engineering", "enterprises", "equipment", "es", "estate", "events", "exchange", "expert",
24
+ "exposed", "express", "fail", "faith", "family", "fan", "fans", "farm", "fashion", "fast",
25
+ "feedback", "fi", "film", "finance", "financial", "fish", "fishing", "fit", "fitness",
26
+ "flights", "florist", "flowers", "fm", "fo", "foo", "football", "forsale", "foundation", "fr",
27
+ "free", "fun", "fund", "furniture", "futbol", "fyi", "gallery", "game", "games", "garden",
28
+ "gay", "gift", "gifts", "gives", "glass", "global", "gmbh", "gold", "golf", "gr", "graphics",
29
+ "gratis", "green", "gripe", "group", "guide", "guitars", "guru", "hair", "hamburg", "haus",
30
+ "health", "healthcare", "help", "hiphop", "hiv", "hockey", "holdings", "holiday", "homes",
31
+ "horse", "hospital", "host", "hosting", "house", "how", "hu", "icu", "ie", "im", "immo",
32
+ "immobilien", "in", "inc", "industries", "ink", "institute", "insure", "international",
33
+ "investments", "irish", "is", "it", "jetzt", "jewelry", "jobs", "jp", "juegos", "kaufen",
34
+ "kim", "kitchen", "kiwi", "koeln", "la", "land", "lat", "law", "lawyer", "lease", "legal",
35
+ "lgbt", "li", "life", "lighting", "limited", "limo", "link", "live", "living", "llc", "loan",
36
+ "loans", "lol", "london", "love", "ltd", "ltda", "lu", "luxe", "luxury", "ly", "maison",
37
+ "management", "market", "marketing", "markets", "mba", "media", "melbourne", "memorial",
38
+ "men", "menu", "miami", "mobi", "moda", "moe", "mom", "money", "monster", "mortgage",
39
+ "moscow", "motorcycles", "mov", "movie", "mu", "music", "mx", "my", "navy", "network", "new",
40
+ "news", "nexus", "ngo", "ninja", "now", "nrw", "nu", "nyc", "nz", "observer", "one", "ong",
41
+ "onl", "ooo", "organic", "page", "paris", "partners", "parts", "party", "pe", "pet", "ph",
42
+ "photo", "photography", "photos", "pics", "pictures", "pink", "pizza", "pl", "place",
43
+ "plumbing", "plus", "poker", "porn", "press", "pro", "productions", "prof", "promo",
44
+ "properties", "property", "pub", "pw", "qpon", "quebec", "quest", "racing", "radio", "realty",
45
+ "recipes", "red", "rehab", "reise", "reisen", "rent", "rentals", "repair", "report",
46
+ "republican", "rest", "restaurant", "review", "reviews", "rich", "rip", "rocks", "rodeo",
47
+ "rs", "ru", "rugby", "run", "sale", "salon", "sarl", "school", "schule", "science", "se",
48
+ "security", "services", "sex", "sexy", "shiksha", "shoes", "shop", "shopping", "show",
49
+ "singles", "ski", "skin", "soccer", "social", "software", "solar", "solutions", "soy",
50
+ "space", "spa", "sport", "srl", "studio", "study", "style", "sucks", "supplies", "supply",
51
+ "support", "surf", "surgery", "swiss", "sydney", "systems", "taipei", "talk", "tattoo", "tax",
52
+ "taxi", "team", "technology", "tel", "tennis", "theater", "theatre", "tickets", "tienda",
53
+ "tips", "tires", "tk", "to", "today", "tokyo", "tools", "top", "tours", "town", "toys",
54
+ "trade", "trading", "training", "travel", "tube", "uk", "university", "uno", "us",
55
+ "vacations", "vc", "vegas", "ventures", "vet", "vg", "viajes", "video", "villas", "vin",
56
+ "vip", "vision", "vodka", "vote", "voting", "voto", "voyage", "wales", "wang", "watch",
57
+ "webcam", "website", "wedding", "wien", "wiki", "win", "wine", "work", "works", "world", "ws",
58
+ "wtf", "xxx", "yachts", "yoga", "you", "zone", "zip", "ac", "af", "bo", "by", "cat", "ci",
59
+ "cm", "cn", "cr", "cu", "do", "dz", "ec", "ee", "eg", "fj", "ge", "gl", "gs", "gt", "gy",
60
+ "hk", "hn", "hr", "ht", "id", "il", "ir", "jo", "ke", "kg", "kr", "kz", "lc", "lk", "lt",
61
+ "lv", "ma", "md", "mk", "mn", "ms", "mt", "mw", "na", "ng", "ni", "np", "om", "pa", "pk",
62
+ "pm", "pr", "ps", "pt", "py", "qa", "re", "ro", "rw", "sa", "sb", "sc", "sg", "si", "sk",
63
+ "sn", "sr", "st", "su", "sx", "tc", "tf", "th", "tj", "tl", "tm", "tn", "tr", "tt", "tw",
64
+ "tz", "ua", "ug", "uy", "uz", "ve", "vn", "vu", "wf", "yt", "za", "zm", "africa", "alsace",
65
+ "amsterdam", "bayern", "barcelona", "brussels", "bzh", "capetown", "corsica", "durban", "eus",
66
+ "gal", "istanbul", "joburg", "kyoto", "madrid", "nagoya", "okinawa", "osaka", "rio", "ruhr",
67
+ "saarland", "scot", "stockholm", "tirol", "vlaanderen", "yokohama", "zuerich", "frl", "gent",
68
+ ];
69
+ export const ALL_TLDS = [...TOP_TLDS, ...EXTENDED_TLDS];