@v-office/site-checks 0.2.2 → 0.2.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 CHANGED
@@ -41,24 +41,24 @@ A refused build ends with the failing checks and their first findings:
41
41
  keys are accepted by `siteChecks({ … })`, and an option given there wins over the file's key.
42
42
  Severities are fixed by the package: a site configures data, never whether a check blocks.
43
43
 
44
- | Key | Used by | What |
45
- | ------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
46
- | `donorTerms` | `donor-terms` | Terms that must not ship: the template site's brand, people, places, phone, email, domain, asset names. Plain strings, matched case-insensitively with whitespace collapsed. |
47
- | `optimizeDepsIgnore` | `optimize-deps` | Packages imported from `src/` that may stay out of `vite.optimizeDeps.include` (only server-side code uses them). Exact specifier or package name. |
48
- | `imageIgnore` | `image-formats` | Raster images under `public/` that ship without an AVIF sibling on purpose, as paths relative to the project root (`public/brand/logo.png`). |
49
- | `feedImagePatterns` | `feed-image-formats` | Regular expressions (case-insensitive) matching a feed photo URL still requested as JPEG or PNG. Defaults to the vOffice image hosts (imgproxy `plain` paths, `dyn.v-office.com`). |
50
- | `listingPages` | `listing-noindex`, `listing-links` | URL paths of pages that list rentals, in addition to the pages the check recognizes by their markup. |
51
- | `listingClientOnly` | `listing-links` | Listing pages whose list stays client-only, as `{ "path", "reason" }`: their list is the rentals free in a window, and a build-time list would show booked-out flats. |
52
- | `consentAllowedHosts` | `consent-gate` | Hosts a `<script src>` or `<iframe src>` may load before consent. The site's own host (`site` in the Astro config) is always allowed. |
53
- | `wiring` | `wiring` | Markup hooks `{ init, marker, scope: "section" \| "global", file? }` and kept texts `{ file, contains, guard }` (the former `scripts/wiring.json` `hooks`). |
54
- | `hubFilterOptions` | `v9-hub-filters` | v9: the Website SDK options the Hub filter check needs (`rentalScope`, `customAttributeFilterDefinitions`), as the site passes them to the SDK. |
55
- | `structureIgnore` | `page-structure` | Rules the site declines: `one-h1`, `heading-skip`, `landmark-main`, `img-alt`, `control-label`, `table-headers`, `heading-ratio`. |
56
- | `bannedCopy` | `banned-copy` | Wordings recorded customer corrections ban, as `{ "pattern", "why" }` (a regular expression over the page's visible text). |
57
- | `copyExcludePaths` | the copy checks | URL paths (and below) the copy checks skip, legal pages ported verbatim; `/impressum` also covers `/de/impressum`. |
58
- | `bannedCopyExcludePaths` | `banned-copy` | URL paths only `banned-copy` skips (an FAQ whose answers port verbatim). |
59
- | `allowDuplicateSentences` | `duplicate-sentences` | Sentences a page may render twice. |
60
- | `quoteSources` | `quote-sources` | Files or directories holding the text a `<blockquote>` may quote (content captures, the feed's reviews written by the build). |
61
- | `factCheckAccepted` | `rental-facts` | Disagreements the customer confirmed, as the finding prints them: `<slug> <kind> prose=<n> feed=<n>`. |
44
+ | Key | Used by | What |
45
+ | ------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
46
+ | `donorTerms` | `donor-terms` | Terms that must not ship: the template site's brand, people, places, phone, email, domain, asset names. Plain strings, matched as whole words, case-insensitively with whitespace collapsed. |
47
+ | `optimizeDepsIgnore` | `optimize-deps` | Packages imported from `src/` that may stay out of `vite.optimizeDeps.include` (only server-side code uses them). Exact specifier or package name. |
48
+ | `imageIgnore` | `image-formats` | Raster images under `public/` that ship without an AVIF sibling on purpose, as paths relative to the project root (`public/brand/logo.png`). |
49
+ | `feedImagePatterns` | `feed-image-formats` | Regular expressions (case-insensitive) matching a feed photo URL still requested as JPEG or PNG. Defaults to the vOffice image hosts (imgproxy `plain` paths, `dyn.v-office.com`). |
50
+ | `listingPages` | `listing-noindex`, `listing-links` | URL paths of pages that list rentals, in addition to the pages the check recognizes by their markup. |
51
+ | `listingClientOnly` | `listing-links` | Listing pages whose list stays client-only, as `{ "path", "reason" }`: their list is the rentals free in a window, and a build-time list would show booked-out flats. |
52
+ | `consentAllowedHosts` | `consent-gate` | Hosts a `<script src>` or `<iframe src>` may load before consent. The site's own host (`site` in the Astro config) is always allowed. |
53
+ | `wiring` | `wiring` | Markup hooks `{ init, marker, scope: "section" \| "global", file? }` and kept texts `{ file, contains, guard }` (the former `scripts/wiring.json` `hooks`). |
54
+ | `hubFilterOptions` | `v9-hub-filters` | v9: the Website SDK options the Hub filter check needs (`rentalScope`, `customAttributeFilterDefinitions`), as the site passes them to the SDK. |
55
+ | `structureIgnore` | `page-structure` | Rules the site declines: `one-h1`, `heading-skip`, `landmark-main`, `img-alt`, `control-label`, `table-headers`, `heading-ratio`. |
56
+ | `bannedCopy` | `banned-copy` | Wordings recorded customer corrections ban, as `{ "pattern", "why" }` (a regular expression over the page's visible text). |
57
+ | `copyExcludePaths` | the copy checks | URL paths (and below) the copy checks skip, legal pages ported verbatim; `/impressum` also covers `/de/impressum`. |
58
+ | `bannedCopyExcludePaths` | `banned-copy` | URL paths only `banned-copy` skips (an FAQ whose answers port verbatim). |
59
+ | `allowDuplicateSentences` | `duplicate-sentences` | Sentences a page may render twice. |
60
+ | `quoteSources` | `quote-sources` | Files or directories holding the text a `<blockquote>` may quote (content captures, the feed's reviews written by the build). |
61
+ | `factCheckAccepted` | `rental-facts` | Disagreements the customer confirmed, as the finding prints them: `<slug> <kind> prose=<n> feed=<n>`. |
62
62
 
63
63
  ## The checks
64
64
 
@@ -66,7 +66,7 @@ Severities are fixed by the package: a site configures data, never whether a che
66
66
  | --------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
67
67
  | `html-comments` | error | An HTML comment (`<!-- … -->`) in `src/**/*.{astro,tsx,jsx,md,mdx,html}`: Astro passes it into the built page, readable with View Source. | `{/* … */}` in `.astro` and JSX markup, `//` in frontmatter, remove it from Markdown. |
68
68
  | `view-source` | error | A developer's note a visitor can read with View Source: an HTML comment in a built page (framework markers are allowed), a comment in an inline `<script>`, `<style>` or event handler that is also in `src/` or `public/`, a comment in CSS or a line comment in JS copied from `public/`, a source map or a reference to one in any shipped file. Bundled JS and CSS are not scanned for comments. | Remove the comment; turn source maps off in the build. |
69
- | `donor-terms` | error | A configured term in the visible text, the title, inline scripts and styles (JSON-LD) or an attribute of a built page, in a built file name, or in the shipped JS and CSS. Skipped without configured terms. | Replace the term; list the template site's terms in `donorTerms`. |
69
+ | `donor-terms` | error | A configured term in the visible text, the title, inline scripts and styles (JSON-LD) or an attribute of a built page, in a built file name, or in the shipped JS and CSS, as a whole word. Skipped without configured terms. | Replace the term; list the template site's terms in `donorTerms`. |
70
70
  | `optimize-deps` | warning | A runtime package (`dependencies`) imported from `src/` that is not listed, with the exact specifier, in `vite.optimizeDeps.include`. Vite discovers it mid-session instead and re-bundles every dependency. | Add the specifier to `vite.optimizeDeps.include` in `astro.config`, or to `optimizeDepsIgnore` when only server-side code uses it. |
71
71
  | `sync-once` | warning | An inline content loader in `src/content.config.ts` that fetches the PMS without the `CONTENT_SYNC_TOKEN` reuse idiom: `astro check` and `astro build` each run it, twice per build. | Keep the token in the store's meta (`meta.get`) and reuse the entries (`store.keys()`) when it matches. |
72
72
  | `consent-gate` | error | A third-party `<script src>` or `<iframe src>` outside the consent kit's `ConsentEmbed` frame, loading before consent; a vendor in `ENABLED_VENDOR_IDS` that is not `approved` in `consent-registry.snapshot.json`. Skipped without `src/lib/consent/`. | Frame it with `ConsentEmbed`, or register the vendor so the kit injects it after consent; list a consent-free host in `consentAllowedHosts`. |
@@ -74,7 +74,7 @@ Severities are fixed by the package: a site configures data, never whether a che
74
74
  | `feed-image-formats` | warning | A feed photo from the vOffice image hosts requested as JPEG or PNG in `src`, `srcset` or `poster`; a warning because the photos come from the PMS feed. | Pass feed photos through `webpUrl()`. |
75
75
  | `listing-noindex` | error | A page that lists rentals (the search page's `data-prerendered-results` container, the `SearchResults` island, or `listingPages`) that is noindex. Waits while every page is noindex. | Take the page out of the noindex routes. |
76
76
  | `listing-links` | warning | A page that lists rentals that carries no links to rentals in its HTML, so a crawler without JavaScript sees an empty list. Runs once some listing has links or the build has more than ten pages; a warning because the links come from the PMS feed. | Render the list server-side, or list the page in `listingClientOnly` with the reason. |
77
- | `sitemap-noindex` | error | A sitemap entry whose page says noindex or is not in the build; an `llms.txt` link to a page that is not there. Skipped without a sitemap and `llms.txt`. | Make the sitemap filter and the noindex routes agree; fix the link. |
77
+ | `sitemap-noindex` | error | A sitemap entry whose page says noindex (waits while every page is noindex) or is not in the build; an `llms.txt` link to a page that is not there. Skipped without a sitemap and `llms.txt`. | Make the sitemap filter and the noindex routes agree; fix the link. |
78
78
  | `page-heads` | warning | On indexable pages: a title over 60 characters, a description empty or over 160, a title or description another page repeats. A missing one is the build worker's `page-metadata`. | Shorten; give each page its own. |
79
79
  | `wiring` | error | A component carrying a configured hook's marker whose initializer nothing calls (`section`: the component itself; `global`: anything in `src/`), through leaves marked `@bound-by-parent <init>`; a kept text gone from its file. Comments are stripped first. Skipped without `wiring`. | Call the initializer, mark the leaf `@bound-by-parent`, or put the kept text back. |
80
80
  | `unused-initializers` | warning | An `init*` exported from `src/scripts/*.ts` that nothing calls. Skipped without `src/scripts/`. | Wire the feature, or delete the leftover. |
package/dist/astro.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as writeSiteChecksReport, d as runSiteChecks, i as summaryLines, l as blockingResults, m as checks, n as refusalMessage, p as loadOptions } from "./report-Dg5jtgGy.mjs";
1
+ import { a as writeSiteChecksReport, d as runSiteChecks, i as summaryLines, l as blockingResults, m as checks, n as refusalMessage, p as loadOptions } from "./report-DMjG_lMz.mjs";
2
2
  import { fileURLToPath } from "node:url";
3
3
  //#region src/astro.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { _ as referencedUrls, c as MAX_PATH_CHARS, g as loadDistContext, h as isSameSiteReference, l as blockingResults, o as MAX_FINDINGS_PER_CHECK, r as summarizeBlocking, s as MAX_MESSAGE_CHARS, t as SITE_CHECKS_FILE, u as runChecks, v as resolveReference, y as xmlText } from "./report-Dg5jtgGy.mjs";
1
+ import { _ as referencedUrls, c as MAX_PATH_CHARS, g as loadDistContext, h as isSameSiteReference, l as blockingResults, o as MAX_FINDINGS_PER_CHECK, r as summarizeBlocking, s as MAX_MESSAGE_CHARS, t as SITE_CHECKS_FILE, u as runChecks, v as resolveReference, y as xmlText } from "./report-DMjG_lMz.mjs";
2
2
  //#region src/distChecks/insecureResources.ts
3
3
  /** `<link>` relations the browser fetches as a subresource; canonical,
4
4
  * alternate, preconnect and friends are hints or metadata, not loads. */
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as writeSiteChecksReport, c as MAX_PATH_CHARS, d as runSiteChecks, f as CONFIG_FILE, i as summaryLines, l as blockingResults, m as checks, n as refusalMessage, o as MAX_FINDINGS_PER_CHECK, p as loadOptions, r as summarizeBlocking, s as MAX_MESSAGE_CHARS, t as SITE_CHECKS_FILE } from "./report-Dg5jtgGy.mjs";
1
+ import { a as writeSiteChecksReport, c as MAX_PATH_CHARS, d as runSiteChecks, f as CONFIG_FILE, i as summaryLines, l as blockingResults, m as checks, n as refusalMessage, o as MAX_FINDINGS_PER_CHECK, p as loadOptions, r as summarizeBlocking, s as MAX_MESSAGE_CHARS, t as SITE_CHECKS_FILE } from "./report-DMjG_lMz.mjs";
2
2
  export { CONFIG_FILE, MAX_FINDINGS_PER_CHECK, MAX_MESSAGE_CHARS, MAX_PATH_CHARS, SITE_CHECKS_FILE, blockingResults, checks, loadOptions, refusalMessage, runSiteChecks, summarizeBlocking, summaryLines, writeSiteChecksReport };
@@ -485,15 +485,25 @@ const quoteSources = {
485
485
  /** More than this and the point is made; the runner keeps 25 anyway. */
486
486
  const MAX_RAW_FINDINGS = 100;
487
487
  const normalize$2 = (text) => text.normalize("NFC").toLowerCase().replace(/\s+/g, " ");
488
- const excerpt$1 = (haystack, term) => {
489
- const at = haystack.indexOf(term);
488
+ const escape$1 = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
489
+ const WORD = /[\p{L}\p{N}]/u;
490
+ /** A term as a whole word: where it starts or ends with a letter or digit, the text next to it must
491
+ * not continue the word, so "schlei" does not match "wendeschleife" and "emden" not "fremden". A
492
+ * term that starts or ends with other characters (a phone number's "+", a domain's dot) matches
493
+ * there as written. */
494
+ const wholeWord = (term) => {
495
+ const chars = [...term];
496
+ return new RegExp(`${WORD.test(chars[0]) ? "(?<![\\p{L}\\p{N}])" : ""}${escape$1(term)}${WORD.test(chars.at(-1)) ? "(?![\\p{L}\\p{N}])" : ""}`, "u");
497
+ };
498
+ const excerpt$1 = (haystack, at, length) => {
490
499
  const start = Math.max(0, at - 30);
491
- const end = Math.min(haystack.length, at + term.length + 30);
500
+ const end = Math.min(haystack.length, at + length + 30);
492
501
  return `${start > 0 ? "…" : ""}${haystack.slice(start, end)}${end < haystack.length ? "…" : ""}`;
493
502
  };
494
503
  /** Every site starts from a template ("donor") site, and nothing of it may ship: its brand, people,
495
504
  * places, phone, email, domain, asset names. The site lists the terms in `site-checks.config.json`
496
- * (`donorTerms`); without them the check skips, which the report shows. Matched in the visible
505
+ * (`donorTerms`); without them the check skips, which the report shows. A term matches as a whole
506
+ * word, case-insensitively with whitespace collapsed. Matched in the visible
497
507
  * text, the title, the inline scripts and styles (JSON-LD shows in search results) and the
498
508
  * attributes of every built page, in the built file names and in the shipped JS and CSS, where an
499
509
  * island's copy lives. */
@@ -502,23 +512,31 @@ const donorTerms = {
502
512
  title: "Terms of the template site in the built output",
503
513
  severity: "error",
504
514
  begin: (ctx) => {
505
- const terms = [...new Set(ctx.options.donorTerms.map(normalize$2).filter(Boolean))];
515
+ const terms = [...new Set(ctx.options.donorTerms.map(normalize$2).map((t) => t.trim()).filter(Boolean))].map((term) => ({
516
+ term,
517
+ re: wholeWord(term)
518
+ }));
506
519
  if (terms.length === 0 || !ctx.hasDist) return null;
507
520
  const findings = [];
508
521
  /** One finding per term and place: the first text of `texts` that contains it. */
509
522
  const scan = (texts, path, where) => {
510
- for (const term of terms) {
523
+ const haystacks = texts.map(normalize$2);
524
+ for (const { term, re } of terms) {
511
525
  if (findings.length >= MAX_RAW_FINDINGS) return;
512
- const hit = texts.map(normalize$2).find((haystack) => haystack.includes(term));
513
- if (hit !== void 0) findings.push({
514
- path,
515
- message: `donor term "${term}" in ${where}: "${excerpt$1(hit, term)}"`
516
- });
526
+ for (const haystack of haystacks) {
527
+ const match = re.exec(haystack);
528
+ if (!match) continue;
529
+ findings.push({
530
+ path,
531
+ message: `donor term "${term}" in ${where}: "${excerpt$1(haystack, match.index, term.length)}"`
532
+ });
533
+ break;
534
+ }
517
535
  }
518
536
  };
519
537
  return {
520
538
  visit: (page) => {
521
- scan([page.visibleText()], page.path, "the visible text");
539
+ scan([blockText(page.document.body ?? page.document.documentElement)], page.path, "the visible text");
522
540
  scan(page.attributeValues(), page.path, "an attribute");
523
541
  scan([...page.document.querySelectorAll("title, script:not([src]), style")].map((el) => el.textContent ?? ""), page.path, "the title or inline code");
524
542
  },
@@ -1497,7 +1515,8 @@ const toPath = (loc) => {
1497
1515
  const locs = (xml) => [...xml.matchAll(/<loc>\s*([^<]+?)\s*<\/loc>/g)].map((m) => xmlText(m[1]));
1498
1516
  /** The URL lists the build publishes agree with the pages it built: no sitemap entry whose own page
1499
1517
  * says noindex or is not in the build, no `llms.txt` link to a page that is not there. Skipped when
1500
- * the build publishes neither (a site before launch). */
1518
+ * the build publishes neither. While every page is noindex (a site before launch, under its blanket
1519
+ * robots meta), a sitemap listing them is not refused: that disagreement ends with the launch. */
1501
1520
  const sitemapNoindex = {
1502
1521
  id: "sitemap-noindex",
1503
1522
  title: "Published URL lists match the built pages",
@@ -1507,9 +1526,12 @@ const sitemapNoindex = {
1507
1526
  const start = ctx.has(SITEMAP_INDEX) ? [SITEMAP_INDEX] : ctx.files.filter((f) => /^sitemap[^/]*\.xml$/.test(f));
1508
1527
  if (start.length === 0 && !ctx.has(LLMS)) return null;
1509
1528
  const noindex = /* @__PURE__ */ new Map();
1529
+ let indexable = 0;
1510
1530
  return {
1511
1531
  visit: (page) => {
1512
- if (!page.redirect && page.noindex) noindex.set(normalize(page.url), page.path);
1532
+ if (page.redirect) return;
1533
+ if (page.noindex) noindex.set(normalize(page.url), page.path);
1534
+ else indexable += 1;
1513
1535
  },
1514
1536
  finish: () => {
1515
1537
  const findings = [];
@@ -1536,7 +1558,7 @@ const sitemapNoindex = {
1536
1558
  path: sitemap,
1537
1559
  message: `The sitemap lists ${loc}, which is not in the build.`
1538
1560
  });
1539
- else if (noindex.has(urlPath)) findings.push({
1561
+ else if (indexable > 0 && noindex.has(urlPath)) findings.push({
1540
1562
  path: sitemap,
1541
1563
  message: `The sitemap lists ${loc}, whose page says noindex: the sitemap filter and the noindex routes disagree.`
1542
1564
  });
@@ -1984,7 +2006,8 @@ const FRAMEWORK_COMMENTS = /* @__PURE__ */ new Set([
1984
2006
  "[",
1985
2007
  "]",
1986
2008
  "teleport start",
1987
- "teleport end"
2009
+ "teleport end",
2010
+ "v-if"
1988
2011
  ]);
1989
2012
  const isFrameworkComment = (data) => {
1990
2013
  const text = data.trim();
@@ -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.2.3/CHANGELOG.md`: release notes for 0.2.3
7
8
  - `versions/0.2.2/CHANGELOG.md`: release notes for 0.2.2
8
9
  - `versions/0.2.1/CHANGELOG.md`: release notes for 0.2.1
9
10
  - `versions/0.2.0/CHANGELOG.md`: release notes for 0.2.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.2.3/MIGRATION.md`: Migration: 0.2.2 to 0.2.3
7
8
  - `versions/0.2.2/MIGRATION.md`: Migration: 0.2.1 to 0.2.2
8
9
  - `versions/0.2.1/MIGRATION.md`: Migration: 0.2.0 to 0.2.1
9
10
  - `versions/0.2.0/MIGRATION.md`: Migration: 0.1.0 to 0.2.0
@@ -0,0 +1,18 @@
1
+ # Changelog: 0.2.3
2
+
3
+ Three fixes for false refusals found while rolling site-checks out to the sites: a site before
4
+ launch, a donor term inside a longer word, and Vue's own placeholder comment.
5
+
6
+ ## Fixed
7
+
8
+ - `sitemap-noindex` waits while every page is noindex (a site before launch, under its blanket
9
+ robots meta): a sitemap that lists those pages is no longer refused then. Once any page is
10
+ indexable it applies as before. A sitemap entry or `llms.txt` link to a page the build does not
11
+ have is still refused, launched or not.
12
+ - `donor-terms` matches a term as a whole word: "Schlei" no longer matches "Wendeschleife", nor
13
+ "Emden" "fremden". Matching stays case-insensitive with whitespace collapsed; a term that starts
14
+ or ends with something other than a letter or digit (a phone number's "+", a domain) matches
15
+ there as written. The visible text is read as a visitor sees it, so a word split by inline
16
+ markup (`Wende<em>schlei</em>fe`) is one word.
17
+ - `view-source` allows the HTML comment `v-if`, the placeholder Vue renders for a false `v-if` (for example
18
+ a closed reka-ui or shadcn-vue dialog portal). No developer writes it.
@@ -0,0 +1,15 @@
1
+ # Migration: 0.2.2 to 0.2.3
2
+
3
+ No changes required.
4
+
5
+ ## 1. Upgrade
6
+
7
+ ```sh
8
+ pnpm add --save-exact --save-dev @v-office/site-checks@0.2.3
9
+ ```
10
+
11
+ ## What changes for the site
12
+
13
+ - Before launch, a sitemap listing the site's noindex pages no longer refuses the build.
14
+ - `donorTerms` entries match whole words. A term that relied on matching inside a longer word (a
15
+ prefix such as "brisen" meant to catch "Brisenhof") now needs the full word; list every spelling.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/site-checks",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Build-time checks for the sites: runs inside `astro build`, writes dist/site-checks.json in the shape of the build worker's dist-check report, and refuses the build when a check with severity error finds something. The site-shipping guards of the commit gate, pinned and run where the site is built",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {