@v-office/site-checks 0.5.0 → 0.5.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/bin.mjs CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { n as cli } from "./cli-ChBTZhc7.mjs";
3
- //#region src/bin.ts
2
+ import { n as cli } from "./cli-DDeid5ml.mjs";
3
+ // src/bin.ts
4
4
  process.exitCode = await cli(process.argv.slice(2), {
5
5
  out: (line) => console.log(line),
6
6
  err: (line) => console.error(line)
7
7
  });
8
- //#endregion
9
8
  export {};
@@ -5,7 +5,7 @@ import { brotliCompressSync, constants } from "node:zlib";
5
5
  import os from "node:os";
6
6
  import { spawn } from "node:child_process";
7
7
  import { parseArgs } from "node:util";
8
- //#region src/jsComments.ts
8
+ // src/jsComments.ts
9
9
  /** One pass over JavaScript (or the script parts of a component): its comments, and the code with
10
10
  * them blanked. String and template literals are kept whole, so `//` in `"https://…"` or `/*` in
11
11
  * `'a /* b'` is no comment; `${…}` inside a template is code again, to its matching `}`. `'…'` and
@@ -189,8 +189,7 @@ const stripComments = (text, options = {}) => {
189
189
  };
190
190
  /** Every comment in the text, as written. */
191
191
  const jsComments = (text, options = {}) => findComments(text, options).map((c) => c.text);
192
- //#endregion
193
- //#region src/astroConfig.ts
192
+ // src/astroConfig.ts
194
193
  /** The Astro config files, in the order Astro itself looks for them. */
195
194
  const CONFIG_FILES = [
196
195
  "astro.config.mjs",
@@ -266,8 +265,7 @@ const readAstroConfig = (root) => {
266
265
  layoutKey: LAYOUT_KEYS.find((key) => mentions(text, key) > 0)
267
266
  };
268
267
  };
269
- //#endregion
270
- //#region src/sourceComments.ts
268
+ // src/sourceComments.ts
271
269
  /** Files of code only, read by the string-aware JavaScript lexer: no text runs between their
272
270
  * tokens, so a `//` outside a string always opens a comment. */
273
271
  const CODE = /* @__PURE__ */ new Set([
@@ -302,8 +300,7 @@ const blankSourceComments = (raw, extension) => {
302
300
  if (extension === ".mdx" || extension === ".md") return htmlComments$1(raw.replace(/\{\s*\/\*[\s\S]*?\*\/\s*\}/g, blank));
303
301
  return raw;
304
302
  };
305
- //#endregion
306
- //#region src/checks/consentGate.ts
303
+ // src/checks/consentGate.ts
307
304
  /** The consent kit's files in a site: its presence under `src/lib/consent/` is what makes the
308
305
  * check apply; the vendors the site enables and the fleet registry's review of them. */
309
306
  const KIT_DIR = "src/lib/consent/";
@@ -457,8 +454,7 @@ const consentGateSource = {
457
454
  } };
458
455
  }
459
456
  };
460
- //#endregion
461
- //#region src/context.ts
457
+ // src/context.ts
462
458
  const SKIPPED_TEXT_TAGS = /* @__PURE__ */ new Set([
463
459
  "SCRIPT",
464
460
  "STYLE",
@@ -699,8 +695,7 @@ const xmlText = (text) => text.replace(/&(?:#x([0-9a-f]+)|#(\d+)|(amp|lt|gt|quot
699
695
  apos: "'"
700
696
  }[name.toLowerCase()] ?? entity;
701
697
  });
702
- //#endregion
703
- //#region src/exclude.ts
698
+ // src/exclude.ts
704
699
  const LOCALE = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
705
700
  /** The `:line` (and `:column`) a source finding's path ends with. */
706
701
  const LINE = /:\d+(?::\d+)?$/;
@@ -738,8 +733,7 @@ const assertKnownChecks = (exclude, ids) => {
738
733
  const unknown = Object.keys(exclude).filter((id) => !known.has(id));
739
734
  if (unknown.length > 0) throw new Error(`[site-checks] "exclude" names ${unknown.length === 1 ? "an unknown check" : "unknown checks"}: ${unknown.join(", ")}`);
740
735
  };
741
- //#endregion
742
- //#region src/checks/copy.ts
736
+ // src/checks/copy.ts
743
737
  /** Pages the copy checks read: not a redirect stub, not the 404 page, not an excluded path. An
744
738
  * entry covers the path and everything below it, with or without a locale prefix: `/impressum`
745
739
  * also covers `/de/impressum`. */
@@ -930,8 +924,7 @@ const quoteSources = {
930
924
  };
931
925
  }
932
926
  };
933
- //#endregion
934
- //#region src/checks/donorTerms.ts
927
+ // src/checks/donorTerms.ts
935
928
  /** More than this and the point is made; the runner keeps 25 anyway. */
936
929
  const MAX_RAW_FINDINGS = 100;
