diff --git a/scripts/page-404.test.mjs b/scripts/page-404.test.mjs index dd0dedd..de60395 100644 --- a/scripts/page-404.test.mjs +++ b/scripts/page-404.test.mjs @@ -17,10 +17,10 @@ import assert from "node:assert/strict"; import { readFileSync, readdirSync, statSync, existsSync } from "node:fs"; import { dirname, join, relative } from "node:path"; import { fileURLToPath } from "node:url"; +import { SKIP_DIRS } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); function attrs(tag) { const out = {}; diff --git a/scripts/page-csp.test.mjs b/scripts/page-csp.test.mjs index 0fc13fa..9acf85f 100644 --- a/scripts/page-csp.test.mjs +++ b/scripts/page-csp.test.mjs @@ -17,7 +17,6 @@ import { htmlFiles } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); // Script types the browser never executes; CSP script-src does not apply. const DATA_SCRIPT_TYPES = new Set(["application/ld+json", "application/json", "importmap"]); diff --git a/scripts/page-images.test.mjs b/scripts/page-images.test.mjs index 244d487..76dc630 100644 --- a/scripts/page-images.test.mjs +++ b/scripts/page-images.test.mjs @@ -20,7 +20,6 @@ import { htmlFiles, isRedirectPage, lineOf } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); const ASSET_DIR = join(ROOT, "assets"); const IMAGE_EXT_RE = /\.(?:png|jpe?g|gif|webp|svg|ico)$/i; // Declared width/height may be rounded from a non-integer intrinsic ratio diff --git a/scripts/page-markup.test.mjs b/scripts/page-markup.test.mjs index 9b73f5f..de038ee 100644 --- a/scripts/page-markup.test.mjs +++ b/scripts/page-markup.test.mjs @@ -15,7 +15,6 @@ import { htmlFiles, isRedirectPage, lineOf } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); // Attributes whose value is one or more whitespace-separated id references. const IDREF_ATTRS = ["aria-controls", "aria-labelledby", "aria-describedby", "aria-owns", "aria-activedescendant", "for"]; diff --git a/scripts/page-meta.test.mjs b/scripts/page-meta.test.mjs index 504f56c..d370b8d 100755 --- a/scripts/page-meta.test.mjs +++ b/scripts/page-meta.test.mjs @@ -10,12 +10,11 @@ import assert from "node:assert/strict"; import { readFileSync, readdirSync, statSync, existsSync } from "node:fs"; import { dirname, join, relative, resolve, sep } from "node:path"; import { fileURLToPath } from "node:url"; -import { isRedirectPage } from "./html-pages.mjs"; +import { isRedirectPage, SKIP_DIRS } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); const SITE_ORIGIN = "https://hivecommons.dev"; -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); function htmlFiles(dir = ROOT) { const out = []; diff --git a/scripts/page-scripts.test.mjs b/scripts/page-scripts.test.mjs index ead16e8..7db13d7 100644 --- a/scripts/page-scripts.test.mjs +++ b/scripts/page-scripts.test.mjs @@ -10,12 +10,11 @@ import { readFileSync, readdirSync, statSync, existsSync } from "node:fs"; import { dirname, join, relative } from "node:path"; import { fileURLToPath } from "node:url"; import vm from "node:vm"; -import { htmlFiles, isRedirectPage } from "./html-pages.mjs"; +import { htmlFiles, isRedirectPage, SKIP_DIRS } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); const SITE_ORIGIN = "https://hivecommons.dev"; -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); const SCRIPT_RE = /]*)>([\s\S]*?)<\/script>/gi; diff --git a/scripts/page-structure.test.mjs b/scripts/page-structure.test.mjs index b439fed..df3430d 100755 --- a/scripts/page-structure.test.mjs +++ b/scripts/page-structure.test.mjs @@ -21,7 +21,6 @@ import { htmlFiles, isRedirectPage, lineOf } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); // https://html.spec.whatwg.org/#void-elements const VOID = new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]); diff --git a/scripts/redirect-targets.test.mjs b/scripts/redirect-targets.test.mjs index 4032149..7c64f2e 100644 --- a/scripts/redirect-targets.test.mjs +++ b/scripts/redirect-targets.test.mjs @@ -39,11 +39,11 @@ import { spawnSync } from "node:child_process"; import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; +import { SKIP_DIRS } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); const GENERATOR = join(ROOT, "make-redirects.sh"); -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); // The HTML Standard's named character references that browsers resolve even // without a trailing ";" (the Latin-1 set plus AMP/COPY/GT/LT/QUOT/REG). diff --git a/scripts/style-contract.test.mjs b/scripts/style-contract.test.mjs index 2d6f254..be6a9c9 100644 --- a/scripts/style-contract.test.mjs +++ b/scripts/style-contract.test.mjs @@ -20,7 +20,6 @@ import { htmlFiles, isRedirectPage, lineOf } from "./html-pages.mjs"; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, ".."); -const SKIP_DIRS = new Set([".git", ".github", "node_modules", "scripts", ".linkcheck-work"]); // Replace every non-newline character so line numbers survive. function blank(s) {