mcp-web-validator 1.3.50 → 1.3.53
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/CHANGELOG.md +53 -0
- package/README.md +66 -4
- package/dist/audit-history.d.ts +9 -0
- package/dist/audit-history.js +27 -0
- package/dist/audit-history.js.map +1 -1
- package/dist/index.js +2535 -30
- package/dist/index.js.map +1 -1
- package/dist/mcp-bounds.d.ts +11 -0
- package/dist/mcp-bounds.js +68 -0
- package/dist/mcp-bounds.js.map +1 -0
- package/dist/modules/browser-ux/lighthouse-lab-probe.d.ts +21 -0
- package/dist/modules/browser-ux/lighthouse-lab-probe.js +190 -0
- package/dist/modules/browser-ux/lighthouse-lab-probe.js.map +1 -0
- package/dist/modules/browser-ux/lighthouse-lab.d.ts +61 -0
- package/dist/modules/browser-ux/lighthouse-lab.js +98 -0
- package/dist/modules/browser-ux/lighthouse-lab.js.map +1 -0
- package/dist/modules/browser-ux/media-diagnostics.d.ts +41 -0
- package/dist/modules/browser-ux/media-diagnostics.js +183 -0
- package/dist/modules/browser-ux/media-diagnostics.js.map +1 -0
- package/dist/modules/browser-ux/raw-rendered-diff.d.ts +70 -0
- package/dist/modules/browser-ux/raw-rendered-diff.js +262 -0
- package/dist/modules/browser-ux/raw-rendered-diff.js.map +1 -0
- package/dist/modules/browser-ux/raw-rendered-probe.d.ts +17 -0
- package/dist/modules/browser-ux/raw-rendered-probe.js +163 -0
- package/dist/modules/browser-ux/raw-rendered-probe.js.map +1 -0
- package/dist/modules/browser-ux/resource-failures-probe.d.ts +11 -0
- package/dist/modules/browser-ux/resource-failures-probe.js +231 -0
- package/dist/modules/browser-ux/resource-failures-probe.js.map +1 -0
- package/dist/modules/browser-ux/resource-failures.d.ts +79 -0
- package/dist/modules/browser-ux/resource-failures.js +178 -0
- package/dist/modules/browser-ux/resource-failures.js.map +1 -0
- package/dist/modules/browser-ux/viewport-parity-probe.d.ts +5 -0
- package/dist/modules/browser-ux/viewport-parity-probe.js +307 -0
- package/dist/modules/browser-ux/viewport-parity-probe.js.map +1 -0
- package/dist/modules/browser-ux/viewport-parity.d.ts +112 -0
- package/dist/modules/browser-ux/viewport-parity.js +224 -0
- package/dist/modules/browser-ux/viewport-parity.js.map +1 -0
- package/dist/modules/browser-ux/wcag-interactions.d.ts +95 -0
- package/dist/modules/browser-ux/wcag-interactions.js +360 -0
- package/dist/modules/browser-ux/wcag-interactions.js.map +1 -0
- package/dist/modules/change-regression/availability-history-store.d.ts +18 -0
- package/dist/modules/change-regression/availability-history-store.js +168 -0
- package/dist/modules/change-regression/availability-history-store.js.map +1 -0
- package/dist/modules/change-regression/crawler-log-correlation.d.ts +111 -0
- package/dist/modules/change-regression/crawler-log-correlation.js +374 -0
- package/dist/modules/change-regression/crawler-log-correlation.js.map +1 -0
- package/dist/modules/change-regression/google-common-crawler-ip.d.ts +15 -0
- package/dist/modules/change-regression/google-common-crawler-ip.js +129 -0
- package/dist/modules/change-regression/google-common-crawler-ip.js.map +1 -0
- package/dist/modules/change-regression/historical-comparisons.d.ts +120 -0
- package/dist/modules/change-regression/historical-comparisons.js +330 -0
- package/dist/modules/change-regression/historical-comparisons.js.map +1 -0
- package/dist/modules/change-regression/production-change-comparison.d.ts +68 -0
- package/dist/modules/change-regression/production-change-comparison.js +214 -0
- package/dist/modules/change-regression/production-change-comparison.js.map +1 -0
- package/dist/modules/change-regression/regression-alerts.d.ts +73 -0
- package/dist/modules/change-regression/regression-alerts.js +183 -0
- package/dist/modules/change-regression/regression-alerts.js.map +1 -0
- package/dist/modules/change-regression/strict-observation-time.d.ts +7 -0
- package/dist/modules/change-regression/strict-observation-time.js +31 -0
- package/dist/modules/change-regression/strict-observation-time.js.map +1 -0
- package/dist/modules/content-schema/citation-methodology-consistency.d.ts +108 -0
- package/dist/modules/content-schema/citation-methodology-consistency.js +360 -0
- package/dist/modules/content-schema/citation-methodology-consistency.js.map +1 -0
- package/dist/modules/content-schema/competitor-intent-comparison.d.ts +74 -0
- package/dist/modules/content-schema/competitor-intent-comparison.js +185 -0
- package/dist/modules/content-schema/competitor-intent-comparison.js.map +1 -0
- package/dist/modules/content-schema/empty-boilerplate-content.d.ts +36 -0
- package/dist/modules/content-schema/empty-boilerplate-content.js +225 -0
- package/dist/modules/content-schema/empty-boilerplate-content.js.map +1 -0
- package/dist/modules/content-schema/extract-citation-methodology.d.ts +6 -0
- package/dist/modules/content-schema/extract-citation-methodology.js +201 -0
- package/dist/modules/content-schema/extract-citation-methodology.js.map +1 -0
- package/dist/modules/content-schema/extract-competitor-intent.d.ts +2 -0
- package/dist/modules/content-schema/extract-competitor-intent.js +140 -0
- package/dist/modules/content-schema/extract-competitor-intent.js.map +1 -0
- package/dist/modules/content-schema/extract-main-content.d.ts +6 -0
- package/dist/modules/content-schema/extract-main-content.js +33 -0
- package/dist/modules/content-schema/extract-main-content.js.map +1 -0
- package/dist/modules/content-schema/extract-metadata-consistency.d.ts +3 -0
- package/dist/modules/content-schema/extract-metadata-consistency.js +62 -0
- package/dist/modules/content-schema/extract-metadata-consistency.js.map +1 -0
- package/dist/modules/content-schema/extract-product-claims.d.ts +3 -0
- package/dist/modules/content-schema/extract-product-claims.js +58 -0
- package/dist/modules/content-schema/extract-product-claims.js.map +1 -0
- package/dist/modules/content-schema/extract-structured-data.d.ts +3 -0
- package/dist/modules/content-schema/extract-structured-data.js +25 -0
- package/dist/modules/content-schema/extract-structured-data.js.map +1 -0
- package/dist/modules/content-schema/metadata-consistency.d.ts +66 -0
- package/dist/modules/content-schema/metadata-consistency.js +282 -0
- package/dist/modules/content-schema/metadata-consistency.js.map +1 -0
- package/dist/modules/content-schema/product-claims.d.ts +73 -0
- package/dist/modules/content-schema/product-claims.js +195 -0
- package/dist/modules/content-schema/product-claims.js.map +1 -0
- package/dist/modules/content-schema/same-language-duplicates.d.ts +52 -0
- package/dist/modules/content-schema/same-language-duplicates.js +158 -0
- package/dist/modules/content-schema/same-language-duplicates.js.map +1 -0
- package/dist/modules/content-schema/structured-data-validation.d.ts +37 -0
- package/dist/modules/content-schema/structured-data-validation.js +385 -0
- package/dist/modules/content-schema/structured-data-validation.js.map +1 -0
- package/dist/modules/external-metrics/crux-field-probe.d.ts +10 -0
- package/dist/modules/external-metrics/crux-field-probe.js +113 -0
- package/dist/modules/external-metrics/crux-field-probe.js.map +1 -0
- package/dist/modules/external-metrics/crux-field.d.ts +61 -0
- package/dist/modules/external-metrics/crux-field.js +231 -0
- package/dist/modules/external-metrics/crux-field.js.map +1 -0
- package/dist/modules/http-crawl/availability-observations.d.ts +68 -0
- package/dist/modules/http-crawl/availability-observations.js +206 -0
- package/dist/modules/http-crawl/availability-observations.js.map +1 -0
- package/dist/modules/http-crawl/availability-probe.d.ts +8 -0
- package/dist/modules/http-crawl/availability-probe.js +46 -0
- package/dist/modules/http-crawl/availability-probe.js.map +1 -0
- package/dist/modules/http-crawl/crawler-access-probe.d.ts +6 -0
- package/dist/modules/http-crawl/crawler-access-probe.js +79 -0
- package/dist/modules/http-crawl/crawler-access-probe.js.map +1 -0
- package/dist/modules/http-crawl/crawler-access.d.ts +75 -0
- package/dist/modules/http-crawl/crawler-access.js +404 -0
- package/dist/modules/http-crawl/crawler-access.js.map +1 -0
- package/dist/modules/http-crawl/http-delivery-probe.d.ts +3 -0
- package/dist/modules/http-crawl/http-delivery-probe.js +44 -0
- package/dist/modules/http-crawl/http-delivery-probe.js.map +1 -0
- package/dist/modules/http-crawl/http-delivery.d.ts +64 -0
- package/dist/modules/http-crawl/http-delivery.js +269 -0
- package/dist/modules/http-crawl/http-delivery.js.map +1 -0
- package/dist/modules/http-crawl/https-security.d.ts +84 -0
- package/dist/modules/http-crawl/https-security.js +441 -0
- package/dist/modules/http-crawl/https-security.js.map +1 -0
- package/dist/modules/http-crawl/non-html-directives.d.ts +74 -0
- package/dist/modules/http-crawl/non-html-directives.js +353 -0
- package/dist/modules/http-crawl/non-html-directives.js.map +1 -0
- package/dist/modules/http-crawl/redirect-canonical-chains.d.ts +80 -0
- package/dist/modules/http-crawl/redirect-canonical-chains.js +459 -0
- package/dist/modules/http-crawl/redirect-canonical-chains.js.map +1 -0
- package/dist/modules/http-crawl/redirect-canonical-probe.d.ts +6 -0
- package/dist/modules/http-crawl/redirect-canonical-probe.js +83 -0
- package/dist/modules/http-crawl/redirect-canonical-probe.js.map +1 -0
- package/dist/modules/http-crawl/sitemap-inventory-probe.d.ts +8 -0
- package/dist/modules/http-crawl/sitemap-inventory-probe.js +155 -0
- package/dist/modules/http-crawl/sitemap-inventory-probe.js.map +1 -0
- package/dist/modules/http-crawl/sitemap-inventory.d.ts +107 -0
- package/dist/modules/http-crawl/sitemap-inventory.js +557 -0
- package/dist/modules/http-crawl/sitemap-inventory.js.map +1 -0
- package/dist/modules/http-crawl/url-variants.d.ts +86 -0
- package/dist/modules/http-crawl/url-variants.js +379 -0
- package/dist/modules/http-crawl/url-variants.js.map +1 -0
- package/dist/modules/site-architecture/extract-internal-links.d.ts +3 -0
- package/dist/modules/site-architecture/extract-internal-links.js +88 -0
- package/dist/modules/site-architecture/extract-internal-links.js.map +1 -0
- package/dist/modules/site-architecture/extract-multilingual-page.d.ts +2 -0
- package/dist/modules/site-architecture/extract-multilingual-page.js +29 -0
- package/dist/modules/site-architecture/extract-multilingual-page.js.map +1 -0
- package/dist/modules/site-architecture/internal-link-graph-probe.d.ts +7 -0
- package/dist/modules/site-architecture/internal-link-graph-probe.js +116 -0
- package/dist/modules/site-architecture/internal-link-graph-probe.js.map +1 -0
- package/dist/modules/site-architecture/internal-link-graph.d.ts +113 -0
- package/dist/modules/site-architecture/internal-link-graph.js +414 -0
- package/dist/modules/site-architecture/internal-link-graph.js.map +1 -0
- package/dist/modules/site-architecture/internal-link-quality.d.ts +77 -0
- package/dist/modules/site-architecture/internal-link-quality.js +260 -0
- package/dist/modules/site-architecture/internal-link-quality.js.map +1 -0
- package/dist/modules/site-architecture/multilingual-clusters.d.ts +82 -0
- package/dist/modules/site-architecture/multilingual-clusters.js +363 -0
- package/dist/modules/site-architecture/multilingual-clusters.js.map +1 -0
- package/dist/network.d.ts +4 -0
- package/dist/network.js +18 -2
- package/dist/network.js.map +1 -1
- package/dist/presentation.d.ts +53 -0
- package/dist/presentation.js +526 -0
- package/dist/presentation.js.map +1 -1
- package/dist/screenshot.d.ts +2 -1
- package/dist/screenshot.js +4 -2
- package/dist/screenshot.js.map +1 -1
- package/dist/seo-auditor.js +16 -6
- package/dist/seo-auditor.js.map +1 -1
- package/package.json +7 -4
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P1-08: conservative internal-link and anchor-label quality review.
|
|
3
|
+
*
|
|
4
|
+
* The analyzed graph is strictly the caller-supplied same-origin HTML sample.
|
|
5
|
+
* No network, source authentication, semantic topic classifier or ranking data.
|
|
6
|
+
*/
|
|
7
|
+
export const MAX_LINK_PAGES = 8;
|
|
8
|
+
export const MAX_LINK_HTML_BYTES = 160_000;
|
|
9
|
+
export const MAX_LINK_TOTAL_HTML_BYTES = 900_000;
|
|
10
|
+
export const MAX_LINKS_PER_PAGE = 160;
|
|
11
|
+
export const MAX_LINK_FINDINGS = 12;
|
|
12
|
+
export function emptyInternalLinkReview() {
|
|
13
|
+
return {
|
|
14
|
+
scope: "caller_supplied_same_origin_html_only",
|
|
15
|
+
pages_sampled: 0, pages_eligible: 0, origin: "",
|
|
16
|
+
internal_links_observed: 0, external_links_observed: 0,
|
|
17
|
+
excluded_navigation_links: 0, linked_sample_targets: 0,
|
|
18
|
+
unmatched_internal_links: 0, missing_anchor_labels: 0,
|
|
19
|
+
generic_anchor_links: 0, low_heading_overlap_links: 0,
|
|
20
|
+
ambiguous_anchor_target_groups: 0, nofollow_internal_links: 0,
|
|
21
|
+
self_links: 0, fragment_only_links: 0, skipped_non_http_links: 0,
|
|
22
|
+
pages: [], coverage_limited: true,
|
|
23
|
+
limitations: ["This bounded static same-origin link sample could not be compared."],
|
|
24
|
+
total_findings: 0, findings: [], findings_truncated: false,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function safeLinkPageUrl(raw) {
|
|
28
|
+
if (!raw || raw.length > 512)
|
|
29
|
+
return undefined;
|
|
30
|
+
try {
|
|
31
|
+
const value = new URL(raw);
|
|
32
|
+
if (!["http:", "https:"].includes(value.protocol) || !value.hostname ||
|
|
33
|
+
value.username || value.password || value.search || value.hash || value.port ||
|
|
34
|
+
value.hostname.length > 180)
|
|
35
|
+
return undefined;
|
|
36
|
+
return value.href;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const stopWords = new Set([
|
|
43
|
+
"a", "an", "and", "are", "as", "at", "be", "by", "for", "from", "how",
|
|
44
|
+
"in", "into", "is", "it", "of", "on", "or", "our", "the", "this", "to",
|
|
45
|
+
"us", "with", "you", "your", "what", "why", "when", "where", "which",
|
|
46
|
+
]);
|
|
47
|
+
const genericLabels = new Set([
|
|
48
|
+
"here", "click here", "read more", "learn more", "more", "more info",
|
|
49
|
+
"more information", "details", "see more", "view more", "continue",
|
|
50
|
+
"this link", "link", "visit", "go", "open", "read", "see details",
|
|
51
|
+
]);
|
|
52
|
+
function normalizeWords(raw) {
|
|
53
|
+
return (raw.normalize("NFKC").toLocaleLowerCase("en")
|
|
54
|
+
.match(/[\p{L}\p{N}]+/gu) ?? [])
|
|
55
|
+
.filter((word) => word.length >= 2 && word.length <= 35)
|
|
56
|
+
.slice(0, 90);
|
|
57
|
+
}
|
|
58
|
+
function keyWords(raw) {
|
|
59
|
+
return new Set(normalizeWords(raw).filter((word) => !stopWords.has(word)));
|
|
60
|
+
}
|
|
61
|
+
function generic(label) {
|
|
62
|
+
return genericLabels.has(normalizeWords(label).join(" "));
|
|
63
|
+
}
|
|
64
|
+
/** Path-only comparison: never dereference the input URL, guess redirects, or merge query variants. */
|
|
65
|
+
function resolveHref(raw, base) {
|
|
66
|
+
if (!raw || raw.length > 1024)
|
|
67
|
+
return undefined;
|
|
68
|
+
const trimmed = raw.trim();
|
|
69
|
+
if (!trimmed)
|
|
70
|
+
return undefined;
|
|
71
|
+
try {
|
|
72
|
+
const target = new URL(trimmed, base);
|
|
73
|
+
if (!["http:", "https:"].includes(target.protocol) || !target.hostname ||
|
|
74
|
+
target.username || target.password || target.port)
|
|
75
|
+
return undefined;
|
|
76
|
+
const fragmentOnly = trimmed.startsWith("#");
|
|
77
|
+
const query = Boolean(target.search);
|
|
78
|
+
target.hash = "";
|
|
79
|
+
target.search = "";
|
|
80
|
+
return { target, fragmentOnly, query };
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function reviewInternalLinks(observations) {
|
|
87
|
+
if (observations.length < 1 || observations.length > MAX_LINK_PAGES) {
|
|
88
|
+
throw new Error("Supply one to eight static page observations.");
|
|
89
|
+
}
|
|
90
|
+
const urls = observations.map((item) => safeLinkPageUrl(item.url));
|
|
91
|
+
if (urls.some((url) => !url))
|
|
92
|
+
throw new Error("All input page URL labels must be safe HTTP(S) URLs.");
|
|
93
|
+
const references = urls.map((url) => new URL(url));
|
|
94
|
+
const site = references[0].origin;
|
|
95
|
+
if (references.some((url) => url.origin !== site)) {
|
|
96
|
+
throw new Error("All supplied pages must share the same exact origin.");
|
|
97
|
+
}
|
|
98
|
+
if (new Set(urls).size !== urls.length) {
|
|
99
|
+
throw new Error("Supplied page URL labels must be unique.");
|
|
100
|
+
}
|
|
101
|
+
const pathIndex = new Map(references.map((url, index) => [url.pathname, index]));
|
|
102
|
+
let totalInternal = 0, totalExternal = 0, totalExcluded = 0;
|
|
103
|
+
let totalUnmatched = 0, totalMissing = 0, totalGeneric = 0, totalNofollow = 0;
|
|
104
|
+
let totalSelf = 0, totalFragments = 0, totalSkipped = 0, lowOverlap = 0, ambiguous = 0;
|
|
105
|
+
let anyTruncated = false;
|
|
106
|
+
const findings = [];
|
|
107
|
+
const linked = new Set();
|
|
108
|
+
const reports = [];
|
|
109
|
+
const targetWords = observations.map((item) => keyWords(item.title + " " + item.h1));
|
|
110
|
+
function report(code, severity, source_page, count, message, confidence = "review", target_page) {
|
|
111
|
+
findings.push({
|
|
112
|
+
code, severity, confidence, source_page, count,
|
|
113
|
+
...(target_page === undefined ? {} : { target_page }),
|
|
114
|
+
message,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
for (const [index, page] of observations.entries()) {
|
|
118
|
+
const source_page = index + 1;
|
|
119
|
+
const base = references[index];
|
|
120
|
+
const stats = {
|
|
121
|
+
page: source_page, main_present: page.main_present, internal_links: 0,
|
|
122
|
+
external_links: 0, linked_sample_pages: 0, unmatched_internal_links: 0,
|
|
123
|
+
missing_anchor_labels: 0, generic_anchor_links: 0,
|
|
124
|
+
nofollow_internal_links: 0, self_links: 0, fragment_only_links: 0,
|
|
125
|
+
extraction_limited: page.extraction_limited,
|
|
126
|
+
};
|
|
127
|
+
const linkedHere = new Set();
|
|
128
|
+
const labelsToTargets = new Map();
|
|
129
|
+
let lowHere = 0;
|
|
130
|
+
totalExcluded += Math.min(page.navigation_links_excluded, MAX_LINKS_PER_PAGE);
|
|
131
|
+
if (page.links.length > MAX_LINKS_PER_PAGE) {
|
|
132
|
+
anyTruncated = true;
|
|
133
|
+
}
|
|
134
|
+
if (page.extraction_limited)
|
|
135
|
+
anyTruncated = true;
|
|
136
|
+
for (const link of page.links.slice(0, MAX_LINKS_PER_PAGE)) {
|
|
137
|
+
const resolved = resolveHref(link.href, base);
|
|
138
|
+
if (!resolved) {
|
|
139
|
+
totalSkipped += 1;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (resolved.target.origin !== site) {
|
|
143
|
+
stats.external_links += 1;
|
|
144
|
+
totalExternal += 1;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (resolved.fragmentOnly) {
|
|
148
|
+
stats.fragment_only_links += 1;
|
|
149
|
+
totalFragments += 1;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
stats.internal_links += 1;
|
|
153
|
+
totalInternal += 1;
|
|
154
|
+
const self = !resolved.query && resolved.target.pathname === base.pathname;
|
|
155
|
+
if (self) {
|
|
156
|
+
stats.self_links += 1;
|
|
157
|
+
totalSelf += 1;
|
|
158
|
+
}
|
|
159
|
+
if (link.nofollow) {
|
|
160
|
+
stats.nofollow_internal_links += 1;
|
|
161
|
+
totalNofollow += 1;
|
|
162
|
+
}
|
|
163
|
+
if (!link.accessible || !link.label.trim()) {
|
|
164
|
+
stats.missing_anchor_labels += 1;
|
|
165
|
+
totalMissing += 1;
|
|
166
|
+
}
|
|
167
|
+
else if (generic(link.label)) {
|
|
168
|
+
stats.generic_anchor_links += 1;
|
|
169
|
+
totalGeneric += 1;
|
|
170
|
+
}
|
|
171
|
+
const targetIndex = resolved.query ? undefined : pathIndex.get(resolved.target.pathname);
|
|
172
|
+
if (targetIndex === undefined) {
|
|
173
|
+
stats.unmatched_internal_links += 1;
|
|
174
|
+
totalUnmatched += 1;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (!self) {
|
|
178
|
+
linkedHere.add(targetIndex);
|
|
179
|
+
linked.add(targetIndex);
|
|
180
|
+
}
|
|
181
|
+
if (!link.accessible || !link.label.trim())
|
|
182
|
+
continue;
|
|
183
|
+
const normalized = normalizeWords(link.label).join(" ");
|
|
184
|
+
// Non-empty reusable anchors to multiple distinct targets can be
|
|
185
|
+
// ambiguous without surrounding context; this is only a review lead.
|
|
186
|
+
if (normalized) {
|
|
187
|
+
const targets = labelsToTargets.get(normalized) ?? new Set();
|
|
188
|
+
targets.add(resolved.target.pathname);
|
|
189
|
+
labelsToTargets.set(normalized, targets);
|
|
190
|
+
}
|
|
191
|
+
const anchorWords = keyWords(link.label);
|
|
192
|
+
const destinationWords = targetWords[targetIndex];
|
|
193
|
+
// Small one-word link labels and unknown targets cannot be meaningfully
|
|
194
|
+
// scored; zero overlap here is not proof of topical irrelevance.
|
|
195
|
+
if (!self && !generic(link.label) && anchorWords.size >= 2 &&
|
|
196
|
+
destinationWords.size >= 2 &&
|
|
197
|
+
![...anchorWords].some((term) => destinationWords.has(term))) {
|
|
198
|
+
lowHere += 1;
|
|
199
|
+
lowOverlap += 1;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
stats.linked_sample_pages = linkedHere.size;
|
|
203
|
+
if (stats.missing_anchor_labels)
|
|
204
|
+
report("accessible_anchor_missing", "warning", source_page, stats.missing_anchor_labels, "Some same-origin main-content links have no observed accessible name; review labels, image alternatives and nearby context.", "observed");
|
|
205
|
+
if (stats.generic_anchor_links)
|
|
206
|
+
report("generic_anchor_text", "info", source_page, stats.generic_anchor_links, "One or more contextual links use a generic English-only label such as 'read more'; review their accessible names in context.");
|
|
207
|
+
const ambiguousGroups = [...labelsToTargets.values()].filter((values) => values.size >= 2).length;
|
|
208
|
+
ambiguous += ambiguousGroups;
|
|
209
|
+
if (ambiguousGroups)
|
|
210
|
+
report("repeated_anchor_multiple_targets", "info", source_page, ambiguousGroups, "The same normalized anchor label points to several different supplied targets; confirm that destination differences are clear to readers.");
|
|
211
|
+
if (lowHere)
|
|
212
|
+
report("anchor_target_heading_low_overlap", "info", source_page, lowHere, "Some descriptive anchor labels share no exact content tokens with the sampled target title or first main heading; synonym and semantic relevance were not assessed.");
|
|
213
|
+
if (stats.nofollow_internal_links)
|
|
214
|
+
report("nofollow_contextual_internal", "info", source_page, stats.nofollow_internal_links, "One or more same-origin contextual links declare rel=nofollow; confirm this is intentional.", "observed");
|
|
215
|
+
if (page.main_present && stats.internal_links === 0) {
|
|
216
|
+
report("no_contextual_internal_links", "info", source_page, 1, "No same-origin contextual links were observed in this page's main content; navigation links were intentionally excluded.");
|
|
217
|
+
}
|
|
218
|
+
else if (page.main_present && stats.internal_links > 0 && linkedHere.size === 0 &&
|
|
219
|
+
observations.length > 1 && stats.unmatched_internal_links > 0) {
|
|
220
|
+
report("no_sampled_contextual_internal_links", "info", source_page, 1, "This page's observed internal main links do not reach another supplied page; unknown targets were not crawled or judged broken.");
|
|
221
|
+
}
|
|
222
|
+
if (stats.unmatched_internal_links)
|
|
223
|
+
report("sampled_target_unobserved", "info", source_page, stats.unmatched_internal_links, "Some same-origin link targets are outside this supplied page set or use query variants; their status and relevance remain unverified.");
|
|
224
|
+
if (!page.main_present)
|
|
225
|
+
report("page_main_missing", "info", source_page, 1, "No explicit main/article region was found; body fallback may include extra site chrome.");
|
|
226
|
+
if (page.extraction_limited)
|
|
227
|
+
report("link_sample_truncated", "info", source_page, 1, "This page reached a bounded extraction cap; further links were not inspected.");
|
|
228
|
+
reports.push(stats);
|
|
229
|
+
}
|
|
230
|
+
const priority = { warning: 0, info: 1 };
|
|
231
|
+
findings.sort((a, b) => priority[a.severity] - priority[b.severity] ||
|
|
232
|
+
a.source_page - b.source_page || a.code.localeCompare(b.code));
|
|
233
|
+
return {
|
|
234
|
+
scope: "caller_supplied_same_origin_html_only",
|
|
235
|
+
pages_sampled: observations.length,
|
|
236
|
+
pages_eligible: observations.length,
|
|
237
|
+
origin: site,
|
|
238
|
+
internal_links_observed: totalInternal, external_links_observed: totalExternal,
|
|
239
|
+
excluded_navigation_links: totalExcluded, linked_sample_targets: linked.size,
|
|
240
|
+
unmatched_internal_links: totalUnmatched,
|
|
241
|
+
missing_anchor_labels: totalMissing, generic_anchor_links: totalGeneric,
|
|
242
|
+
low_heading_overlap_links: lowOverlap,
|
|
243
|
+
ambiguous_anchor_target_groups: ambiguous,
|
|
244
|
+
nofollow_internal_links: totalNofollow,
|
|
245
|
+
self_links: totalSelf, fragment_only_links: totalFragments,
|
|
246
|
+
skipped_non_http_links: totalSkipped,
|
|
247
|
+
pages: reports,
|
|
248
|
+
coverage_limited: true,
|
|
249
|
+
limitations: [
|
|
250
|
+
"Only caller-supplied same-origin static HTML and main-content links are compared. Unknown links are not fetched, verified, ranked or assumed broken.",
|
|
251
|
+
"Anchor quality uses visible/accessibility labels, exact English generic phrases and lexical title/H1 overlap only; this is not semantic relevance, PageRank, or Google search guidance.",
|
|
252
|
+
"Navigation/header/footer/hidden links are excluded; links to unsupplied targets, redirects, rel canonical, dynamic JavaScript and query-variant target content remain unverified.",
|
|
253
|
+
...(anyTruncated ? ["At least one HTML/link extraction cap was reached, so some main-content links may be missing."] : []),
|
|
254
|
+
],
|
|
255
|
+
total_findings: findings.length,
|
|
256
|
+
findings: findings.slice(0, MAX_LINK_FINDINGS),
|
|
257
|
+
findings_truncated: findings.length > MAX_LINK_FINDINGS,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=internal-link-quality.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-link-quality.js","sourceRoot":"","sources":["../../../src/modules/site-architecture/internal-link-quality.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAC3C,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAuEpC,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,KAAK,EAAE,uCAAuC;QAC9C,aAAa,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/C,uBAAuB,EAAE,CAAC,EAAE,uBAAuB,EAAE,CAAC;QACtD,yBAAyB,EAAE,CAAC,EAAE,qBAAqB,EAAE,CAAC;QACtD,wBAAwB,EAAE,CAAC,EAAE,qBAAqB,EAAE,CAAC;QACrD,oBAAoB,EAAE,CAAC,EAAE,yBAAyB,EAAE,CAAC;QACrD,8BAA8B,EAAE,CAAC,EAAE,uBAAuB,EAAE,CAAC;QAC7D,UAAU,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,sBAAsB,EAAE,CAA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C,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QACjE,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,OAAO;QACL,KAAK,EAAE,uCAAuC;QAC9C,aAAa,EAAE,YAAY,CAAC,MAAM;QAClC,cAAc,EAAE,YAAY,CAAC,MAAM;QACnC,MAAM,EAAE,IAAI;QACZ,uBAAuB,EAAE,aAAa,EAAE,uBAAuB,EAAE,aAAa;QAC9E,yBAAyB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,CAAC,IAAI;QAC5E,wBAAwB,EAAE,cAAc;QACxC,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY;QACvE,yBAAyB,EAAE,UAAU;QACrC,8BAA8B,EAAE,SAAS;QACzC,uBAAuB,EAAE,aAAa;QACtC,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,cAAc;QAC1D,sBAAsB,EAAE,YAAY;QACpC,KAAK,EAAE,OAAO;QACd,gBAAgB,EAAE,IAAI;QACtB,WAAW,EAAE;YACX,sJAAsJ;YACtJ,yLAAyL;YACzL,mLAAmL;YACnL,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,+FAA+F,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3H;QACD,cAAc,EAAE,QAAQ,CAAC,MAAM;QAC/B,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC;QAC9C,kBAAkB,EAAE,QAAQ,CAAC,MAAM,GAAG,iBAAiB;KACxD,CAAC;AACJ,CAAC","sourcesContent":["/**\n * P1-08: conservative internal-link and anchor-label quality review.\n *\n * The analyzed graph is strictly the caller-supplied same-origin HTML sample.\n * No network, source authentication, semantic topic classifier or ranking data.\n */\nexport const MAX_LINK_PAGES = 8;\nexport const MAX_LINK_HTML_BYTES = 160_000;\nexport const MAX_LINK_TOTAL_HTML_BYTES = 900_000;\nexport const MAX_LINKS_PER_PAGE = 160;\nexport const MAX_LINK_FINDINGS = 12;\n\nexport interface InternalLinkObservation {\n url: string;\n title: string;\n h1: string;\n main_present: boolean;\n navigation_links_excluded: number;\n extraction_limited: boolean;\n links: Array<{\n href: string;\n label: string;\n accessible: boolean;\n nofollow: boolean;\n }>;\n}\nexport type InternalLinkFindingCode =\n | \"accessible_anchor_missing\" | \"generic_anchor_text\" | \"repeated_anchor_multiple_targets\"\n | \"anchor_target_heading_low_overlap\" | \"nofollow_contextual_internal\"\n | \"no_sampled_contextual_internal_links\" | \"no_contextual_internal_links\"\n | \"sampled_target_unobserved\" | \"page_main_missing\" | \"link_sample_truncated\";\n\nexport interface InternalLinkFinding {\n code: InternalLinkFindingCode;\n severity: \"warning\" | \"info\";\n confidence: \"observed\" | \"review\";\n source_page: number;\n target_page?: number;\n count: number;\n message: string;\n}\nexport interface InternalLinkPageReview {\n page: number;\n main_present: boolean;\n internal_links: number;\n external_links: number;\n linked_sample_pages: number;\n unmatched_internal_links: number;\n missing_anchor_labels: number;\n generic_anchor_links: number;\n nofollow_internal_links: number;\n self_links: number;\n fragment_only_links: number;\n extraction_limited: boolean;\n}\nexport interface InternalLinkReview {\n scope: \"caller_supplied_same_origin_html_only\";\n pages_sampled: number;\n pages_eligible: number;\n origin: string;\n internal_links_observed: number;\n external_links_observed: number;\n excluded_navigation_links: number;\n linked_sample_targets: number;\n unmatched_internal_links: number;\n missing_anchor_labels: number;\n generic_anchor_links: number;\n low_heading_overlap_links: number;\n ambiguous_anchor_target_groups: number;\n nofollow_internal_links: number;\n self_links: number;\n fragment_only_links: number;\n skipped_non_http_links: number;\n pages: InternalLinkPageReview[];\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: InternalLinkFinding[];\n findings_truncated: boolean;\n}\n\nexport function emptyInternalLinkReview(): InternalLinkReview {\n return {\n scope: \"caller_supplied_same_origin_html_only\",\n pages_sampled: 0, pages_eligible: 0, origin: \"\",\n internal_links_observed: 0, external_links_observed: 0,\n excluded_navigation_links: 0, linked_sample_targets: 0,\n unmatched_internal_links: 0, missing_anchor_labels: 0,\n generic_anchor_links: 0, low_heading_overlap_links: 0,\n ambiguous_anchor_target_groups: 0, nofollow_internal_links: 0,\n self_links: 0, fragment_only_links: 0, skipped_non_http_links: 0,\n pages: [], coverage_limited: true,\n limitations: [\"This bounded static same-origin link sample could not be compared.\"],\n total_findings: 0, findings: [], findings_truncated: false,\n };\n}\n\nexport function safeLinkPageUrl(raw: string): string | undefined {\n if (!raw || raw.length > 512) return undefined;\n try {\n const value = new URL(raw);\n if (![\"http:\", \"https:\"].includes(value.protocol) || !value.hostname ||\n value.username || value.password || value.search || value.hash || value.port ||\n value.hostname.length > 180) return undefined;\n return value.href;\n } catch {\n return undefined;\n }\n}\n\nconst stopWords = new Set([\n \"a\", \"an\", \"and\", \"are\", \"as\", \"at\", \"be\", \"by\", \"for\", \"from\", \"how\",\n \"in\", \"into\", \"is\", \"it\", \"of\", \"on\", \"or\", \"our\", \"the\", \"this\", \"to\",\n \"us\", \"with\", \"you\", \"your\", \"what\", \"why\", \"when\", \"where\", \"which\",\n]);\nconst genericLabels = new Set([\n \"here\", \"click here\", \"read more\", \"learn more\", \"more\", \"more info\",\n \"more information\", \"details\", \"see more\", \"view more\", \"continue\",\n \"this link\", \"link\", \"visit\", \"go\", \"open\", \"read\", \"see details\",\n]);\n\nfunction normalizeWords(raw: string): string[] {\n return (raw.normalize(\"NFKC\").toLocaleLowerCase(\"en\")\n .match(/[\\p{L}\\p{N}]+/gu) ?? [])\n .filter((word) => word.length >= 2 && word.length <= 35)\n .slice(0, 90);\n}\nfunction keyWords(raw: string): Set<string> {\n return new Set(normalizeWords(raw).filter((word) => !stopWords.has(word)));\n}\nfunction generic(label: string): boolean {\n return genericLabels.has(normalizeWords(label).join(\" \"));\n}\n\n/** Path-only comparison: never dereference the input URL, guess redirects, or merge query variants. */\nfunction resolveHref(raw: string, base: URL): {\n target: URL; fragmentOnly: boolean; query: boolean;\n} | undefined {\n if (!raw || raw.length > 1024) return undefined;\n const trimmed = raw.trim();\n if (!trimmed) return undefined;\n try {\n const target = new URL(trimmed, base);\n if (![\"http:\", \"https:\"].includes(target.protocol) || !target.hostname ||\n target.username || target.password || target.port) return undefined;\n const fragmentOnly = trimmed.startsWith(\"#\");\n const query = Boolean(target.search);\n target.hash = \"\";\n target.search = \"\";\n return { target, fragmentOnly, query };\n } catch {\n return undefined;\n }\n}\n\nexport function reviewInternalLinks(observations: readonly InternalLinkObservation[]): InternalLinkReview {\n if (observations.length < 1 || observations.length > MAX_LINK_PAGES) {\n throw new Error(\"Supply one to eight static page observations.\");\n }\n const urls = observations.map((item) => safeLinkPageUrl(item.url));\n if (urls.some((url) => !url)) throw new Error(\"All input page URL labels must be safe HTTP(S) URLs.\");\n const references = urls.map((url) => new URL(url!));\n const site = references[0].origin;\n if (references.some((url) => url.origin !== site)) {\n throw new Error(\"All supplied pages must share the same exact origin.\");\n }\n if (new Set(urls).size !== urls.length) {\n throw new Error(\"Supplied page URL labels must be unique.\");\n }\n const pathIndex = new Map<string, number>(references.map((url, index) => [url.pathname, index]));\n let totalInternal = 0, totalExternal = 0, totalExcluded = 0;\n let totalUnmatched = 0, totalMissing = 0, totalGeneric = 0, totalNofollow = 0;\n let totalSelf = 0, totalFragments = 0, totalSkipped = 0, lowOverlap = 0, ambiguous = 0;\n let anyTruncated = false;\n const findings: InternalLinkFinding[] = [];\n const linked = new Set<number>();\n const reports: InternalLinkPageReview[] = [];\n const targetWords = observations.map((item) => keyWords(item.title + \" \" + item.h1));\n function report(code: InternalLinkFindingCode, severity: \"warning\" | \"info\",\n source_page: number, count: number, message: string,\n confidence: \"observed\" | \"review\" = \"review\", target_page?: number) {\n findings.push({\n code, severity, confidence, source_page, count,\n ...(target_page === undefined ? {} : { target_page }),\n message,\n });\n }\n\n for (const [index, page] of observations.entries()) {\n const source_page = index + 1;\n const base = references[index];\n const stats: InternalLinkPageReview = {\n page: source_page, main_present: page.main_present, internal_links: 0,\n external_links: 0, linked_sample_pages: 0, unmatched_internal_links: 0,\n missing_anchor_labels: 0, generic_anchor_links: 0,\n nofollow_internal_links: 0, self_links: 0, fragment_only_links: 0,\n extraction_limited: page.extraction_limited,\n };\n const linkedHere = new Set<number>();\n const labelsToTargets = new Map<string, Set<string>>();\n let lowHere = 0;\n totalExcluded += Math.min(page.navigation_links_excluded, MAX_LINKS_PER_PAGE);\n if (page.links.length > MAX_LINKS_PER_PAGE) {\n anyTruncated = true;\n }\n if (page.extraction_limited) anyTruncated = true;\n for (const link of page.links.slice(0, MAX_LINKS_PER_PAGE)) {\n const resolved = resolveHref(link.href, base);\n if (!resolved) {\n totalSkipped += 1;\n continue;\n }\n if (resolved.target.origin !== site) {\n stats.external_links += 1;\n totalExternal += 1;\n continue;\n }\n if (resolved.fragmentOnly) {\n stats.fragment_only_links += 1;\n totalFragments += 1;\n continue;\n }\n stats.internal_links += 1;\n totalInternal += 1;\n const self = !resolved.query && resolved.target.pathname === base.pathname;\n if (self) {\n stats.self_links += 1;\n totalSelf += 1;\n }\n if (link.nofollow) {\n stats.nofollow_internal_links += 1;\n totalNofollow += 1;\n }\n if (!link.accessible || !link.label.trim()) {\n stats.missing_anchor_labels += 1;\n totalMissing += 1;\n } else if (generic(link.label)) {\n stats.generic_anchor_links += 1;\n totalGeneric += 1;\n }\n const targetIndex = resolved.query ? undefined : pathIndex.get(resolved.target.pathname);\n if (targetIndex === undefined) {\n stats.unmatched_internal_links += 1;\n totalUnmatched += 1;\n continue;\n }\n if (!self) {\n linkedHere.add(targetIndex);\n linked.add(targetIndex);\n }\n if (!link.accessible || !link.label.trim()) continue;\n const normalized = normalizeWords(link.label).join(\" \");\n // Non-empty reusable anchors to multiple distinct targets can be\n // ambiguous without surrounding context; this is only a review lead.\n if (normalized) {\n const targets = labelsToTargets.get(normalized) ?? new Set<string>();\n targets.add(resolved.target.pathname);\n labelsToTargets.set(normalized, targets);\n }\n const anchorWords = keyWords(link.label);\n const destinationWords = targetWords[targetIndex];\n // Small one-word link labels and unknown targets cannot be meaningfully\n // scored; zero overlap here is not proof of topical irrelevance.\n if (!self && !generic(link.label) && anchorWords.size >= 2 &&\n destinationWords.size >= 2 &&\n ![...anchorWords].some((term) => destinationWords.has(term))) {\n lowHere += 1;\n lowOverlap += 1;\n }\n }\n stats.linked_sample_pages = linkedHere.size;\n if (stats.missing_anchor_labels) report(\"accessible_anchor_missing\", \"warning\", source_page,\n stats.missing_anchor_labels, \"Some same-origin main-content links have no observed accessible name; review labels, image alternatives and nearby context.\", \"observed\");\n if (stats.generic_anchor_links) report(\"generic_anchor_text\", \"info\", source_page,\n stats.generic_anchor_links, \"One or more contextual links use a generic English-only label such as 'read more'; review their accessible names in context.\");\n const ambiguousGroups = [...labelsToTargets.values()].filter((values) => values.size >= 2).length;\n ambiguous += ambiguousGroups;\n if (ambiguousGroups) report(\"repeated_anchor_multiple_targets\", \"info\", source_page,\n ambiguousGroups, \"The same normalized anchor label points to several different supplied targets; confirm that destination differences are clear to readers.\");\n if (lowHere) report(\"anchor_target_heading_low_overlap\", \"info\", source_page,\n lowHere, \"Some descriptive anchor labels share no exact content tokens with the sampled target title or first main heading; synonym and semantic relevance were not assessed.\");\n if (stats.nofollow_internal_links) report(\"nofollow_contextual_internal\", \"info\", source_page,\n stats.nofollow_internal_links, \"One or more same-origin contextual links declare rel=nofollow; confirm this is intentional.\", \"observed\");\n if (page.main_present && stats.internal_links === 0) {\n report(\"no_contextual_internal_links\", \"info\", source_page, 1,\n \"No same-origin contextual links were observed in this page's main content; navigation links were intentionally excluded.\");\n } else if (page.main_present && stats.internal_links > 0 && linkedHere.size === 0 &&\n observations.length > 1 && stats.unmatched_internal_links > 0) {\n report(\"no_sampled_contextual_internal_links\", \"info\", source_page, 1,\n \"This page's observed internal main links do not reach another supplied page; unknown targets were not crawled or judged broken.\");\n }\n if (stats.unmatched_internal_links) report(\"sampled_target_unobserved\", \"info\", source_page,\n stats.unmatched_internal_links, \"Some same-origin link targets are outside this supplied page set or use query variants; their status and relevance remain unverified.\");\n if (!page.main_present) report(\"page_main_missing\", \"info\", source_page, 1,\n \"No explicit main/article region was found; body fallback may include extra site chrome.\");\n if (page.extraction_limited) report(\"link_sample_truncated\", \"info\", source_page, 1,\n \"This page reached a bounded extraction cap; further links were not inspected.\");\n reports.push(stats);\n }\n const priority = { warning: 0, info: 1 };\n findings.sort((a, b) => priority[a.severity] - priority[b.severity] ||\n a.source_page - b.source_page || a.code.localeCompare(b.code));\n return {\n scope: \"caller_supplied_same_origin_html_only\",\n pages_sampled: observations.length,\n pages_eligible: observations.length,\n origin: site,\n internal_links_observed: totalInternal, external_links_observed: totalExternal,\n excluded_navigation_links: totalExcluded, linked_sample_targets: linked.size,\n unmatched_internal_links: totalUnmatched,\n missing_anchor_labels: totalMissing, generic_anchor_links: totalGeneric,\n low_heading_overlap_links: lowOverlap,\n ambiguous_anchor_target_groups: ambiguous,\n nofollow_internal_links: totalNofollow,\n self_links: totalSelf, fragment_only_links: totalFragments,\n skipped_non_http_links: totalSkipped,\n pages: reports,\n coverage_limited: true,\n limitations: [\n \"Only caller-supplied same-origin static HTML and main-content links are compared. Unknown links are not fetched, verified, ranked or assumed broken.\",\n \"Anchor quality uses visible/accessibility labels, exact English generic phrases and lexical title/H1 overlap only; this is not semantic relevance, PageRank, or Google search guidance.\",\n \"Navigation/header/footer/hidden links are excluded; links to unsupplied targets, redirects, rel canonical, dynamic JavaScript and query-variant target content remain unverified.\",\n ...(anyTruncated ? [\"At least one HTML/link extraction cap was reached, so some main-content links may be missing.\"] : []),\n ],\n total_findings: findings.length,\n findings: findings.slice(0, MAX_LINK_FINDINGS),\n findings_truncated: findings.length > MAX_LINK_FINDINGS,\n };\n}\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P1-02: bounded hreflang and canonical cluster verification.
|
|
3
|
+
*
|
|
4
|
+
* Pure local/Worker logic over explicitly supplied static HTML observations.
|
|
5
|
+
* Never fetch a referenced URL, infer Google's canonical choice, or echo
|
|
6
|
+
* credentialed/query-bearing links.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MAX_MULTILINGUAL_PAGES = 16;
|
|
9
|
+
export declare const MAX_HREFLANG_LOCALES = 16;
|
|
10
|
+
export declare const MAX_HREFLANG_DECLARATIONS_SCANNED = 64;
|
|
11
|
+
export declare const MAX_MULTILINGUAL_FINDINGS = 12;
|
|
12
|
+
export declare const MAX_MULTILINGUAL_HTML_CHARS = 250000;
|
|
13
|
+
export interface MultilingualReference {
|
|
14
|
+
locale: string;
|
|
15
|
+
url: string;
|
|
16
|
+
}
|
|
17
|
+
export interface MultilingualHtmlLink {
|
|
18
|
+
rel?: string;
|
|
19
|
+
href?: string;
|
|
20
|
+
hreflang?: string;
|
|
21
|
+
hasMedia?: boolean;
|
|
22
|
+
hasType?: boolean;
|
|
23
|
+
hasLang?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ParsedMultilingualHtml {
|
|
26
|
+
rawUrl: string;
|
|
27
|
+
htmlLength: number;
|
|
28
|
+
rawLanguage?: string;
|
|
29
|
+
links: MultilingualHtmlLink[];
|
|
30
|
+
}
|
|
31
|
+
export type MultilingualCanonicalState = "missing" | "usable" | "ambiguous" | "unverifiable";
|
|
32
|
+
export interface MultilingualPageObservation {
|
|
33
|
+
url: string;
|
|
34
|
+
language?: string;
|
|
35
|
+
canonical_state: MultilingualCanonicalState;
|
|
36
|
+
canonical_url?: string;
|
|
37
|
+
references: MultilingualReference[];
|
|
38
|
+
invalid_declarations: number;
|
|
39
|
+
repeated_locales: number;
|
|
40
|
+
conflicting_locales: number;
|
|
41
|
+
declarations_truncated: boolean;
|
|
42
|
+
skipped: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface MultilingualFinding {
|
|
45
|
+
code: string;
|
|
46
|
+
severity: "error" | "warning";
|
|
47
|
+
confidence: "observed" | "potential";
|
|
48
|
+
message: string;
|
|
49
|
+
example_urls: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface MultilingualClusterAnalysis {
|
|
52
|
+
scope: "sampled_pages_only";
|
|
53
|
+
sampled_pages: number;
|
|
54
|
+
eligible_pages: number;
|
|
55
|
+
pages_with_alternates: number;
|
|
56
|
+
locales_observed: number;
|
|
57
|
+
unobserved_targets: number;
|
|
58
|
+
invalid_declarations: number;
|
|
59
|
+
coverage_limited: boolean;
|
|
60
|
+
limitations: string[];
|
|
61
|
+
total_findings: number;
|
|
62
|
+
findings: MultilingualFinding[];
|
|
63
|
+
findings_truncated: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** Deliberately require absolute, query-free references rather than masking changes in targets. */
|
|
66
|
+
export declare function safeMultilingualUrl(raw: string): string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Accept Google's documented HTML hreflang forms: ISO 639-1 language, optional
|
|
69
|
+
* ISO 15924 script, optional ISO 3166-1 alpha-2 region, and x-default.
|
|
70
|
+
* ICU validates code membership; explicitly reject reserved pseudo-regions.
|
|
71
|
+
*/
|
|
72
|
+
export declare function normalizeHreflangLocale(raw: string): string | undefined;
|
|
73
|
+
/** Pure, runtime-independent validation of head-only HTML observations. */
|
|
74
|
+
export declare function analyzeMultilingualHtmlSignals({ rawUrl, htmlLength, rawLanguage, links, }: ParsedMultilingualHtml): MultilingualPageObservation;
|
|
75
|
+
/**
|
|
76
|
+
* Check at most 16 supplied pages. Missing unsampled targets are unknown,
|
|
77
|
+
* not broken; the sample can include HTML from multiple authorized origins.
|
|
78
|
+
*/
|
|
79
|
+
export declare function analyzeMultilingualClusters(observations: readonly MultilingualPageObservation[], options?: {
|
|
80
|
+
sampledPages?: number;
|
|
81
|
+
coverageLimited?: boolean;
|
|
82
|
+
}): MultilingualClusterAnalysis;
|