937
930
  const collapse$2 = (text) => text.normalize("NFC").replace(/\s+/g, " ");
@@ -1094,8 +1087,7 @@ const donorTermsSource = {
1094
1087
  } };
1095
1088
  }
1096
1089
  };
1097
- //#endregion
1098
- //#region src/checks/htmlComments.ts
1090
+ // src/checks/htmlComments.ts
1099
1091
  /** Files that hold no text: an image or font can carry the bytes `<!--` by chance, and reading
1100
1092
  * every photo under `src/assets/` costs time for nothing. */
1101
1093
  const BINARY_EXTENSIONS = new Set(".png .jpg .jpeg .gif .webp .avif .ico .bmp .tif .tiff .woff .woff2 .ttf .otf .eot .mp4 .webm .mov .mp3 .pdf .zip".split(" "));
@@ -1129,8 +1121,7 @@ const htmlComments = {
1129
1121
  return findings;
1130
1122
  } })
1131
1123
  };
1132
- //#endregion
1133
- //#region src/checks/imageFormats.ts
1124
+ // src/checks/imageFormats.ts
1134
1125
  const RASTER = /* @__PURE__ */ new Set([
1135
1126
  ".jpg",
1136
1127
  ".jpeg",
@@ -1256,8 +1247,7 @@ const feedImageFormats = {
1256
1247
  };
1257
1248
  }
1258
1249
  };
1259
- //#endregion
1260
- //#region src/sitemaps.ts
1250
+ // src/sitemaps.ts
1261
1251
  /** A URL path as the sitemap checks compare it: query and fragment dropped, escapes decoded, no
1262
1252
  * trailing slash but the root's. The slash is a project-wide setting (`trailingSlash`), not a
1263
1253
  * statement about the page. */
@@ -1321,8 +1311,7 @@ const walkSitemaps = (ctx) => {
1321
1311
  };
1322
1312
  /** The paths (`normalize`d) the build's sitemaps list; empty without a sitemap. */
1323
1313
  const sitemapPaths = (ctx) => new Set(readSitemaps(ctx).entries.map((entry) => entry.path));
1324
- //#endregion
1325
- //#region src/checks/launchHead.ts
1314
+ // src/checks/launchHead.ts
1326
1315
  /** Hosts a site is previewed on before it has its own domain: a `site` there is not a launch. */
1327
1316
  const PREVIEW_HOST = /(?:^|\.)(?:cloudfront\.net|vercel\.app|netlify\.app|pages\.dev|github\.io)$|^(?:localhost|127\.0\.0\.1)$|\.local$/i;
1328
1317
  /** The site's production host, when the Astro config names one that is not a preview origin. */
@@ -1444,8 +1433,7 @@ const trailingSlash = {
1444
1433
  stage: "dist",
1445
1434
  begin: (ctx) => ctx.config.trailingSlash === void 0 ? null : whenLaunched(ctx, () => ctx.config.trailingSlash === "never" ? [] : [{ message: `trailingSlash is "${ctx.config.trailingSlash}" in the Astro config: set it to "never" and write internal links without a trailing slash.` }])
1446
1435
  };
1447
- //#endregion
1448
- //#region src/checks/jsonLd.ts
1436
+ // src/checks/jsonLd.ts
1449
1437
  const blocksOf = (page) => [...page.document.querySelectorAll("script")].filter((s) => s.getAttribute("type")?.trim().toLowerCase() === "application/ld+json").map((s) => s.textContent ?? "");
1450
1438
  /** The blocks of a page that parse; the others are `json-ld`'s findings. */
1451
1439
  const parsedBlocks = (page) => blocksOf(page).flatMap((block) => {
@@ -1542,8 +1530,7 @@ const breadcrumbs = {
1542
1530
  };
1543
1531
  }
1544
1532
  };
1545
- //#endregion
1546
- //#region src/checks/listingLinks.ts
1533
+ // src/checks/listingLinks.ts
1547
1534
  /** A page that lists rentals renders the list into its HTML too, inside this container, so a
1548
1535
  * crawler running no JavaScript sees the rentals the live island will show. The search page of
1549
1536
  * the site starter marks its server-rendered results this way. */
@@ -1648,8 +1635,7 @@ const listingLinks = {
1648
1635
  };
1649
1636
  }
1650
1637
  };
1651
- //#endregion
1652
- //#region src/checks/loadOrder.ts
1638
+ // src/checks/loadOrder.ts
1653
1639
  /** Libraries that serve one feature a visitor reaches later (a map, a chart, a 3D view): `name` is
1654
1640
  * the package (a chunk named after it), `signature` a string only its code carries. */
1655
1641
  const ON_DEMAND = [
@@ -1924,8 +1910,7 @@ const firstPaintPhotos = {
1924
1910
  };
1925
1911
  }
1926
1912
  };
