pagegraph 0.10.0 → 0.10.1

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/audit.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as extractAnchors, r as extractPageContent, t as checkPageContent } from "./content-DbyJoRpj.js";
1
+ import { l as extractAnchors, r as extractPageContent, t as checkPageContent } from "./content-BE9KCTgb.js";
2
2
  import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import * as Context from "effect/Context";
package/dist/cli.js CHANGED
@@ -35710,7 +35710,7 @@ const runWith = (command, config) => {
35710
35710
  };
35711
35711
  //#endregion
35712
35712
  //#region package.json
35713
- var version = "0.10.0";
35713
+ var version = "0.10.1";
35714
35714
  //#endregion
35715
35715
  //#region src/core/links.ts
35716
35716
  const TOKEN = /<(\/?)(nav|footer|header)\b[^>]*>|<a\b([^>]*)>([\s\S]*?)<\/a>/gi;
@@ -36808,12 +36808,19 @@ const stringField = (node, field) => {
36808
36808
  const value = node[field];
36809
36809
  return typeof value === "string" && value.trim() !== "" ? value : void 0;
36810
36810
  };
36811
- /** JSON-LD text may carry the HTML Google allows in answers; compare its text. */
36812
- const jsonLdText = (value) => textOf(value);
36813
- const isVisible = (visible, candidate) => {
36814
- const needle = matchText(jsonLdText(candidate));
36811
+ /** Standard HTML element names; other angle-bracket text is not markup. */
36812
+ const HTML_ELEMENT = new RegExp(`</?(?:${"a abbr address article aside audio b bdi bdo blockquote br button caption cite code col colgroup dd del details dfn div dl dt em fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i img ins kbd label legend li main mark nav ol p picture pre q s samp section small span strong sub summary sup table tbody td tfoot th thead time tr u ul var video wbr".split(" ").join("|")})\\b[^>]*>`, "gi");
36813
+ const inPage = (visible, text) => {
36814
+ const needle = matchText(text);
36815
36815
  return needle === "" || ` ${visible} `.includes(` ${needle} `);
36816
36816
  };
36817
+ /**
36818
+ * JSON-LD text may carry the HTML Google allows in answers, or plain text with
36819
+ * angle-bracket placeholders such as `samva-<id>._domainkey`, which the page
36820
+ * renders escaped. Only standard element tags are markup, and a candidate with
36821
+ * no closing tag is also compared literally because `<i>` is ambiguous.
36822
+ */
36823
+ const isVisible = (visible, candidate) => inPage(visible, decodeEntities(candidate.replace(HTML_ELEMENT, " "))) || !/<\//.test(candidate) && inPage(visible, decodeEntities(candidate));
36817
36824
  const clip = (value, max = 80) => value.length > max ? `${value.slice(0, max - 1)}…` : value;
36818
36825
  const STOPWORDS = new Set("a an and are as at be but by can for from get has have how in into is it its more not of on or our per than that the their this to use via vs was what when who why will with you your".split(" "));
36819
36826
  /**