seo 0.17.4 → 0.17.6

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/dist/index.d.ts CHANGED
@@ -19024,7 +19024,7 @@ declare const QUERY_FLAG_METHOD: {
19024
19024
  readonly heuristic: true;
19025
19025
  readonly ranking: "flagged_rows_after_unflagged_rows";
19026
19026
  readonly flags: {
19027
- readonly 'likely-automated': "Snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.";
19027
+ readonly 'likely-automated': "A numbered prefix such as \"12264: \", snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.";
19028
19028
  readonly 'navigational-other': "Names a domain that is not the property's host, ends with a spoken domain suffix or a login/site/app word, starts with a large platform name and adds no topic word, or is one short ASCII word that is not a brand term. Such queries usually look for another site.";
19029
19029
  };
19030
19030
  };
@@ -19179,7 +19179,7 @@ export declare function ctrUnderperformersReportWith(input: CtrUnderperformersIn
19179
19179
  readonly heuristic: true;
19180
19180
  readonly ranking: "flagged_rows_after_unflagged_rows";
19181
19181
  readonly flags: {
19182
- readonly 'likely-automated': "Snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.";
19182
+ readonly 'likely-automated': "A numbered prefix such as \"12264: \", snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.";
19183
19183
  readonly 'navigational-other': "Names a domain that is not the property's host, ends with a spoken domain suffix or a login/site/app word, starts with a large platform name and adds no topic word, or is one short ASCII word that is not a brand term. Such queries usually look for another site.";
19184
19184
  };
19185
19185
  };
@@ -20210,6 +20210,7 @@ type StrikingDistanceSelection = {
20210
20210
  belowMinimumRows: number;
20211
20211
  lowActionabilityRows: number;
20212
20212
  brandRows: number;
20213
+ sitelinkRows: number;
20213
20214
  eligibleRows: number;
20214
20215
  likelyAutomatedRows: number;
20215
20216
  navigationalOtherRows: number;
@@ -20290,7 +20291,7 @@ type StrikingDistanceAnalysis = {
20290
20291
  };
20291
20292
  provenance: {
20292
20293
  inputScope: 'provided_rows';
20293
- selectionOrder: readonly ['fragment_and_duplicate_merge', 'valid_row', 'position', 'minimum_impressions', 'query_quality', 'brand', 'query_flag_ranking'];
20294
+ selectionOrder: readonly ['fragment_and_duplicate_merge', 'valid_row', 'position', 'minimum_impressions', 'query_quality', 'brand', 'sitelinks', 'query_flag_ranking'];
20294
20295
  selection: StrikingDistanceSelection;
20295
20296
  };
20296
20297
  summary: {
package/dist/index.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 version, t as load } from "./esm-LhrUicGJ.js";
2
+ import { n as version, t as load } from "./esm-D7vj4X6E.js";
3
3
  import { SEO_PROVIDER_API_VERSION } from "./provider-sdk.js";
4
4
  import crypto$1, { createHash, randomUUID, sign } from "node:crypto";
5
5
  import { z } from "zod";
@@ -10649,7 +10649,7 @@ const QUERY_FLAG_METHOD = {
10649
10649
  heuristic: true,
10650
10650
  ranking: "flagged_rows_after_unflagged_rows",
10651
10651
  flags: {
10652
- "likely-automated": "Snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.",
10652
+ "likely-automated": "A numbered prefix such as \"12264: \", snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.",
10653
10653
  "navigational-other": "Names a domain that is not the property's host, ends with a spoken domain suffix or a login/site/app word, starts with a large platform name and adds no topic word, or is one short ASCII word that is not a brand term. Such queries usually look for another site."
10654
10654
  }
10655
10655
  };
@@ -10713,8 +10713,10 @@ const FUNCTION_WORDS$1 = /* @__PURE__ */ new Set([
10713
10713
  "und"
10714
10714
  ]);
10715
10715
  const IDENTIFIER_TOKEN = /[\p{L}\p{N}]_[\p{L}\p{N}]/u;
10716
+ const NUMBERED_PREFIX = /^\d{4,}:\s+\S/u;
10716
10717
  /** Heuristic: the query looks machine-generated rather than typed by a person. */
10717
10718
  function isLikelyAutomatedQuery(query) {
10719
+ if (NUMBERED_PREFIX.test(query.trim())) return true;
10718
10720
  if (query.trim().split(/\s+/).filter(Boolean).some((token) => IDENTIFIER_TOKEN.test(token))) return true;
10719
10721
  const tokens = tokenize(query);
10720
10722
  if (tokens.length >= 20) return true;
@@ -23362,6 +23364,7 @@ function selectRows(input) {
23362
23364
  belowMinimumRows: 0,
23363
23365
  lowActionabilityRows: 0,
23364
23366
  brandRows: 0,
23367
+ sitelinkRows: 0,
23365
23368
  eligibleRows: 0,
23366
23369
  likelyAutomatedRows: 0,
23367
23370
  navigationalOtherRows: 0,
@@ -23382,16 +23385,23 @@ function selectRows(input) {
23382
23385
  brandTerms: input.brandTerms,
23383
23386
  includeBrand: input.includeBrand
23384
23387
  })) selection.brandRows++;
23385
- else {
23386
- rows.push(row);
23387
- selection.eligibleRows++;
23388
- }
23388
+ else rows.push(row);
23389
23389
  }