1927
- //#endregion
1928
- //#region src/checks/orphanPages.ts
1913
+ // src/checks/orphanPages.ts
1929
1914
  /** Every indexable page but the home page is linked from another page of the build, in its HTML: a
1930
1915
  * page only the sitemap reaches reads as unimportant to a crawler. Links an island renders in the
1931
1916
  * browser do not count, which is the point: a crawler that runs no JavaScript sees none of them. A
@@ -1961,8 +1946,7 @@ const orphanPages = {
1961
1946
  };
1962
1947
  }
1963
1948
  };
1964
- //#endregion
1965
- //#region src/siteTexts.ts
1949
+ // src/siteTexts.ts
1966
1950
  const CODE_EXTENSIONS = /* @__PURE__ */ new Set([
1967
1951
  ".ts",
1968
1952
  ".tsx",
@@ -2120,8 +2104,7 @@ const flatSources = (ctx) => filesOf(ctx, OWN_EXTENSIONS).map((file) => ({
2120
2104
  rel: ctx.rel(file),
2121
2105
  ...flatten(ctx.readSource(file), path.extname(file).toLowerCase())
2122
2106
  }));
2123
- //#endregion
2124
- //#region src/checks/ownCopy.ts
2107
+ // src/checks/ownCopy.ts
2125
2108
  /** The copy checks over the site's own words in `src/` (`siteTexts.ts`), never the built pages,
2126
2109
  * which also print the PMS feed's text: what they find is the site's to fix, so they are errors. */
2127
2110
  const excerpt$1 = (text, max) => {
@@ -2251,8 +2234,7 @@ const bannedCopySrc = {
2251
2234
  } };
2252
2235
  }
2253
2236
  };
2254
- //#endregion
2255
- //#region src/checks/pageHeads.ts
2237
+ // src/checks/pageHeads.ts
2256
2238
  const MAX_TITLE = 60;
2257
2239
  const MAX_DESCRIPTION = 160;
2258
2240
  /** The head of every indexable page as a search result shows it: a title over 60 or a description
@@ -2349,8 +2331,7 @@ const pageHeads = {
2349
2331
  };
2350
2332
  }
2351
2333
  };
2352
- //#endregion
2353
- //#region src/checks/pageStructure.ts
2334
+ // src/checks/pageStructure.ts
2354
2335
  /** Not in the document's structure: icon internals answer no alt or label question, template markup
2355
2336
  * is not in the page until a script clones it. */
2356
2337
  const OUTSIDE = "svg, script, style, noscript, template";
@@ -2476,8 +2457,7 @@ const headingRatio = {
2476
2457
  };
2477
2458
  }
2478
2459
  };
2479
- //#endregion
2480
- //#region src/env.ts
2460
+ // src/env.ts
2481
2461
  /** The env files a production build reads, in the order Vite applies them (a later file wins per
2482
2462
  * key). The `.local` pair is left out on purpose: it is the developer's machine, never what the
2483
2463
  * deployed site builds against, and a site must not commit it. */
@@ -2546,8 +2526,7 @@ const sdkEnv = (root, processEnv = process.env) => {
2546
2526
  };
2547
2527
  /** What the developer's `.local` files set. */
2548
2528
  const localEnv = (root) => Object.assign({}, ...LOCAL_ENV_FILES.map((file) => readEnvFile(root, file)));
2549
- //#endregion
2550
- //#region src/checks/v9.ts
2529
+ // src/checks/v9.ts
2551
2530
  /** The be-on! Hub endpoints per stage, as `@v-office/website-headless` resolves `CMS_STAGE` for v9
2552
2531
  * (`sdk/endpoints.ts`). Production is what a live v9 site calls. */
2553
2532
  const HUB = {
@@ -2679,8 +2658,7 @@ const v9HubFilters = {
2679
2658
  } };
2680
2659
  }
2681
2660
  };
2682
- //#endregion
2683
- //#region src/checks/productionEnv.ts
2661
+ // src/checks/productionEnv.ts
2684
2662
  /** The v10 endpoints of production, as `@v-office/website-headless` resolves `CMS_STAGE`
2685
2663
  * (`sdk/endpoints.ts`, `VOFFICE_ENDPOINTS`). */
2686
2664
  const V10_PRODUCTION = {
@@ -2764,8 +2742,7 @@ const v10ProductionApi = productionEnv({
2764
2742
  id: "v10-production-api",
2765
2743
  title: "A launched v10 site calls the production vOffice API"
2766
2744
  }, "v10", "vOffice API", V10_PRODUCTION);
2767
- //#endregion
2768
- //#region src/checks/rentalFacts.ts
2745
+ // src/checks/rentalFacts.ts
2769
2746
  /** The markers the platform's rental blocks carry for this check (`GATE_MARKERS` in
2770
2747
  * `@v-office/website-headless`): the fact row, the owner's description, the amenity section and
2771
2748
  * its all-amenities dialog. A site's own layout may put facts in a chip row marked
@@ -3038,8 +3015,7 @@ const rentalFacts = {
3038
3015
  };
3039
3016
  }
3040
3017
  };
3041
- //#endregion
3042
- //#region src/checks/robotsTxt.ts
3018
+ // src/checks/robotsTxt.ts
3043
3019
  /** The extensions an Astro endpoint is written in. */
3044
3020
  const ENDPOINT_EXTENSIONS = [
3045
3021
  ".ts",
@@ -3064,8 +3040,7 @@ const robotsTxt = {
3064
3040
  }] : [] };
