@adriangalilea/utils 2.10.0 → 2.11.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
|
@@ -101,21 +101,35 @@ money(100, 'EUR') // "€100.00"
|
|
|
101
101
|
|
|
102
102
|
### URL (`url`)
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
Everything between "text someone typed" and "a URL you can use": detection,
|
|
105
|
+
tracking-parameter stripping, canonical cache keys, host questions. Each
|
|
106
|
+
concern rides its state of the art instead of hand-rolls — detection is
|
|
107
|
+
[linkifyjs](https://linkify.js.org) (scanner-based, TLD-aware); parsing is the
|
|
108
|
+
WHATWG URL API, never regexes; the knowledge of WHICH params are tracking is
|
|
109
|
+
vendored from
|
|
106
110
|
[@protontech/tidy-url](https://www.npmjs.com/package/@protontech/tidy-url)
|
|
107
111
|
(Proton's maintained fork of DrKain/tidy-url, MIT; refresh with
|
|
108
|
-
`pnpm update-url-rules`) plus a small tested overlay
|
|
109
|
-
unambiguous trackers (utm_*, fbclid, gclid, …)
|
|
112
|
+
`pnpm update-url-rules`) plus a small tested overlay. Global rules only for
|
|
113
|
+
unambiguous trackers (utm_*, fbclid, gclid, …); ambiguous names stay per-host —
|
|
110
114
|
`si` is junk on YouTube/Spotify but `ref` on GitHub names a branch and
|
|
111
|
-
survives.
|
|
115
|
+
survives.
|
|
112
116
|
|
|
113
117
|
```typescript
|
|
114
|
-
import { cleanUrl, urlKey } from '@adriangalilea/utils/url'
|
|
118
|
+
import { findUrls, asHttpUrl, cleanUrl, urlKey, hostOf, hostMatches } from '@adriangalilea/utils/url'
|
|
119
|
+
|
|
120
|
+
// Every http(s) URL in free text, in order, cleaned — with spans and
|
|
121
|
+
// whether the user typed the scheme (requireScheme drops bare domains).
|
|
122
|
+
findUrls('check https://a.com/x?utm_source=t and example.com/y')
|
|
123
|
+
// [{ url: 'https://a.com/x', start: 6, end: 34, hadScheme: true },
|
|
124
|
+
// { url: 'https://example.com/y', start: 39, end: 52, hadScheme: false }]
|
|
125
|
+
|
|
126
|
+
// One pasted token → one clean URL (or null). Punctuation, brackets,
|
|
127
|
+
// emails-are-not-URLs: the scanner's problem, not yours.
|
|
128
|
+
asHttpUrl('<https://example.com/a?utm_source=x>,') // 'https://example.com/a'
|
|
115
129
|
|
|
116
130
|
// The SAME resource minus tracking — safe to fetch, share, display.
|
|
117
131
|
// Keeps scheme, www., param order, and the fragment (a real anchor).
|
|
118
|
-
cleanUrl('https://www.youtube.com/watch?v=abc&t=120s&si=junk
|
|
132
|
+
cleanUrl('https://www.youtube.com/watch?v=abc&t=120s&si=junk')
|
|
119
133
|
// 'https://www.youtube.com/watch?v=abc&t=120s'
|
|
120
134
|
|
|
121
135
|
// The resource's IDENTITY — for cache keys and dedupe. Scheme-agnostic,
|
|
@@ -124,6 +138,10 @@ cleanUrl('https://www.youtube.com/watch?v=abc&t=120s&si=junk&utm_source=x')
|
|
|
124
138
|
urlKey('https://www.theverge.com/2026/1/1/story/?utm_source=twitter#comments')
|
|
125
139
|
// 'theverge.com/2026/1/1/story'
|
|
126
140
|
|
|
141
|
+
hostOf('https://www.theverge.com/a') // 'theverge.com'
|
|
142
|
+
hostMatches('music.youtube.com', 'youtube.com') // true (RFC 6265 domain-match)
|
|
143
|
+
hostMatches('notyoutube.com', 'youtube.com') // false
|
|
144
|
+
|
|
127
145
|
// App-specific junk rides along per call
|
|
128
146
|
urlKey(url, { strip: ['session_id'] })
|
|
129
147
|
```
|
|
@@ -4,6 +4,42 @@ export interface StripOptions {
|
|
|
4
4
|
/** Extra param names to strip (compared lowercased), for app-specific junk. */
|
|
5
5
|
strip?: readonly string[];
|
|
6
6
|
}
|
|
7
|
+
export interface FindUrlsOptions extends StripOptions {
|
|
8
|
+
/** Drop scheme-less matches (`example.com/x`) instead of coercing them to https://. */
|
|
9
|
+
requireScheme?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** One URL found in free text by {@link findUrls}. */
|
|
12
|
+
export interface FoundUrl {
|
|
13
|
+
/** The cleaned http(s) URL (https:// coerced onto scheme-less matches). */
|
|
14
|
+
url: string;
|
|
15
|
+
/** Span of the raw match in the input text. */
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
/** False for scheme-less matches the scanner inferred from a known TLD. */
|
|
19
|
+
hadScheme: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Every http(s) URL in free text, in order, cleaned. Detection is linkifyjs —
|
|
23
|
+
* a real scanner, TLD-aware for scheme-less domains, and it owns the messy
|
|
24
|
+
* text-boundary problems (trailing punctuation, brackets, emails-are-not-URLs)
|
|
25
|
+
* — then each match goes through the URL parser and tracking-param stripping.
|
|
26
|
+
* Scheme-less matches coerce to https:// (drop them with `requireScheme`).
|
|
27
|
+
*/
|
|
28
|
+
export declare function findUrls(text: string, opts?: FindUrlsOptions): FoundUrl[];
|
|
29
|
+
/**
|
|
30
|
+
* A user-pasted token as one CLEAN http(s) URL, or null: {@link findUrls}
|
|
31
|
+
* over the token, first match. The one verb between "text someone typed"
|
|
32
|
+
* and "a URL you can use".
|
|
33
|
+
*/
|
|
34
|
+
export declare function asHttpUrl(token: string, opts?: FindUrlsOptions): string | null;
|
|
35
|
+
/** A URL's host without a leading www., or the input unchanged if it won't parse. */
|
|
36
|
+
export declare function hostOf(url: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* True if `host` IS `domain` or a subdomain of it — never a lookalike suffix
|
|
39
|
+
* (`notyoutube.com` doesn't match `youtube.com`). RFC 6265 §5.1.3 domain-
|
|
40
|
+
* matching semantics, the same rule cookies use.
|
|
41
|
+
*/
|
|
42
|
+
export declare function hostMatches(host: string, domain: string): boolean;
|
|
7
43
|
/**
|
|
8
44
|
* The same URL minus tracking params: safe to fetch, share, and display.
|
|
9
45
|
* Unparseable or non-http(s) input is returned unchanged.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/universal/url/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/universal/url/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,YAAY;IAC5B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACpD,uFAAuF;IACvF,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,sDAAsD;AACtD,MAAM,WAAW,QAAQ;IACxB,2EAA2E;IAC3E,GAAG,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,QAAQ,EAAE,CAazE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAE9E;AAED,qFAAqF;AACrF,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM1C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM,CAKjE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM,CAU/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,OAAO,CAUhE"}
|
|
@@ -12,20 +12,77 @@
|
|
|
12
12
|
* fragment dropped. Two spellings of one page collide; two different
|
|
13
13
|
* pages never do.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
15
|
+
* Plus the text side: `findUrls(text)` / `asHttpUrl(token)` pull clean URLs
|
|
16
|
+
* out of what a user typed, and `hostOf` / `hostMatches` (RFC 6265 domain-
|
|
17
|
+
* matching) answer host questions.
|
|
18
|
+
*
|
|
19
|
+
* Each concern rides its state of the art instead of hand-rolls:
|
|
20
|
+
* - detection in free text: linkifyjs (scanner-based, TLD-aware, MIT);
|
|
21
|
+
* - parsing/serialization: the WHATWG URL API, never regexes;
|
|
22
|
+
* - which params are tracking: vendored from @protontech/tidy-url (Proton's
|
|
23
|
+
* maintained fork of DrKain/tidy-url, MIT; see tidy-rules.ts, refresh with
|
|
24
|
+
* `pnpm update-url-rules`) plus a small tested overlay (overlay.ts) —
|
|
25
|
+
* param names compare literally (lowercased), per host;
|
|
26
|
+
* - `urlKey` is ours: no standard exists for cache identity.
|
|
21
27
|
*
|
|
22
28
|
* Unparseable or non-http(s) input passes through unchanged: these are hygiene
|
|
23
29
|
* functions over user-pasted text, not validators.
|
|
24
30
|
*/
|
|
31
|
+
import { find } from "linkifyjs";
|
|
25
32
|
import { OVERLAY_RULES } from "./overlay.js";
|
|
26
33
|
import { TIDY_RULES } from "./tidy-rules.js";
|
|
27
34
|
export { TIDY_RULES, TIDY_VERSION } from "./tidy-rules.js";
|
|
28
35
|
export { OVERLAY_RULES } from "./overlay.js";
|
|
36
|
+
/**
|
|
37
|
+
* Every http(s) URL in free text, in order, cleaned. Detection is linkifyjs —
|
|
38
|
+
* a real scanner, TLD-aware for scheme-less domains, and it owns the messy
|
|
39
|
+
* text-boundary problems (trailing punctuation, brackets, emails-are-not-URLs)
|
|
40
|
+
* — then each match goes through the URL parser and tracking-param stripping.
|
|
41
|
+
* Scheme-less matches coerce to https:// (drop them with `requireScheme`).
|
|
42
|
+
*/
|
|
43
|
+
export function findUrls(text, opts) {
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const link of find(text, "url", { defaultProtocol: "https" })) {
|
|
46
|
+
// href === value exactly when the text already carried a scheme; otherwise
|
|
47
|
+
// the scanner built href by prepending defaultProtocol onto the bare match.
|
|
48
|
+
const hadScheme = link.href === link.value;
|
|
49
|
+
if (!hadScheme && opts?.requireScheme)
|
|
50
|
+
continue;
|
|
51
|
+
const u = parseHttp(link.href);
|
|
52
|
+
if (!u)
|
|
53
|
+
continue; // a non-http scheme the scanner knows; not our job
|
|
54
|
+
deleteTracking(u, opts);
|
|
55
|
+
out.push({ url: u.toString(), start: link.start, end: link.end, hadScheme });
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A user-pasted token as one CLEAN http(s) URL, or null: {@link findUrls}
|
|
61
|
+
* over the token, first match. The one verb between "text someone typed"
|
|
62
|
+
* and "a URL you can use".
|
|
63
|
+
*/
|
|
64
|
+
export function asHttpUrl(token, opts) {
|
|
65
|
+
return findUrls(token, opts)[0]?.url ?? null;
|
|
66
|
+
}
|
|
67
|
+
/** A URL's host without a leading www., or the input unchanged if it won't parse. */
|
|
68
|
+
export function hostOf(url) {
|
|
69
|
+
try {
|
|
70
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return url;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* True if `host` IS `domain` or a subdomain of it — never a lookalike suffix
|
|
78
|
+
* (`notyoutube.com` doesn't match `youtube.com`). RFC 6265 §5.1.3 domain-
|
|
79
|
+
* matching semantics, the same rule cookies use.
|
|
80
|
+
*/
|
|
81
|
+
export function hostMatches(host, domain) {
|
|
82
|
+
const h = host.toLowerCase().replace(/^www\./, "").replace(/\.$/, "");
|
|
83
|
+
const d = domain.toLowerCase();
|
|
84
|
+
return h === d || h.endsWith(`.${d}`);
|
|
85
|
+
}
|
|
29
86
|
/**
|
|
30
87
|
* The same URL minus tracking params: safe to fetch, share, and display.
|
|
31
88
|
* Unparseable or non-http(s) input is returned unchanged.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/universal/url/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/universal/url/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAyB,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAuB7C;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,IAAsB;IAC5D,MAAM,GAAG,GAAe,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QACpE,2EAA2E;QAC3E,4EAA4E;QAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC;QAC3C,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE,aAAa;YAAE,SAAS;QAChD,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,C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AC,CAAC;IAC1C,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO;IAC9B,yEAAyE;IACzE,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACtB,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAAE,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adriangalilea/utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "TypeScript utilities - logger, currency, formatter, GramIO bot plugins, and more",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -220,17 +220,17 @@
|
|
|
220
220
|
"zod": "^4.4.3"
|
|
221
221
|
},
|
|
222
222
|
"peerDependencies": {
|
|
223
|
+
"@ai-sdk/anthropic": "^4.0.0",
|
|
224
|
+
"@ai-sdk/openai-compatible": "^3.0.0",
|
|
223
225
|
"@gramio/format": ">=0.8.0",
|
|
224
226
|
"@gramio/session": ">=0.2.0",
|
|
227
|
+
"@gramio/split": "^0.0.1",
|
|
225
228
|
"@gramio/storage": ">=2.0.0",
|
|
229
|
+
"@openrouter/ai-sdk-provider": "^3.0.0",
|
|
230
|
+
"ai": "^7.0.0",
|
|
226
231
|
"gramio": "^0.12.0",
|
|
227
232
|
"marked": ">=12",
|
|
228
|
-
"zod": ">=3.22"
|
|
229
|
-
"ai": "^7.0.0",
|
|
230
|
-
"@ai-sdk/anthropic": "^4.0.0",
|
|
231
|
-
"@ai-sdk/openai-compatible": "^3.0.0",
|
|
232
|
-
"@openrouter/ai-sdk-provider": "^3.0.0",
|
|
233
|
-
"@gramio/split": "^0.0.1"
|
|
233
|
+
"zod": ">=3.22"
|
|
234
234
|
},
|
|
235
235
|
"peerDependenciesMeta": {
|
|
236
236
|
"@gramio/format": {
|
|
@@ -279,5 +279,8 @@
|
|
|
279
279
|
"url": "https://github.com/adriangalilea/ts-utils/issues"
|
|
280
280
|
},
|
|
281
281
|
"homepage": "https://github.com/adriangalilea/ts-utils#readme",
|
|
282
|
-
"sideEffects": false
|
|
282
|
+
"sideEffects": false,
|
|
283
|
+
"dependencies": {
|
|
284
|
+
"linkifyjs": "^4.3.3"
|
|
285
|
+
}
|
|
283
286
|
}
|