23390
+ const kept = withoutSitelinkRows(rows);
23391
+ selection.sitelinkRows = rows.length - kept.length;
23392
+ selection.eligibleRows = kept.length;
23390
23393
  return {
23391
- rows,
23394
+ rows: kept,
23392
23395
  selection
23393
23396
  };
23394
23397
  }
23398
+ const SITELINK_MINIMUM_PAGES = 3;
23399
+ function withoutSitelinkRows(rows) {
23400
+ const counts = /* @__PURE__ */ new Map();
23401
+ const key = (row) => `${row.keys[0]?.trim()}\n${row.impressions}\n${row.position}`;
23402
+ for (const row of rows) counts.set(key(row), (counts.get(key(row)) ?? 0) + 1);
23403
+ return rows.filter((row) => (counts.get(key(row)) ?? 0) < SITELINK_MINIMUM_PAGES);
23404
+ }
23395
23405
  function analyzeStrikingDistanceRows(input) {
23396
23406
  const collapsed = collapseFragmentPageRows(input.rows, { pageKeyIndex: 1 });
23397
23407
  const minImpressionsPolicy = resolveMinImpressionsPolicy({
@@ -23466,6 +23476,7 @@ function analyzeStrikingDistanceRows(input) {
23466
23476
  "minimum_impressions",
23467
23477
  "query_quality",
23468
23478
  "brand",
23479
+ "sitelinks",
23469
23480
  "query_flag_ranking"
23470
23481
  ],
23471
23482
  selection: selected.selection
@@ -23629,6 +23640,7 @@ async function strikingDistanceWith(input, dependencies) {
23629
23640
  `Brand queries: ${analysis.brand.filtering}. Brand terms used: ${analysis.brand.terms.join(", ") || "none"} (${analysis.brand.source === "provided" ? "provided" : "host forms, plus the bare domain stem only when Search Console shows the site is its navigational answer"}).`,
23630
23641
  analysis.selection.fragmentRows ? `${countLabel(analysis.selection.fragmentRows, "source row")} with a #fragment URL merged into the base URL.` : "",
23631
23642
  analysis.selection.flaggedRows ? `${countLabel(analysis.selection.flaggedRows, "eligible row")} carry heuristic query flags (likely-automated or navigational-other) and rank after unflagged rows.` : "",
23643
+ analysis.selection.sitelinkRows ? `${countLabel(analysis.selection.sitelinkRows, "row")} left out as sitelinks: three or more pages for the same query with the same impressions and average position, which is one result shown with its sitelinks. A heuristic.` : "",
23632
23644
  "Position is GSC average position for the property's topmost result per impression; it does not prove a URL ranked on a literal second results page every time.",
23633
23645
  "Search Analytics exposes retained query rows only. Anonymized and lower-value queries can be absent even when pagination is exhausted.",
23634
23646
  "Priority is a demand-and-position heuristic, not an estimated click lift or proof that a change will improve rankings.",
@@ -32448,6 +32460,10 @@ const PARALLEL = [
32448
32460
  kind: "split",
32449
32461
  re: new RegExp(`${NEG}\\s+(?:${MINIMIZER}\\s+)?${BODY}[.!]\\s+${RESTATE}`, "gi")
32450
32462
  },
32463
+ {
32464
+ kind: "repeated",
32465
+ re: new RegExp(`(?<=^|[.!?]\\s+)(The\\s+(?:[\\w-]+\\s+){0,2}?[\\w-]+)\\s+(?:is|are|was|were)(?:n't|\\s+not)\\s+${BODY}[.!]\\s+\\1\\s+(?:is|are|was|were)\\b`, "gi")
32466
+ },
32451
32467
  {
32452
32468
  kind: "joined",
32453
32469
  re: new RegExp(`${NEG}\\s+${BODY}${JOIN}${RESTATE}`, "gi")
@@ -32472,14 +32488,14 @@ function negativeParallelism(ctx) {
32472
32488
  const pronoun = /^(?:but |and |so )?(?:it|this|that|they)?$/i.test(subject.replace(/(?:'s|'re)$/, ""));
32473
32489
  const firstWords = words$2(block.norm.slice(sentence.start, end)).length;
32474
32490
  let level = "warning";
32475
- if (kind === "reveal" || kind === "about") level = "error";
32491
+ if (kind === "reveal" || kind === "about" || kind === "repeated") level = "error";
32476
32492
  else if (FRAMING.test(subject)) level = "error";
32477
32493
  else if (pronoun && (kind === "joined" || firstWords <= 10)) level = "error";
32478
32494
  const after = sentenceAt(sentences, end - 1);
32479
32495
  const restate = /(?:it|this|that|they)(?:'s|'re|\s+(?:is|are|was|were))$/i.exec(found[0]);
32480
32496
  const from = restate ? end - restate[0].length : end;
32481
32497
  const second = block.text.slice(from, after.end).trim();
32482
- const fix = second ? `Drop the "isn't" half and state the claim: "${second.charAt(0).toUpperCase()}${second.slice(1)}"` : "Drop the \"isn't\" half and state the claim once.";
32498
+ const fix = kind === "repeated" ? `Drop the "isn't" sentence and keep the claim: "${block.text.slice(after.start, after.end).trim()}"` : second ? `Drop the "isn't" half and state the claim: "${second.charAt(0).toUpperCase()}${second.slice(1)}"` : "Drop the \"isn't\" half and state the claim once.";
32483
32499
  const concession = (/,\s*but\s+(?:[\w']+\s*){1,3}$/i.test(found[0]) || /^(?:while|although|though|even though)\b/i.test(subject)) && kind !== "reveal";
32484
32500
  if (level === "warning" && firstWords > 12 || concession) {
32485
32501
  ctx.review("contrast", block, sentence.start, Math.max(after.end, end), "Does this \"isn't X ... it's Y\" correct something a reader would really think? If not, state the claim once.");
@@ -32779,7 +32795,7 @@ const RHYTHM_RULES = {
32779
32795
  id: "anaphora",
32780
32796
  family: "ai",
32781
32797
  level: "error",
32782
- description: "Short sentences in a row that start with the same word: two or more \"No ...\" sentences, or three or more starting \"It's\", \"They\", \"We\" or \"You\"."
32798
+ description: "Short sentences in a row that start with the same word: two or more \"No ...\" sentences, or three or more starting \"It's\", \"They\", \"We\" or \"You\". Also a list written as prose: \"The first wall ... The second wall ... The third wall ...\"."
32783
32799
  }
32784
32800
  };
32785
32801
  function heresAnnouncement(ctx) {
@@ -32922,9 +32938,50 @@ function staccato(ctx) {
32922
32938
  report();
32923
32939
  }
32924
32940
  }
32941
+ const ORDINALS = [
32942
+ "first",
32943
+ "second",
32944
+ "third",
32945
+ "fourth",
32946
+ "fifth",
32947
+ "sixth"
32948
+ ];
32949
+ const ORDINAL_OPENER = /^(?:And |But |So )?The (first|second|third|fourth|fifth|sixth) ([a-z][\w-]*)\b/i;
32950
+ function numberedProse(ctx, rule) {
32951
+ let open = null;
32952
+ const report = (item, endBlock, end) => {
32953
+ const count = item.next;
32954
+ ctx.hit(rule, item.block, item.start, item.block === endBlock ? end : item.block.text.length, `${count} sentences open "The first ${item.noun}", "The second ${item.noun}" and so on: a list written as prose.`, "Write it as a list, or as plain prose that names each point without numbering it.", "warning");
32955
+ };
32956
+ let last = null;
32957
+ for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
32958
+ const found = ORDINAL_OPENER.exec(sentence.text);
32959
+ if (!found) continue;
32960
+ const ordinal = ORDINALS.indexOf((found[1] ?? "").toLowerCase());
32961
+ const noun = (found[2] ?? "").toLowerCase();
32962
+ if (ordinal === 0) {
32963
+ if (open && open.next >= 3 && last) report(open, last.block, last.end);
32964
+ open = {
32965
+ block,
32966
+ start: sentence.start,
32967
+ next: 1,
32968
+ noun
32969
+ };
32970
+ last = null;
32971
+ } else if (open && ordinal === open.next && noun === open.noun) {
32972
+ open.next++;
32973
+ last = {
32974
+ block,
32975
+ end: sentence.end
32976
+ };
32977
+ }
32978
+ }
32979
+ if (open && open.next >= 3 && last) report(open, last.block, last.end);
32980
+ }
32925
32981
  function anaphora(ctx) {
32926
32982
  const rule = RHYTHM_RULES.anaphora;
32927
32983
  if (ctx.level(rule) === "off") return;
32984
+ numberedProse(ctx, rule);
32928
32985
  for (const block of ctx.blocks(RHYTHM_KINDS)) {
32929
32986
  const sentences = ctx.sentences(block);
32930
32987
  let i = 0;