3065
3041
  }
3066
3042
  };
3067
- //#endregion
3068
- //#region src/checks/sitemapNoindex.ts
3043
+ // src/checks/sitemapNoindex.ts
3069
3044
  const SITEMAP = /^sitemap[^/]*\.xml$/;
3070
3045
  const SITEMAP_INDEX = "sitemap-index.xml";
3071
3046
  const LLMS = "llms.txt";
@@ -3172,8 +3147,7 @@ const sitemapCoverage = {
3172
3147
  };
3173
3148
  }
3174
3149
  };
3175
- //#endregion
3176
- //#region src/checks/syncOnce.ts
3150
+ // src/checks/syncOnce.ts
3177
3151
  const LOADER_FILES = ["src/content.config.ts", "src/content/config.ts"];
3178
3152
  /** A loader written inline, as opposed to `glob()` or `file()`. */
3179
3153
  const INLINE_LOADER = /\bloader\s*:\s*\{/;
@@ -3227,8 +3201,7 @@ const syncOnce = {
3227
3201
  } };
3228
3202
  }
3229
3203
  };
3230
- //#endregion
3231
- //#region src/checks/viewSource.ts
3204
+ // src/checks/viewSource.ts
3232
3205
  /** Comments the frameworks themselves write into static HTML, and no developer did, matched
3233
3206
  * exactly on the trimmed comment text: Astro's island end and server-island start, React 19's
3234
3207
  * form-state and document markers, Vue's teleport markers and its placeholder for a false `v-if`
@@ -3397,8 +3370,7 @@ const viewSource = {
3397
3370
  };
3398
3371
  }
3399
3372
  };
3400
- //#endregion
3401
- //#region src/checks/vofficeCredit.ts
3373
+ // src/checks/vofficeCredit.ts
3402
3374
  /** The host itself, not a substring: `v-office.com.example` is someone else's, `dyn.v-office.com`
3403
3375
  * the photo host. */
3404
3376
  const CREDIT = /^https?:\/\/(?:www\.)?v-office\.com(?:[/?#]|$)/i;
@@ -3417,8 +3389,7 @@ const footerCredit = (document) => {
3417
3389
  credit
3418
3390
  };
3419
3391
  };
3420
- //#endregion
3421
- //#region src/checks/index.ts
3392
+ // src/checks/index.ts
3422
3393
  /** The site checks, in the order the report shows them: the `src` stage first, then the `dist`
3423
3394
  * stage. Each check names its stage; `site-checks src` runs the first group before the build and
3424
3395
  * `site-checks dist` the second after it, together with the platform's dist checks
@@ -3488,8 +3459,7 @@ const checks = [
3488
3459
  rentalFacts
3489
3460
  ];
3490
3461
  const checksOf = (stage) => checks.filter((check) => check.stage === stage);
3491
- //#endregion
3492
- //#region src/options.ts
3462
+ // src/options.ts
3493
3463
  const CONFIG_FILE = "site-checks.config.json";
3494
3464
  /** Keys of checks earlier versions had. A file that still carries one is noted, never refused: a
3495
3465
  * site mid-rollout must not be stopped by a key it was told to add a release ago. */
@@ -3637,8 +3607,7 @@ function loadOptions(root, overrides = {}, note = () => {}) {
3637
3607
  exclude: pick("exclude", {})
3638
3608
  };
3639
3609
  }
3640
- //#endregion
3641
- //#region src/runner.ts
3610
+ // src/runner.ts
3642
3611
  /** Findings kept per check in the report; the rest is counted in `omitted`. */
3643
3612
  const MAX_FINDINGS_PER_CHECK = 25;
3644
3613
  /** The controller's `siteCheckReportSchema` accepts a finding message of at most 2000 characters
@@ -3769,8 +3738,7 @@ const contextInput = (input) => ({
3769
3738
  const runSiteChecks = (input, list = checks) => runChecks(() => loadContext(contextInput(input)), list, (ctx) => ctx.options.exclude);
3770
3739
  /** Results with status `error`: the ones `site-checks` exits non-zero for. */
3771
3740
  const blockingResults = (report) => report.results.filter((r) => r.status === "error");
3772
- //#endregion
3773
- //#region src/report.ts
3741
+ // src/report.ts
3774
3742
  /** The `dist` stage's report file under `dist/`. The build worker reads it after the build and
3775
3743
  * never uploads it (it names source paths and configured terms). */
