@v-office/site-checks 0.5.2 → 0.5.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/bin.mjs +1 -1
- package/dist/{cli-Xd9RQ91Q.mjs → cli-BZOXjO-z.mjs} +13 -4
- package/dist/index.mjs +1 -1
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/versions/0.5.3/CHANGELOG.md +22 -0
- package/instructions/versions/0.5.3/MIGRATION.md +46 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -247,7 +247,7 @@ unrelated findings, `match` picks one.
|
|
|
247
247
|
| `page-structure` | warning | One `<h1>`, no skipped heading level, a `<main>`, `alt` on every image, a label on every control the keyboard reaches (only `aria-hidden` with `tabindex="-1"` is out of reach), a caption (or `aria-label`/`aria-labelledby`) and scoped `<th>` on every table. | Fix the component where a fault repeats; decline a rule in `structureIgnore`. |
|
|
248
248
|
| `heading-ratio` | warning | Ten or more `<h3>` and more than three times as many as `<h2>` on a page: usually card titles marked up as headings. | Style a `<p>` for a card's name; decline it in `structureIgnore`. |
|
|
249
249
|
| `voffice-credit` | error | A page whose site footer (a `<footer>` outside `main`, `article`, `section`, `aside`, `nav`, `blockquote`, `figure`, `dialog`) has no link to `https://www.v-office.com` (look-alike hosts and `dyn.v-office.com` do not count); a home page (a locale's `de/index.html` too) without a site footer. The wording is not read. | Add `Realisiert mit <a href="https://www.v-office.com">vOffice</a>` to the site footer, worded per language. |
|
|
250
|
-
| `load-order` | warning | At start: an on-demand library (map, chart, 3D) in the start-up code, a start-up chunk over 150 KB compressed, photos after the first in card swipe strips with a URL, a swap face without a `size-adjust` stand-in (preloaded, or apart: not preloaded).
|
|
250
|
+
| `load-order` | warning | At start: an on-demand library (map, chart, 3D) in the start-up code, a start-up chunk over 150 KB compressed, photos after the first in card swipe strips with a URL, a swap face without a `size-adjust` stand-in (preloaded, or apart: not preloaded), a used `font-display: optional` face. Stacks are read from `font-family` and `--font-*`. | `import()` on demand; first slide only; `swap` with a `local()` stand-in. |
|
|
251
251
|
| `first-paint-photos` | error | A first-paint photo (not lazy) or image preload from 100 KB up, a file of the build, in one size only (no width `srcset` / `imagesrcset`); in the `<header>`/`<section>` of the `fetchpriority="high"` photo, a hidden slide (`aria-hidden`, `inert`, `invisible` or `opacity-0`, also at a breakpoint, never a `hover:` state; `hidden` or a closed `<dialog>` when the image is not lazy) whose image carries a URL, an SVG icon aside. | Width variants in a `srcset` with a measured `sizes`; hidden slides get `data-src` and their URL after load. |
|
|
252
252
|
| `banned-copy` | warning | A `bannedCopy` wording (not scoped `"in": "src"`) in a page's visible text. Skipped without configured wordings. | Reword. |
|
|
253
253
|
| `duplicate-sentences` | warning | The same sentence rendered twice on one page. Waits while every page but the 404 page is noindex. | Remove one, or list it in `allowDuplicateSentences`. |
|
package/dist/bin.mjs
CHANGED
|
@@ -1714,7 +1714,11 @@ const hiddenWithin = (img, block) => {
|
|
|
1714
1714
|
* - on a page with two or more card swipe strips, a photo after a strip's first carrying a URL
|
|
1715
1715
|
* (native lazy loading reaches sideways on slow links);
|
|
1716
1716
|
* - a `font-display: swap` face without a `size-adjust` stand-in behind it, which reflows the line
|
|
1717
|
-
* (a preloaded one at first paint; one not preloaded, likely below the fold, named apart)
|
|
1717
|
+
* (a preloaded one at first paint; one not preloaded, likely below the fold, named apart);
|
|
1718
|
+
* - a used `font-display: optional` face, which a first visit keeps out for the whole page view
|
|
1719
|
+
* when it misses the ~100 ms block window (a homepage, where the hero photo competes).
|
|
1720
|
+
* Font stacks are read from `font-family` and from the `--font-*` custom properties Tailwind v4
|
|
1721
|
+
* puts them in (`font-family: var(--font-sans)`).
|
|
1718
1722
|
* A warning: each is a cost, not a fault. The first-paint photo rules are `first-paint-photos`. */
|
|
1719
1723
|
const loadOrder = {
|
|
1720
1724
|
id: "load-order",
|
|
@@ -1745,6 +1749,7 @@ const loadOrder = {
|
|
|
1745
1749
|
const strips = /* @__PURE__ */ new Map();
|
|
1746
1750
|
const faces = /* @__PURE__ */ new Map();
|
|
1747
1751
|
const lateFaces = /* @__PURE__ */ new Map();
|
|
1752
|
+
const optionalFaces = /* @__PURE__ */ new Map();
|
|
1748
1753
|
const startup = (page) => {
|
|
1749
1754
|
const roots = /* @__PURE__ */ new Set();
|
|
1750
1755
|
for (const script of page.document.querySelectorAll("script[type=\"module\"]")) {
|
|
@@ -1813,15 +1818,18 @@ const loadOrder = {
|
|
|
1813
1818
|
return {
|
|
1814
1819
|
family: (/font-family:\s*([^;]+)/.exec(m[1])?.[1] ?? "").trim().replace(/^["']|["']$/g, ""),
|
|
1815
1820
|
swap: /font-display:\s*swap/.test(m[1]),
|
|
1821
|
+
optional: /font-display:\s*optional/.test(m[1]),
|
|
1816
1822
|
file: url && !url.startsWith("data:") ? resolve(url, base) : "",
|
|
1817
1823
|
adjusted: /size-adjust\s*:/.test(m[1])
|
|
1818
1824
|
};
|
|
1819
1825
|
}));
|
|
1820
1826
|
const adjusted = new Set(declared.filter((f) => f.adjusted).map((f) => f.family));
|
|
1821
|
-
const stacks = [...css.replace(/@font-face\s*\{[^}]*\}/g, "").matchAll(/font-family:\s*([^;}]+)/g)].map((m) => m[1].split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")));
|
|
1827
|
+
const stacks = [...css.replace(/@font-face\s*\{[^}]*\}/g, "").matchAll(/(?:font-family|--font-[\w-]+):\s*([^;}]+)/g)].map((m) => m[1].split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")));
|
|
1822
1828
|
const preloaded = new Set([...page.document.querySelectorAll("link[rel=\"preload\"][href]")].map((l) => resolve(l.getAttribute("href"), page.base)));
|
|
1823
|
-
for (const face of declared)
|
|
1824
|
-
|
|
1829
|
+
for (const face of declared) {
|
|
1830
|
+
const users = stacks.filter((stack) => stack[0] === face.family);
|
|
1831
|
+
if (face.optional && users.length > 0) add(optionalFaces, face.family, page.path);
|
|
1832
|
+
if (face.swap && !face.adjusted && users.some((stack) => !adjusted.has(stack[1] ?? ""))) add(face.file && preloaded.has(face.file) ? faces : lateFaces, face.family, page.path);
|
|
1825
1833
|
}
|
|
1826
1834
|
};
|
|
1827
1835
|
return {
|
|
@@ -1841,6 +1849,7 @@ const loadOrder = {
|
|
|
1841
1849
|
});
|
|
1842
1850
|
for (const [family, pages] of faces) findings.push({ message: `The preloaded face "${family}" swaps in without a width-matched stand-in (size-adjust) behind it, on ${few(pages)}. Add a local() stand-in with size-adjust right after it in the stack.` });
|
|
1843
1851
|
for (const [family, pages] of lateFaces) if (!faces.has(family)) findings.push({ message: `The face "${family}" swaps in without a width-matched stand-in (size-adjust) behind it, on ${few(pages)}; not preloaded, so likely below the fold. A local() stand-in with size-adjust right after it in the stack keeps the line from moving.` });
|
|
1852
|
+
for (const [family, pages] of optionalFaces) findings.push({ message: `The face "${family}" uses font-display: optional, on ${few(pages)}: a first visit where it arrives after the ~100 ms block window keeps the fallback font for the whole page view, until a reload finds it cached. Use font-display: swap with a local() stand-in carrying size-adjust right after it in the stack.` });
|
|
1844
1853
|
return findings;
|
|
1845
1854
|
}
|
|
1846
1855
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { g as CONFIG_FILE, d as MAX_FINDINGS_PER_CHECK, f as MAX_MESSAGE_CHARS, p as MAX_PATH_CHARS, o as SITE_CHECKS_FILE, t as USAGE, m as blockingResults, v as checks, y as checksOf, n as cli, i as distChecks, s as findingLine, _ as loadOptions, b as readAstroConfig, c as refusalMessage, a as runDistChecks, h as runSiteChecks, r as runStage, l as summarizeBlocking, u as summaryLines } from "./cli-
|
|
1
|
+
export { g as CONFIG_FILE, d as MAX_FINDINGS_PER_CHECK, f as MAX_MESSAGE_CHARS, p as MAX_PATH_CHARS, o as SITE_CHECKS_FILE, t as USAGE, m as blockingResults, v as checks, y as checksOf, n as cli, i as distChecks, s as findingLine, _ as loadOptions, b as readAstroConfig, c as refusalMessage, a as runDistChecks, h as runSiteChecks, r as runStage, l as summarizeBlocking, u as summaryLines } from "./cli-BZOXjO-z.mjs";
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Release notes of `@v-office/site-checks`, newest first. Each version has its own directory.
|
|
6
6
|
|
|
7
|
+
- `versions/0.5.3/CHANGELOG.md`: release notes for 0.5.3
|
|
7
8
|
- `versions/0.5.2/CHANGELOG.md`: release notes for 0.5.2
|
|
8
9
|
- `versions/0.5.1/CHANGELOG.md`: release notes for 0.5.1
|
|
9
10
|
- `versions/0.5.0/CHANGELOG.md`: release notes for 0.5.0
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Migration guides of `@v-office/site-checks`, newest first. Apply them in order when skipping versions.
|
|
6
6
|
|
|
7
|
+
- `versions/0.5.3/MIGRATION.md`: Migration: 0.5.2 to 0.5.3
|
|
7
8
|
- `versions/0.5.2/MIGRATION.md`: Migration: 0.5.1 to 0.5.2
|
|
8
9
|
- `versions/0.5.1/MIGRATION.md`: Migration: 0.5.0 to 0.5.1
|
|
9
10
|
- `versions/0.5.0/MIGRATION.md`: Migration: 0.4.2 to 0.5.0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog: 0.5.3
|
|
2
|
+
|
|
3
|
+
`load-order` warns about web fonts declared with `font-display: optional`, and reads the font
|
|
4
|
+
stacks of a Tailwind v4 build, so its font rules now fire on real sites.
|
|
5
|
+
|
|
6
|
+
## Added
|
|
7
|
+
|
|
8
|
+
- `load-order` reports a used face declared with `font-display: optional` (first in a font stack),
|
|
9
|
+
once per family: "The face "Lato" uses font-display: optional, on …". Under `optional`, a first
|
|
10
|
+
visit where the font arrives after the browser's ~100 ms block window (typically the homepage,
|
|
11
|
+
where the hero photo competes for the connection) keeps the fallback font for the whole page
|
|
12
|
+
view, until a reload finds the font cached. A face declared but used in no stack is not reported.
|
|
13
|
+
|
|
14
|
+
## Fixed
|
|
15
|
+
|
|
16
|
+
- `load-order` reads font stacks from `--font-*` custom properties (`--font-sans: "Lato", …`,
|
|
17
|
+
`--font-display: …`) as well as from `font-family`. Tailwind v4 puts every stack there and the
|
|
18
|
+
rules only say `font-family: var(--font-sans)`, so the check saw no stack on a Tailwind site and
|
|
19
|
+
never reported a font. The existing warning for a `font-display: swap` face without a
|
|
20
|
+
`size-adjust` stand-in behind it is unchanged, and now also fires on such sites.
|
|
21
|
+
|
|
22
|
+
The levels, the configuration keys, the exit codes and the report's shape stay the same.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Migration: 0.5.2 to 0.5.3
|
|
2
|
+
|
|
3
|
+
## 1. Upgrade
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add --save-exact --save-dev @v-office/site-checks@0.5.3
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
No changes required to build. `load-order` is a warning and may now report the site's fonts.
|
|
10
|
+
|
|
11
|
+
## 2. Fix a face that uses `font-display: optional`
|
|
12
|
+
|
|
13
|
+
For each `@font-face` the warning names (usually in `src/styles/global.css`):
|
|
14
|
+
|
|
15
|
+
1. Set `font-display: swap`.
|
|
16
|
+
2. Add a stand-in face built from Arial, resized to the web font's metrics, so the swap barely
|
|
17
|
+
moves the text:
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: "Lexend Fallback";
|
|
22
|
+
src: local("Arial"), local("ArialMT");
|
|
23
|
+
size-adjust: 109.52%;
|
|
24
|
+
ascent-override: 91.3%;
|
|
25
|
+
descent-override: 22.83%;
|
|
26
|
+
line-gap-override: 0%;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
These are Lexend's values; never copy them to another font. Measure each font's own from the
|
|
31
|
+
site's woff2 file against Arial (average glyph width over German sample copy for
|
|
32
|
+
`size-adjust`; the font's ascent, descent and line gap divided by `size-adjust` for the
|
|
33
|
+
overrides). One stand-in per web font family; a variable font with all weights needs one.
|
|
34
|
+
|
|
35
|
+
3. Name the stand-in right after the web font in every `--font-*` stack that starts with it:
|
|
36
|
+
|
|
37
|
+
```css
|
|
38
|
+
@theme {
|
|
39
|
+
--font-sans: "Lexend Variable", "Lexend Fallback", ui-sans-serif, sans-serif;
|
|
40
|
+
--font-display: "Lexend Variable", "Lexend Fallback", ui-sans-serif, sans-serif;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Keep the font's `<link rel="preload">` where it has one. A `swap` face whose stack has no
|
|
45
|
+
`size-adjust` stand-in right after it is reported by the same check ("swaps in without a
|
|
46
|
+
width-matched stand-in"); the same stand-in fixes that warning.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/site-checks",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "The checks over a v-office website in two stages, `site-checks src` before the build and `site-checks dist` after it, which AI Studio's build worker runs on every build from its own pinned copy; the report has the shape of the build worker's dist-check report, and a site excludes the findings it accepts in site-checks.config.json",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|