@piercebarney/whs-eleventy 2026.9.23 → 2026.9.25

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.
@@ -135,7 +135,7 @@ function outputHas(urlPath) {
135
135
  return fs.existsSync(asFile + "/index.html") || fs.existsSync(asFile + ".html");
136
136
  }
137
137
 
138
- function checkRef(file, pageUrl, raw, { external = true, isHyperlink = false } = {}) {
138
+ function checkRef(file, pageUrl, resolveBase, raw, { external = true, isHyperlink = false } = {}) {
139
139
  if (!raw) return;
140
140
  const v = raw.trim();
141
141
  if (v === "" || v.startsWith("data:") || v.startsWith("mailto:") || v.startsWith("tel:")) return;
@@ -185,13 +185,15 @@ function checkRef(file, pageUrl, raw, { external = true, isHyperlink = false } =
185
185
  return;
186
186
  }
187
187
  // relative path — resolve against the page dir
188
- const resolved = path.posix.join(pageUrl, v);
188
+ const resolved = path.posix.join(resolveBase, v);
189
189
  if (!outputHas(resolved)) err(file, `relative reference does not resolve: ${v}`);
190
190
  }
191
191
 
192
192
  for (const f of htmlFiles) {
193
193
  const rel = "/" + path.relative(SITE, f).replace(/\\/g, "/");
194
194
  const pageUrl = rel.replace(/index\.html$/, "");
195
+ const dir = path.posix.dirname(rel);
196
+ const resolveBase = dir === "/" ? "/" : dir + "/";
195
197
  const root = parse(fs.readFileSync(f, "utf8"));
196
198
 
197
199
  // CSP-safety: the strict CSP (script-src 'self'; style-src 'self') rejects
@@ -216,7 +218,7 @@ for (const f of htmlFiles) {
216
218
 
217
219
  root.querySelectorAll("a[href]").forEach((a) => {
218
220
  const href = a.getAttribute("href");
219
- checkRef(f, pageUrl, href, { isHyperlink: true });
221
+ checkRef(f, pageUrl, resolveBase, href, { isHyperlink: true });
220
222
  if (/^https?:\/\//i.test(href || "")) {
221
223
  let origin;
222
224
  try {
@@ -233,12 +235,18 @@ for (const f of htmlFiles) {
233
235
  }
234
236
  });
235
237
 
236
- root.querySelectorAll("link[href]").forEach((l) => checkRef(f, pageUrl, l.getAttribute("href")));
237
- root.querySelectorAll("script[src]").forEach((s) => checkRef(f, pageUrl, s.getAttribute("src")));
238
- root.querySelectorAll("img[src]").forEach((i) => checkRef(f, pageUrl, i.getAttribute("src")));
238
+ root
239
+ .querySelectorAll("link[href]")
240
+ .forEach((l) => checkRef(f, pageUrl, resolveBase, l.getAttribute("href")));
241
+ root
242
+ .querySelectorAll("script[src]")
243
+ .forEach((s) => checkRef(f, pageUrl, resolveBase, s.getAttribute("src")));
244
+ root
245
+ .querySelectorAll("img[src]")
246
+ .forEach((i) => checkRef(f, pageUrl, resolveBase, i.getAttribute("src")));
239
247
  root
240
248
  .querySelectorAll('meta[property="og:image"], meta[name="twitter:image"]')
241
- .forEach((m) => checkRef(f, pageUrl, m.getAttribute("content")));
249
+ .forEach((m) => checkRef(f, pageUrl, resolveBase, m.getAttribute("content")));
242
250
 
243
251
  root.querySelectorAll('script[type="application/ld+json"]').forEach((s, i) => {
244
252
  let data;
package/lib/compliance.js CHANGED
@@ -367,11 +367,19 @@ const CHECKS = {
367
367
  for (const rel of existing) {
368
368
  const t = read(rel);
369
369
  if (!t) continue;
370
+ let inFontFace = false;
371
+ let depth = 0;
370
372
  for (const line of t.split("\n")) {
371
373
  if (/^\s*(\/\/|\/\*|\*|#|<!--)/.test(line)) continue;
374
+ if (!inFontFace && /@font-face\b/.test(line)) inFontFace = true;
375
+ if (inFontFace) {
376
+ depth += (line.match(/\{/g) || []).length;
377
+ depth -= (line.match(/\}/g) || []).length;
378
+ if (depth <= 0 && /\}/.test(line)) inFontFace = false;
379
+ }
372
380
  if (/#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?\b/.test(line) && !/\{\{/.test(line))
373
381
  bad.push(`${rel} (hex)`);
374
- else if (/font-family\s*:/.test(line) && !/var\(--brand/.test(line))
382
+ else if (!inFontFace && /font-family\s*:/.test(line) && !/var\(--brand/.test(line))
375
383
  bad.push(`${rel} (font-family)`);
376
384
  }
377
385
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piercebarney/whs-eleventy",
3
- "version": "2026.9.23",
3
+ "version": "2026.9.25",
4
4
  "description": "The web house style's Eleventy + Netlify tooling — the compliance sweep, the infra doctor, the link/CSP integrity check, and the a11y scan, shared by every project on the stack.",
5
5
  "bin": {
6
6
  "whs": "cli.js"
@@ -21,6 +21,61 @@ enforced, new *opt-in* chapters/capabilities, tooling-only changes — is
21
21
 
22
22
  ---
23
23
 
24
+ ## 2026-09-25 [non-breaking]
25
+
26
+ ### packages/whs-eleventy
27
+
28
+ `brand-source`'s font check flagged the `font-family:` declaration required
29
+ inside a self-hosted `@font-face { ... }` block — even though that
30
+ declaration is structurally different from every other `font-family` use
31
+ the check exists to catch. Elsewhere, `font-family: <literal>` is a font
32
+ *choice* that should instead reference `var(--brand-font-*)`; inside
33
+ `@font-face`, `font-family: <literal>` is the *name* the block is defining,
34
+ and CSS gives no way to write it as a custom-property reference — `var()`
35
+ isn't available to `@font-face` descriptors at all, so there's no
36
+ compliant rewrite, only a structurally forced literal. The fix tracks
37
+ brace depth after an `@font-face` line and skips the `font-family`
38
+ sub-check only within that block; the hex-literal check and `font-family`
39
+ checks anywhere else in the file are unchanged. Found while
40
+ covenant-in-color self-hosted a font for real and filed as
41
+ `feedback/2026-09-23-brand-source-font-face-false-positive.md`; fixed in
42
+ `1ab3feb`.
43
+
44
+ This is the fifth `packages/whs-eleventy`-only fix shipped this week (the
45
+ fourth, 2026.9.24, already published and live) — `core.md`, `stacks/*.md`,
46
+ and `index.json` content are unchanged; only the doc pins and
47
+ `packages/whs-eleventy/package.json` (now `2026.9.25`) moved.
48
+
49
+ ---
50
+
51
+ ## 2026-09-24 [non-breaking]
52
+
53
+ ### packages/whs-eleventy
54
+
55
+ `check-links.js` resolved a relative reference (`favicon.svg`, `styles.css`,
56
+ etc.) against `pageUrl`, a literal `index.html`-stripped path — correct for
57
+ directory-style permalinks (`/foo/index.html` → `/foo/`) but wrong for a
58
+ flat, non-directory permalink like `privacy.html`, where `pageUrl` stayed
59
+ `/privacy.html` and `path.posix.join` then treated it as if it were a
60
+ directory, producing false `relative reference does not resolve` findings
61
+ for files that genuinely exist and resolve correctly in a real browser.
62
+ `pageUrl` is also used for same-page `#anchor` lookups, where the literal
63
+ value is exactly what's needed — so the fix doesn't touch `pageUrl` itself.
64
+ Instead `checkRef()` now takes a separate `resolveBase` (the directory
65
+ containing the page, via `path.posix.dirname`) used only for relative-
66
+ reference resolution, leaving anchor lookups untouched. Found while
67
+ covenant-in-color's adoption session ran the newly-fixed `npm run links` for
68
+ the first time and filed as
69
+ `feedback/2026-09-23-check-links-relative-resolution-non-directory-permalink.md`;
70
+ fixed in `7edbc68`.
71
+
72
+ This is the fourth `packages/whs-eleventy`-only fix shipped this week (the
73
+ third, 2026.9.23, already published and live) — `core.md`, `stacks/*.md`,
74
+ and `index.json` content are unchanged; only the doc pins and
75
+ `packages/whs-eleventy/package.json` (now `2026.9.24`) moved.
76
+
77
+ ---
78
+
24
79
  ## 2026-09-23 — Republish 2026-09-22-2 as a clean bare-date version [non-breaking]
25
80
 
26
81
  ### packages/whs-eleventy
package/standard/core.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Web project house style — CORE (stack-agnostic)
2
2
 
3
- **Version:** 2026-09-23 · **Status:** active
3
+ **Version:** 2026-09-25 · **Status:** active
4
4
 
5
5
  This is the stack-agnostic contract every web project follows, regardless of
6
6
  framework, host, or CSS system. It says **what** must be true, with concrete
@@ -1467,7 +1467,7 @@ governs it and follow that chapter — the slugs are the index (a `<script>` →
1467
1467
  - production-url: https://example.com
1468
1468
  - content-type: tool # tool | article (article => feeds)
1469
1469
  - publishing-rate: ~5 pages/week
1470
- - standard-version: 2026-09-23 # recommended — enables standard-version drift tracking (#compliance)
1470
+ - standard-version: 2026-09-25 # recommended — enables standard-version drift tracking (#compliance)
1471
1471
  ```
1472
1472
 
1473
1473
  If the section is absent, the assistant's first action is to run the flow above