3776
3744
  const SITE_CHECKS_FILE = "site-checks.json";
@@ -3798,8 +3766,7 @@ const refusalMessage = (report, stage, reportFile) => {
3798
3766
  };
3799
3767
  /** One line naming what refused the build, for the studio: the failing checks and their counts. */
3800
3768
  const summarizeBlocking = (report) => "Checks refused the build: " + blockingResults(report).map((r) => `${r.id} (${plural(count(r), "finding")})`).join(", ");
3801
- //#endregion
3802
- //#region src/distChecks/insecureResources.ts
3769
+ // src/distChecks/insecureResources.ts
3803
3770
  /** `<link>` relations the browser fetches as a subresource; canonical,
3804
3771
  * alternate, preconnect and friends are hints or metadata, not loads. */
3805
3772
  const RESOURCE_RELS = /* @__PURE__ */ new Set([
@@ -3846,8 +3813,7 @@ const insecureResources = {
3846
3813
  };
3847
3814
  }
3848
3815
  };
3849
- //#endregion
3850
- //#region src/distChecks/internalLinks.ts
3816
+ // src/distChecks/internalLinks.ts
3851
3817
  /** A same-site reference (`href`, `src`, `srcset`, `poster`) that no file of
3852
3818
  * the build serves — the 404 class, caught before a guest hits it. One finding
3853
3819
  * per missing target, on the first page that references it and with the count
@@ -3892,8 +3858,7 @@ const internalLinks = {
3892
3858
  };
3893
3859
  }
3894
3860
  };
3895
- //#endregion
3896
- //#region src/distChecks/keyPages.ts
3861
+ // src/distChecks/keyPages.ts
3897
3862
  /** The pages every build must emit: the home page, and on an Astro site the
3898
3863
  * 404 page the hosting serves for unknown paths. */
3899
3864
  const keyPages = {
@@ -3913,8 +3878,7 @@ const keyPages = {
3913
3878
  return { finish: () => findings };
3914
3879
  }
3915
3880
  };
3916
- //#endregion
3917
- //#region src/distChecks/legalPages.ts
3881
+ // src/distChecks/legalPages.ts
3918
3882
  /** German sites owe an Impressum (§ 5 DDG) and a privacy notice (Art. 13
3919
3883
  * DSGVO) reachable from every page; English wordings count too. Matched on
3920
3884
  * the link's target and its text, so a footer link named either way passes.
@@ -3950,8 +3914,7 @@ const legalPages = {
3950
3914
  };
3951
3915
  }
3952
3916
  };
3953
- //#endregion
3954
- //#region src/distChecks/notFoundBeacon.ts
3917
+ // src/distChecks/notFoundBeacon.ts
3955
3918
  /** A call that posts to the endpoint, not the bare path: a comment or a string naming
3956
3919
  * `/api/404-log` logs nothing. `fetch("/api/404-log", …)`, `fetch(new URL("/api/404-log", …))`,
3957
3920
  * `navigator.sendBeacon("…/api/404-log", …)`. */
@@ -4018,8 +3981,7 @@ const notFoundBeacon = {
4018
3981
  };
4019
3982
  }
4020
3983
  };
4021
- //#endregion
4022
- //#region src/distChecks/pageMetadata.ts
3984
+ // src/distChecks/pageMetadata.ts
4023
3985
  /** What every page needs in its head: a title, a description, the document
4024
3986
  * language. Missing ones are the classic leftovers of a generated layout. A
4025
3987
  * redirect stub is no page anyone reads and is skipped. */
@@ -4051,8 +4013,7 @@ const pageMetadata = {
4051
4013
  };
4052
4014
  }
4053
4015
  };
4054
- //#endregion
4055
- //#region src/distChecks/placeholderContent.ts
4016
+ // src/distChecks/placeholderContent.ts
4056
4017
  /** Text that should never reach a visitor: template filler, a value that was
4057
4018
  * rendered instead of formatted, a template expression the build did not
4058
4019
  * evaluate. And references to development hosts or example domains. */
@@ -4118,8 +4079,7 @@ const placeholderContent = {
4118
4079
  };
4119
4080
  }
4120
4081
  };
4121
- //#endregion
4122
- //#region src/distChecks/siteManifest.ts
4082
+ // src/distChecks/siteManifest.ts
4123
4083
  const FILE = "site-manifest.json";
4124
4084
  const isRecord = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
