seo 0.2.2 → 0.2.3
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 +1 -1
- package/dist/cli.js +2 -2
- package/dist/{dist-DUfbYI4E.js → dist-BG734YzY.js} +1 -1
- package/dist/{dist-CpTkpH4F.js → dist-BnXs3Jen.js} +60 -60
- package/dist/{dist-CpTkpH4F.js.map → dist-BnXs3Jen.js.map} +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +30 -4
- package/dist/mcp.js.map +1 -1
- package/dist/{package-uOaBUbds.js → package-Jl7x3QBx.js} +2 -2
- package/dist/{package-uOaBUbds.js.map → package-Jl7x3QBx.js.map} +1 -1
- package/package.json +4 -1
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __seoCreateRequire } from 'node:module'; const require = __seoCreateRequire(import.meta.url);
|
|
2
|
-
import { n as load, t as version } from "./package-
|
|
2
|
+
import { n as load, t as version } from "./package-Jl7x3QBx.js";
|
|
3
3
|
import { Headers, fetch as fetch$1 } from "undici";
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -6082,6 +6082,33 @@ function sameDocument(left, right) {
|
|
|
6082
6082
|
function bodyWordCount(value) {
|
|
6083
6083
|
return value.replace(/^---[\s\S]*?---\s*/u, "").replace(/```[\s\S]*?```/gu, " ").replace(/[#>*_`[\]()|:-]/gu, " ").split(/\s+/u).filter(Boolean).length;
|
|
6084
6084
|
}
|
|
6085
|
+
function repeatedProseLines(markdown) {
|
|
6086
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6087
|
+
let inFrontmatter = false;
|
|
6088
|
+
let fence;
|
|
6089
|
+
for (const [index, rawLine] of markdown.split(/\r?\n/u).entries()) {
|
|
6090
|
+
const line = rawLine.trim();
|
|
6091
|
+
if (index === 0 && line === "---") {
|
|
6092
|
+
inFrontmatter = true;
|
|
6093
|
+
continue;
|
|
6094
|
+
}
|
|
6095
|
+
if (inFrontmatter) {
|
|
6096
|
+
if (line === "---") inFrontmatter = false;
|
|
6097
|
+
continue;
|
|
6098
|
+
}
|
|
6099
|
+
if (!fence && (line.startsWith("```") || line.startsWith("~~~"))) {
|
|
6100
|
+
fence = line.startsWith("```") ? "```" : "~~~";
|
|
6101
|
+
continue;
|
|
6102
|
+
}
|
|
6103
|
+
if (fence) {
|
|
6104
|
+
if (line.startsWith(fence)) fence = void 0;
|
|
6105
|
+
continue;
|
|
6106
|
+
}
|
|
6107
|
+
if (line.length < 40 || /^(?:#{1,6}\s|[-+*]\s|\d+[.)]\s|>|\||`|\]\()/u.test(line)) continue;
|
|
6108
|
+
counts.set(line, (counts.get(line) ?? 0) + 1);
|
|
6109
|
+
}
|
|
6110
|
+
return [...counts.values()].reduce((duplicates, count) => duplicates + Math.max(0, count - 1), 0);
|
|
6111
|
+
}
|
|
6085
6112
|
function responseIsNoindex(response, body) {
|
|
6086
6113
|
if ((response.headers.get("x-robots-tag") ?? "").toLowerCase().includes("noindex")) return true;
|
|
6087
6114
|
return [...body.matchAll(/<meta\s+[^>]*>/giu)].some((match) => {
|
|
@@ -6095,7 +6122,6 @@ function markdownQuality(markdown, page) {
|
|
|
6095
6122
|
const introProbe = (page.contentSample?.replace(/\s+/gu, " ").trim())?.split(" ").slice(0, 10).join(" ");
|
|
6096
6123
|
const normalizedMarkdown = markdown.replace(/\s+/gu, " ");
|
|
6097
6124
|
const codeFences = markdown.match(/^```/gmu)?.length ?? 0;
|
|
6098
|
-
const repeatedLines = [...markdown.matchAll(/^(.{12,})$/gmu)].map((match) => match[1]?.trim()).filter((line) => Boolean(line)).filter((line, index, lines) => lines.indexOf(line) !== index).length;
|
|
6099
6125
|
const wordCount = bodyWordCount(markdown);
|
|
6100
6126
|
const sourceWordCount = page.wordCount ?? 0;
|
|
6101
6127
|
return {
|
|
@@ -6110,7 +6136,7 @@ function markdownQuality(markdown, page) {
|
|
|
6110
6136
|
rawScriptTags: markdown.match(/<script\b/giu)?.length ?? 0,
|
|
6111
6137
|
rawStyleTags: markdown.match(/<style\b/giu)?.length ?? 0,
|
|
6112
6138
|
suspiciousConcatenations: markdown.match(/\b[a-z]{4,}[A-Z][A-Za-z]{3,}\b/gu)?.length ?? 0,
|
|
6113
|
-
repeatedLines,
|
|
6139
|
+
repeatedLines: repeatedProseLines(markdown),
|
|
6114
6140
|
sourceWordCount,
|
|
6115
6141
|
wordRetentionRatio: sourceWordCount > 0 ? Math.round(wordCount / sourceWordCount * 1e3) / 1e3 : null,
|
|
6116
6142
|
introductoryCopyRetained: introProbe ? normalizedMarkdown.includes(introProbe) : null,
|
|
@@ -6658,7 +6684,7 @@ function qualityFailureUrls(discovery) {
|
|
|
6658
6684
|
return discovery.markdownAlternates.pages.filter((page) => {
|
|
6659
6685
|
const quality = page.quality;
|
|
6660
6686
|
if (!quality) return true;
|
|
6661
|
-
return !quality.frontmatterTitle || quality.h1Count !== 1 || !quality.codeFenceBalanced || quality.rawHtmlTags > 0 || quality.rawSvgTags > 0 || quality.rawScriptTags > 0 || quality.rawStyleTags > 0 || quality.navigationOnly || quality.repeatedLines > 0 || quality.wordRetentionRatio !== null && quality.wordRetentionRatio < .4
|
|
6687
|
+
return !quality.frontmatterTitle || quality.h1Count !== 1 || !quality.codeFenceBalanced || quality.rawHtmlTags > 0 || quality.rawSvgTags > 0 || quality.rawScriptTags > 0 || quality.rawStyleTags > 0 || quality.navigationOnly || quality.repeatedLines > 0 || quality.wordRetentionRatio !== null && quality.wordRetentionRatio < .4;
|
|
6662
6688
|
}).map((page) => page.htmlUrl);
|
|
6663
6689
|
}
|
|
6664
6690
|
function profileChecks(discovery) {
|