namespace-guard 0.20.0 → 0.22.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 +8 -8
- package/dist/cli.js +389 -1796
- package/dist/cli.mjs +389 -1796
- package/dist/composability-vectors.js +385 -1794
- package/dist/composability-vectors.mjs +385 -1794
- package/dist/confusable-weights.d.mts +5 -3
- package/dist/confusable-weights.d.ts +5 -3
- package/dist/confusable-weights.js +807 -5035
- package/dist/confusable-weights.mjs +807 -5035
- package/dist/font-specific-weights.d.mts +4 -5
- package/dist/font-specific-weights.d.ts +4 -5
- package/dist/font-specific-weights.js +2848 -18740
- package/dist/font-specific-weights.mjs +2848 -18740
- package/dist/index.d.mts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +392 -1799
- package/dist/index.mjs +392 -1799
- package/dist/profanity-en.js +389 -1796
- package/dist/profanity-en.mjs +389 -1796
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
Existing confusable standards (TR39, IDNA) map non-Latin characters to Latin equivalents. They have zero coverage for confusable pairs *between* two non-Latin scripts.
|
|
16
16
|
|
|
17
|
-
namespace-guard ships
|
|
17
|
+
namespace-guard ships measured lookalike pairs from [confusable-vision](https://github.com/paultendo/confusable-vision) release 2026.09.24 (vector-outline raycasting, [RaySpace](https://paultendo.github.io/posts/rayspace-methodology/), at the size and baseline position glyphs have in running text, across every macOS system font and Roboto). They include pairs between two non-Latin scripts that no standard covers:
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { areConfusable, detectCrossScriptRisk } from "namespace-guard";
|
|
21
21
|
import { CONFUSABLE_WEIGHTS } from "namespace-guard/confusable-weights";
|
|
22
22
|
|
|
23
|
-
// Hangul ᅵ and Han 丨 are
|
|
23
|
+
// Hangul ᅵ and Han 丨 are alike in every text font that draws both
|
|
24
24
|
areConfusable("\u1175", "\u4E28", { weights: CONFUSABLE_WEIGHTS }); // true
|
|
25
25
|
|
|
26
|
-
//
|
|
27
|
-
areConfusable("\
|
|
26
|
+
// Cyrillic ј and Greek ϳ are alike in 95% of text fonts
|
|
27
|
+
areConfusable("\u0458", "\u03F3", { weights: CONFUSABLE_WEIGHTS }); // true
|
|
28
28
|
|
|
29
29
|
// Cyrillic І and Greek Ι are identical outlines (62 fonts)
|
|
30
30
|
areConfusable("\u0406", "\u0399", { weights: CONFUSABLE_WEIGHTS }); // true
|
|
@@ -37,7 +37,7 @@ const risk = detectCrossScriptRisk("\u1175\u4E28", { weights: CONFUSABLE_WEIGHTS
|
|
|
37
37
|
// { riskLevel: "high", scripts: ["han", "hangul"], crossScriptPairs: [...] }
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
322 pairs ship, each found alike at running-text size within one font or across fonts. A pair's `danger` (0–1) is the share of text fonts (or font combinations) where it holds; filter at `danger > 0.7` (85 pairs) for the pairs alike almost everywhere. `namespace-guard/font-specific-weights` gives the same pairs per font (106 fonts), for saying which font makes a lookalike most convincing. Data licensed CC-BY-4.0.
|
|
41
41
|
|
|
42
42
|
## Installation
|
|
43
43
|
|
|
@@ -88,7 +88,7 @@ if (!result.claimed) {
|
|
|
88
88
|
|
|
89
89
|
## What You Get
|
|
90
90
|
|
|
91
|
-
- **Cross-script confusable detection** with
|
|
91
|
+
- **Cross-script confusable detection** with measured pairs, including pairs between two non-Latin scripts
|
|
92
92
|
- Cross-table collision checks (users, orgs, teams, etc.)
|
|
93
93
|
- Reserved-name blocking with category-aware messages
|
|
94
94
|
- Unicode anti-spoofing (NFKC + confusable detection + mixed-script/risk controls)
|
|
@@ -136,7 +136,7 @@ areConfusable("paypal", "pa\u0443pal"); // true
|
|
|
136
136
|
confusableDistance("paypal", "pa\u0443pal"); // graded similarity + chainDepth + explainable steps
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
For measured visual scoring, pass the optional weights from confusable-vision (
|
|
139
|
+
For measured visual scoring, pass the optional weights from confusable-vision release 2026.09.24 (322 pairs measured at running-text size by vector-outline raycasting). Each pair has a `danger` score (0–1), the share of text fonts where it holds; use `danger > 0.7` for the pairs alike almost everywhere. The `context` filter restricts to identifier-valid, domain-valid, or all pairs.
|
|
140
140
|
|
|
141
141
|
```typescript
|
|
142
142
|
import { confusableDistance } from "namespace-guard";
|
|
@@ -179,7 +179,7 @@ The `danger` score (0–1) is always returned when a script match is found, even
|
|
|
179
179
|
|
|
180
180
|
Two research tracks feed the library:
|
|
181
181
|
|
|
182
|
-
**Visual measurement.**
|
|
182
|
+
**Visual measurement.** Lookalike pairs measured by vector-outline raycasting ([RaySpace](https://paultendo.github.io/posts/rayspace-methodology/)) at the size and baseline position glyphs have in running text, across every macOS system font and Roboto, and calibrated against pairs with known answers. Release 2026.09.24 finds 857 pairs alike; the 322 that pass its thresholds ship here, including pairs between two non-Latin scripts (Cyrillic/Greek, Katakana/Hiragana, Han/Hangul) that no standard covers. The March 2026 measurements were blind to size and are superseded. Full dataset published as [confusable-vision](https://github.com/paultendo/confusable-vision) (CC-BY-4.0).
|
|
183
183
|
|
|
184
184
|
**Normalisation composability.** 31 characters where Unicode's confusables.txt and NFKC normalisation disagree. Two production maps (`CONFUSABLE_MAP` for NFKC-first, `CONFUSABLE_MAP_FULL` for raw-input pipelines), a benchmark corpus, and composability vectors wired into CLI drift baselines. Submitted to [Unicode public review (PRI #540)](https://www.unicode.org/review/pri540/) and published in [accumulated feedback](https://www.unicode.org/review/pri540/feedback.html).
|
|
185
185
|
|