4125
4085
  const manifestFindings = (ctx) => {
@@ -4158,8 +4118,7 @@ const siteManifest = {
4158
4118
  severity: "warning",
4159
4119
  begin: (ctx) => ({ finish: () => manifestFindings(ctx) })
4160
4120
  };
4161
- //#endregion
4162
- //#region src/distChecks/sitemap.ts
4121
+ // src/distChecks/sitemap.ts
4163
4122
  const pathOf = (url) => {
4164
4123
  try {
4165
4124
  return new URL(url.trim(), "http://site.invalid").pathname;
@@ -4167,8 +4126,7 @@ const pathOf = (url) => {
4167
4126
  return null;
4168
4127
  }
4169
4128
  };
4170
- //#endregion
4171
- //#region src/distChecks/index.ts
4129
+ // src/distChecks/index.ts
4172
4130
  /**
4173
4131
  * The dist checks: the platform's checks over a build's `dist/`. They are part of the `dist`
4174
4132
  * stage (`site-checks dist` runs them after the site's own), and the build worker also runs them
@@ -4243,8 +4201,7 @@ const runDistChecks = (distDir, opts, list = distChecks) => {
4243
4201
  assertKnownChecks(exclude, [...checks, ...distChecks].map((check) => check.id));
4244
4202
  return runChecks(() => loadDistContext(distDir, opts), list, () => exclude);
4245
4203
  };
4246
- //#endregion
4247
- //#region src/stages.ts
4204
+ // src/stages.ts
4248
4205
  /**
4249
4206
  * Runs one stage over a project. `src` runs the source checks and leaves any `dist/` unread;
4250
4207
  * `dist` runs the site's dist-stage checks and the platform's dist checks over the build output,
@@ -4281,8 +4238,7 @@ const runStage = async (stage, input) => {
4281
4238
  isAstro
4282
4239
  }), list, () => exclude);
4283
4240
  };
4284
- //#endregion
4285
- //#region src/cli.ts
4241
+ // src/cli.ts
4286
4242
  const USAGE = `Usage: site-checks <src | dist | verify> [options]
4287
4243
 
4288
4244
  src the source checks, before the build (reads the project, never dist/)
@@ -4469,5 +4425,4 @@ async function verify(root, site, io, cwd) {
4469
4425
  io.out(`[site-checks] verify passed: ${passed.join(", ")}`);
4470
4426
  return 0;
4471
4427
  }
4472
- //#endregion
4473
4428
  export { loadOptions as _, runDistChecks as a, readAstroConfig as b, refusalMessage as c, MAX_FINDINGS_PER_CHECK as d, MAX_MESSAGE_CHARS as f, CONFIG_FILE as g, runSiteChecks as h, distChecks as i, summarizeBlocking as l, blockingResults as m, cli as n, SITE_CHECKS_FILE as o, MAX_PATH_CHARS as p, runStage as r, findingLine as s, USAGE as t, summaryLines as u, checks as v, checksOf as y };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { parseHTML } from "linkedom";
2
- //#region src/astroConfig.d.ts
3
2
  type AstroConfigFacts = {
4
3
  /** Whether the project has an Astro config file at all: a Vite app has none. */
5
4
  found: boolean;
@@ -18,8 +17,6 @@ type AstroConfigFacts = {
18
17
  * process.env.SITE_URL`) or ambiguous is not taken; the builder passes the site URL, and without
19
18
  * one the checks that need it wait. */
20
19
  export declare const readAstroConfig: (root: string) => AstroConfigFacts;
21
- //#endregion
22
- //#region src/exclude.d.ts
23
20
  /** One exclusion of a check's findings: a path, or a path and text the finding's message contains.
24
21
  * `reason` is for whoever reads the config next. */
25
22
  type Exclusion = string | {
@@ -30,8 +27,6 @@ type Exclusion = string | {
30
27
  /** A site's exclusions (`exclude` in `site-checks.config.json`), by check id: `true` turns the
31
28
  * check off for the site, a list hides the findings an entry covers. */
32
29
  type Exclusions = Record<string, true | Exclusion[]>;
33
- //#endregion
34
- //#region src/options.d.ts
35
30
  /** A wording a recorded customer correction bans from the rendered pages. */
36
31
  interface BannedCopy {
37
32
  /** A regular expression (source), matched against each page's visible text, whitespace
@@ -117,8 +112,6 @@ export declare const CONFIG_FILE = "site-checks.config.json";
117
112
  /** The file's keys with the given options on top. A file that cannot be parsed throws: a broken
118
113
  * config must not silently disable a check. `note` hears about a retired key. */
119
114
  export declare function loadOptions(root: string, overrides?: SiteChecksOptions, note?: (message: string) => void): ResolvedOptions;
120
- //#endregion
121
- //#region src/types.d.ts
122
115
  /** Two families of checks share these types, one runner and one report shape:
123
116
  * - the site checks (`checks/`) over a site's source and built output, at the site's pinned
124
117
  * version: `site-checks src` before the build, `site-checks dist` after it;
@@ -247,8 +240,6 @@ type DistCheck = Check<DistContext>;
247
240
  /** What the `dist` stage runs over: the site's context with the build, which is also everything a
248
241
  * dist check reads, so both families see each page once. */
249
242
  type DistStageContext = SiteCheckContext & DistContext;
250
- //#endregion
251
- //#region src/checks/index.d.ts
252
243
  /** The site checks, in the order the report shows them: the `src` stage first, then the `dist`
253
244
  * stage. Each check names its stage; `site-checks src` runs the first group before the build and
254
245
  * `site-checks dist` the second after it, together with the platform's dist checks
@@ -256,8 +247,6 @@ type DistStageContext = SiteCheckContext & DistContext;
256
247
  * is one file here, one entry, one test, a README row and a CHANGELOG entry. */
257
248
  export declare const checks: readonly SiteCheck[];
258
249
  export declare const checksOf: (stage: Stage) => readonly SiteCheck[];
259
- //#endregion
260
- //#region src/cli.d.ts
261
250
  type Io = {
262
251
  out: (line: string) => void;
263
252
  err: (line: string) => void;
@@ -265,8 +254,6 @@ type Io = {
265
254
  export declare const USAGE = "Usage: site-checks <src | dist | verify> [options]\n\n src the source checks, before the build (reads the project, never dist/)\n dist the checks over the built output, after the build\n verify what AI Studio's build runs, stopping at the first failure: src, astro check, the\n build script, dist (--root and --site only)\n\nOptions:\n --root <dir> the project (default: the current directory)\n --dist <dir> the build output, relative to the root (default: dist; dist stage only)\n --site <url> the site's public URL (default: `site` in the Astro config file)\n --report <file> write the report as JSON here (default for dist: <dist>/site-checks.json)\n -h, --help this text\n\nExits 0 when nothing refused, 1 when a check with severity error found something or (verify)\nastro check or the build failed, 2 on a usage or configuration error. Data for the checks:\nsite-checks.config.json at the project root.";
266
255
  /** The command line. Returns the exit code; prints to `io`. */
267
256
  export declare function cli(argv: readonly string[], io: Io, cwd?: string): Promise<number>;
268
- //#endregion
269
- //#region src/report.d.ts
270
257
  /** The `dist` stage's report file under `dist/`. The build worker reads it after the build and
271
258
  * never uploads it (it names source paths and configured terms). */
272
259
  export declare const SITE_CHECKS_FILE = "site-checks.json";
@@ -279,8 +266,6 @@ export declare const summaryLines: (report: CheckReport) => string[];
279
266
  export declare const refusalMessage: (report: CheckReport, stage: string, reportFile?: string) => string;
280
267
  /** One line naming what refused the build, for the studio: the failing checks and their counts. */
281
268
  export declare const summarizeBlocking: (report: CheckReport) => string;
282
- //#endregion
283
- //#region src/context.d.ts
284
269
  type ContextInput = {
285
270
  root: string;
286
271
  srcDir: string;
@@ -293,8 +278,6 @@ type ContextInput = {
293
278
  config: SiteCheckContext["config"];
294
279
  options: ResolvedOptions;
295
280
  };
296
- //#endregion
297
- //#region src/runner.d.ts
298
281
  /** Findings kept per check in the report; the rest is counted in `omitted`. */
299
282
  export declare const MAX_FINDINGS_PER_CHECK = 25;
300
283
  /** The controller's `siteCheckReportSchema` accepts a finding message of at most 2000 characters
@@ -318,8 +301,6 @@ type RunInput = {
318
301
  export declare const runSiteChecks: (input: RunInput, list?: readonly SiteCheck[]) => Promise<CheckReport>;
319
302
  /** Results with status `error`: the ones `site-checks` exits non-zero for. */
320
303
  export declare const blockingResults: (report: CheckReport) => CheckResult[];
321
- //#endregion
322
- //#region src/distChecks/index.d.ts
323
304
  /**
324
305
  * The dist checks: the platform's checks over a build's `dist/`. They are part of the `dist`
325
306
  * stage (`site-checks dist` runs them after the site's own), and the build worker also runs them
@@ -338,8 +319,6 @@ export declare const runDistChecks: (distDir: string, opts: {
338
319
  siteUrl?: string | undefined;
339
320
  root?: string | undefined;
340
321
  }, list?: readonly DistCheck[]) => Promise<CheckReport>;
341
- //#endregion
342
- //#region src/stages.d.ts
343
322
  type StageInput = {
344
323
  root: string;
345
324
  /** The build output; `<root>/dist` by default. Read by the `dist` stage only. */
@@ -363,5 +342,4 @@ type StageInput = {
363
342
  * this version does not have.
364
343
  */
365
344
  export declare const runStage: (stage: Stage, input: StageInput) => Promise<CheckReport>;
366
- //#endregion
367
345
  export type { AstroConfigFacts, BannedCopy, BuildOutput, Check, CheckReport, CheckResult, CheckRun, CheckStatus, DistCheck, DistContext, DistStageContext, Exclusion, Exclusions, Finding, Io, Page, ResolvedOptions, RunInput, Severity, SiteCheck, SiteCheckContext, SiteChecksOptions, Stage, StageInput };
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- import { _ as loadOptions, a as runDistChecks, b as readAstroConfig, c as refusalMessage, d as MAX_FINDINGS_PER_CHECK, f as MAX_MESSAGE_CHARS, g as CONFIG_FILE, h as runSiteChecks, i as distChecks, l as summarizeBlocking, m as blockingResults, n as cli, o as SITE_CHECKS_FILE, p as MAX_PATH_CHARS, r as runStage, s as findingLine, t as USAGE, u as summaryLines, v as checks, y as checksOf } from "./cli-ChBTZhc7.mjs";
2
- export { CONFIG_FILE, MAX_FINDINGS_PER_CHECK, MAX_MESSAGE_CHARS, MAX_PATH_CHARS, SITE_CHECKS_FILE, USAGE, blockingResults, checks, checksOf, cli, distChecks, findingLine, loadOptions, readAstroConfig, refusalMessage, runDistChecks, runSiteChecks, runStage, summarizeBlocking, summaryLines };
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-DDeid5ml.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.1/CHANGELOG.md`: release notes for 0.5.1
7
8
  - `versions/0.5.0/CHANGELOG.md`: release notes for 0.5.0
8
9
  - `versions/0.4.2/CHANGELOG.md`: release notes for 0.4.2
9
10
  - `versions/0.4.1/CHANGELOG.md`: release notes for 0.4.1
@@ -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.1/MIGRATION.md`: Migration: 0.5.0 to 0.5.1
7
8
  - `versions/0.5.0/MIGRATION.md`: Migration: 0.4.2 to 0.5.0
8
9
  - `versions/0.4.2/MIGRATION.md`: Migration: 0.4.1 to 0.4.2
9
10
  - `versions/0.4.1/MIGRATION.md`: Migration: 0.4.0 to 0.4.1
@@ -10,8 +10,9 @@ pnpm add --save-exact --save-dev @v-office/site-checks@0.1.0
10
10
 
11
11
  ```js
12
12
  // astro.config.mjs
13
- import { siteManifest } from "@v-office/site-manifest/astro";
13
+
14
14
  import { siteChecks } from "@v-office/site-checks/astro";
15
+ import { siteManifest } from "@v-office/site-manifest/astro";
15
16
 
16
17
  export default defineConfig({
17
18
  integrations: [siteManifest(), siteChecks()],
@@ -22,7 +22,7 @@ PMS or Hub data is a warning; the nightly builds that update prices never stop o
22
22
  - `v9-hub-filters` (warning, v9 only): the be-on! Hub the site builds against serves every filter
23
23
  the site's search needs (the scope filter, the Merkliste's rental-id filter, each searchable
24
24
  backend-filter definition). It asks the Hub through the site's own `website-sdk hub-filters
25
- check`, with the build's env and `hubFilterOptions`; a site that sets the SDK CLI's
25
+ check`, with the build's env and `hubFilterOptions`; a site that sets the SDK CLI's
26
26
  `HUB_RENTAL_SCOPE_PROPERTY_KIND` or `HUB_RENTAL_IDS_SEARCH` has them forwarded. A Hub that cannot be asked (no
27
27
  `website-sdk`, an SDK without the command, no key) is reported, never passed.
28
28
  - `v9-production-hub` (error, v9 only): a launched v9 site builds against the production Hub:
@@ -0,0 +1,11 @@
1
+ # Changelog: 0.5.1
2
+
3
+ Dependency update; the checks report the same.
4
+
5
+ ## Changed
6
+
7
+ - `linkedom` 0.18.13 → 0.18.15, the HTML parser the checks read the built pages with: an attribute
8
+ selector on `class` no longer matches an element without the attribute.
9
+
10
+ The rules, their levels, the configuration keys, the exit codes and the report's shape stay the
11
+ same.
@@ -0,0 +1,9 @@
1
+ # Migration: 0.5.0 to 0.5.1
2
+
3
+ ## 1. Upgrade
4
+
5
+ ```sh
6
+ pnpm add --save-exact --save-dev @v-office/site-checks@0.5.1
7
+ ```
8
+
9
+ No changes required.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/site-checks",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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": {
@@ -26,15 +26,15 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "linkedom": "0.18.13"
29
+ "linkedom": "0.18.15"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "26.5.1",
33
- "oxfmt": "0.67.0",
34
- "oxlint": "1.82.0",
35
- "tsdown": "0.23.0",
32
+ "@types/node": "24.19.2",
33
+ "oxfmt": "0.79.0",
34
+ "oxlint": "1.94.0",
35
+ "tsdown": "0.23.7",
36
36
  "typescript": "7.0.2",
37
- "vitest": "^5.0.0"
37
+ "vitest": "^5.1.0"
38
38
  },
39
39
  "engines": {
40
40
  "node": "^22.0.0 || ^24.0.0 || ^25.0.0 || >=26.0.0"