@uxfront/site-checks 0.1.0 → 0.1.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/index.d.ts CHANGED
@@ -13,79 +13,79 @@ export type Entity = "numeric" | "amp" | "lt" | "gt" | "quot" | "apos" | `#${str
13
13
  * reads its HTML exactly as its own checker did. The README gives each setting's values.
14
14
  */
15
15
  export interface ParseProfile {
16
- /** Where `<meta>` and `<link>` tags are read. Defaults to `document`. */
17
- scope?: Scope;
18
- /** Where `<title>` is read. Defaults to `head`. */
19
- titleScope?: Scope;
20
- /**
21
- * The `<title>` elements read: `any` (attributes and any text), `plain-text` (attributes, and
22
- * text without a `<`) or `bare` (no attributes, and text without a `<`). Defaults to `any`.
23
- */
24
- titleTag?: "any" | "plain-text" | "bare";
25
- /** When a title is trimmed: `after-decode`, `before-decode` or `none`. Defaults to `after-decode`. */
26
- trimTitle?: "after-decode" | "before-decode" | "none";
27
- /** The attribute values read: `any` (double, single or no quotes) or `double` only. */
28
- quotes?: "any" | "double";
29
- /** Whether tag names match in lower case only, so `<META>` isn't a `<meta>`. Defaults to `false`. */
30
- caseSensitiveTags?: boolean;
31
- /**
32
- * What ends a tag's name: `word` (a word boundary, so `<meta-card>` reads as a `<meta>`) or
33
- * `space` (a space, `/` or `>`). Defaults to `word`.
34
- */
35
- tagEnd?: "word" | "space";
36
- /**
37
- * How a `<meta>` is found by key: `name-or-property` (either attribute), or `property-first`
38
- * (its `property`, or else its `name`, leaving out a tag with no `content`).
39
- */
40
- metaKey?: "name-or-property" | "property-first";
41
- /** Whether `<meta>` `content` and `<html lang>` values are trimmed. Defaults to `false`. */
42
- trimValues?: boolean;
43
- /** The entities decoded in attribute values, titles and sitemap URLs. */
44
- decode?: readonly Entity[];
45
- /**
46
- * `one-pass` decodes each reference once, so `&amp;lt;` stays `&lt;`. `numeric-first` decodes
47
- * numeric references before named ones, so `&#38;lt;` becomes `<`.
48
- */
49
- decodeOrder?: "one-pass" | "numeric-first";
50
- /** Whether named entities decode in any case, like `&AMP;`. Defaults to `false`. */
51
- decodeIgnoreCase?: boolean;
52
- /** The units of a length: `code-points`, or `utf-16` code units like `String.length`. */
53
- count?: "code-points" | "utf-16";
54
- /**
55
- * Where `<h1>` is counted: `anywhere`, `markup` (outside `<script>` and comments), or `rendered`
56
- * (outside `<script>`, `<style>`, `<template>` and comments).
57
- */
58
- h1?: "anywhere" | "markup" | "rendered";
59
- /**
60
- * The JSON-LD nodes of a block: `graph-or-block` (the `@graph` members, or else the block),
61
- * `block-and-graph` (the block and its `@graph` members), `all` (the block and its `@graph`
62
- * members, recursively, arrays flattened) or `graph-deep` (the `@graph` members, recursively,
63
- * or else the block, arrays flattened).
64
- */
65
- nodes?: "graph-or-block" | "block-and-graph" | "all" | "graph-deep";
66
- /** Whether an array `@type` matches any of its members. */
67
- typeArrays?: boolean;
68
- /**
69
- * The `<script>` elements read as JSON-LD: `exact` (`type="application/ld+json"`) or
70
- * `prefix-any-case` (a `type` that starts with it, in any case). Defaults to `exact`.
71
- */
72
- jsonLdType?: "exact" | "prefix-any-case";
73
- /**
74
- * The lines of `llms.txt` that count as blank: `whitespace` (only spaces), or `empty` (nothing,
75
- * so a CRLF file's `\r` counts as text). Defaults to `whitespace`.
76
- */
77
- blankLines?: "whitespace" | "empty";
78
- /** Whether `<loc>` and `<lastmod>` values are trimmed. Defaults to `true`. */
79
- trimSitemap?: boolean;
80
- /** Whether a `<loc>` listed twice is checked once. Defaults to `false`. */
81
- mergeDuplicateLocs?: boolean;
82
- /**
83
- * How `_headers` is read: `lines` (line by line, skipping `#` lines and the spaces at each
84
- * line's ends) or `blocks` (each unindented line and the indented lines after it as one rule,
85
- * where a `#` line is a rule of its own and a line that ends in `\r` isn't a header).
86
- * Defaults to `lines`.
87
- */
88
- headersParser?: "lines" | "blocks";
16
+ /** Where `<meta>` and `<link>` tags are read. Defaults to `document`. */
17
+ scope?: Scope;
18
+ /** Where `<title>` is read. Defaults to `head`. */
19
+ titleScope?: Scope;
20
+ /**
21
+ * The `<title>` elements read: `any` (attributes and any text), `plain-text` (attributes, and
22
+ * text without a `<`) or `bare` (no attributes, and text without a `<`). Defaults to `any`.
23
+ */
24
+ titleTag?: "any" | "plain-text" | "bare";
25
+ /** When a title is trimmed: `after-decode`, `before-decode` or `none`. Defaults to `after-decode`. */
26
+ trimTitle?: "after-decode" | "before-decode" | "none";
27
+ /** The attribute values read: `any` (double, single or no quotes) or `double` only. */
28
+ quotes?: "any" | "double";
29
+ /** Whether tag names match in lower case only, so `<META>` isn't a `<meta>`. Defaults to `false`. */
30
+ caseSensitiveTags?: boolean;
31
+ /**
32
+ * What ends a tag's name: `word` (a word boundary, so `<meta-card>` reads as a `<meta>`) or
33
+ * `space` (a space, `/` or `>`). Defaults to `word`.
34
+ */
35
+ tagEnd?: "word" | "space";
36
+ /**
37
+ * How a `<meta>` is found by key: `name-or-property` (either attribute), or `property-first`
38
+ * (its `property`, or else its `name`, leaving out a tag with no `content`).
39
+ */
40
+ metaKey?: "name-or-property" | "property-first";
41
+ /** Whether `<meta>` `content` and `<html lang>` values are trimmed. Defaults to `false`. */
42
+ trimValues?: boolean;
43
+ /** The entities decoded in attribute values, titles and sitemap URLs. */
44
+ decode?: ReadonlyArray<Entity>;
45
+ /**
46
+ * `one-pass` decodes each reference once, so `&amp;lt;` stays `&lt;`. `numeric-first` decodes
47
+ * numeric references before named ones, so `&#38;lt;` becomes `<`.
48
+ */
49
+ decodeOrder?: "one-pass" | "numeric-first";
50
+ /** Whether named entities decode in any case, like `&AMP;`. Defaults to `false`. */
51
+ decodeIgnoreCase?: boolean;
52
+ /** The units of a length: `code-points`, or `utf-16` code units like `String.length`. */
53
+ count?: "code-points" | "utf-16";
54
+ /**
55
+ * Where `<h1>` is counted: `anywhere`, `markup` (outside `<script>` and comments), or `rendered`
56
+ * (outside `<script>`, `<style>`, `<template>` and comments).
57
+ */
58
+ h1?: "anywhere" | "markup" | "rendered";
59
+ /**
60
+ * The JSON-LD nodes of a block: `graph-or-block` (the `@graph` members, or else the block),
61
+ * `block-and-graph` (the block and its `@graph` members), `all` (the block and its `@graph`
62
+ * members, recursively, arrays flattened) or `graph-deep` (the `@graph` members, recursively,
63
+ * or else the block, arrays flattened).
64
+ */
65
+ nodes?: "graph-or-block" | "block-and-graph" | "all" | "graph-deep";
66
+ /** Whether an array `@type` matches any of its members. */
67
+ typeArrays?: boolean;
68
+ /**
69
+ * The `<script>` elements read as JSON-LD: `exact` (`type="application/ld+json"`) or
70
+ * `prefix-any-case` (a `type` that starts with it, in any case). Defaults to `exact`.
71
+ */
72
+ jsonLdType?: "exact" | "prefix-any-case";
73
+ /**
74
+ * The lines of `llms.txt` that count as blank: `whitespace` (only spaces), or `empty` (nothing,
75
+ * so a CRLF file's `\r` counts as text). Defaults to `whitespace`.
76
+ */
77
+ blankLines?: "whitespace" | "empty";
78
+ /** Whether `<loc>` and `<lastmod>` values are trimmed. Defaults to `true`. */
79
+ trimSitemap?: boolean;
80
+ /** Whether a `<loc>` listed twice is checked once. Defaults to `false`. */
81
+ mergeDuplicateLocs?: boolean;
82
+ /**
83
+ * How `_headers` is read: `lines` (line by line, skipping `#` lines and the spaces at each
84
+ * line's ends) or `blocks` (each unindented line and the indented lines after it as one rule,
85
+ * where a `#` line is a rule of its own and a line that ends in `\r` isn't a header).
86
+ * Defaults to `lines`.
87
+ */
88
+ headersParser?: "lines" | "blocks";
89
89
  }
90
90
 
91
91
  /**
@@ -103,29 +103,29 @@ export interface ParseProfile {
103
103
  * host and match the path alone, reading only the last `X-Robots-Tag` of a rule.
104
104
  */
105
105
  export type IndexSource =
106
- | {
107
- type: "meta";
108
- names: readonly string[];
109
- /** Defaults to `["noindex"]`. */
110
- values?: readonly string[];
111
- /** Match whole words only. */
112
- word?: boolean;
113
- caseSensitive?: boolean;
114
- property?: boolean;
115
- anyCaseNames?: boolean;
116
- scope?: Scope;
117
- }
118
- | { type: "refresh" }
119
- | { type: "files"; files: readonly string[] }
120
- | { type: "under"; paths: readonly string[] }
121
- | { type: "redirects" }
122
- | {
123
- type: "headers";
124
- hosts: "ignore" | "match" | "drop";
125
- /** Defaults to `["noindex"]`. */
126
- values?: readonly string[];
127
- word?: boolean;
128
- };
106
+ | {
107
+ type: "meta";
108
+ names: ReadonlyArray<string>;
109
+ /** Defaults to `["noindex"]`. */
110
+ values?: ReadonlyArray<string>;
111
+ /** Match whole words only. */
112
+ word?: boolean;
113
+ caseSensitive?: boolean;
114
+ property?: boolean;
115
+ anyCaseNames?: boolean;
116
+ scope?: Scope;
117
+ }
118
+ | { type: "refresh" }
119
+ | { type: "files"; files: ReadonlyArray<string> }
120
+ | { type: "under"; paths: ReadonlyArray<string> }
121
+ | { type: "redirects" }
122
+ | {
123
+ type: "headers";
124
+ hosts: "ignore" | "match" | "drop";
125
+ /** Defaults to `["noindex"]`. */
126
+ values?: ReadonlyArray<string>;
127
+ word?: boolean;
128
+ };
129
129
 
130
130
  /**
131
131
  * A set of site paths: `*` for every page, a path ending in `*` for every page under it, like
@@ -138,215 +138,216 @@ export type NoOptions = Record<string, never>;
138
138
 
139
139
  /** The options of each rule. `true` turns a rule on with its defaults, `false` turns it off. */
140
140
  export interface RuleOptions {
141
- sitemap: NoOptions;
142
- "sitemap-host": NoOptions;
143
- "sitemap-duplicates": NoOptions;
144
- lastmod: {
145
- /** `loose`, `date` (`YYYY-MM-DD`) or `w3c`. Defaults to `w3c`. */
146
- format?: "loose" | "date" | "w3c";
147
- /** How a value is checked as a date. Defaults to `none`. */
148
- realDate?: "none" | "date-only" | "parseable";
149
- };
150
- "lastmod-future": { skewHours?: number };
151
- "sitemap-pages": {
152
- /** How a `<loc>` maps to a file. Defaults to `exact`. */
153
- paths?: "lookup" | "exact" | "exact-slash";
154
- /** Fail a page whose file is the same text as `404.html`. */
155
- notFoundCopy?: boolean;
156
- };
157
- "sitemap-indexable": { sources?: readonly IndexSource[] };
158
- "sitemap-coverage": {
159
- /** The files left out of the sitemap on purpose. Defaults to `sitemap-indexable`'s `sources`. */
160
- exclude?: readonly IndexSource[];
161
- };
162
- title: { max?: number; exactlyOne?: boolean; nonEmpty?: boolean };
163
- "title-unique": NoOptions;
164
- description: { min?: number; max?: number; exactlyOne?: boolean };
165
- "description-unique": NoOptions;
166
- h1: NoOptions;
167
- canonical: {
168
- exactlyOne?: boolean;
169
- /** `exact`, `exact-any-case` or `token`. */
170
- rel?: "token" | "exact" | "exact-any-case";
171
- /** Whether a canonical link with no `href` counts. */
172
- requireHref?: boolean;
173
- };
174
- lang: {
175
- /** The value `lang` must have. Set it to `false` to accept any value. Defaults to `"en"`. */
176
- lang?: string | false;
177
- };
178
- "open-graph": { url?: "loc" | "canonical" };
179
- "og-image-alt": NoOptions;
180
- "meta-conflicts": { keys?: readonly string[] };
181
- "og-image-host": NoOptions;
182
- "og-image-size-tags": { onHostOnly?: boolean };
183
- "og-image-file": {
184
- types?: readonly ("png" | "jpeg")[];
185
- /** How a PNG is told apart: `name` (bytes 1 to 3 spell `PNG`) or `signature` (all 8). */
186
- png?: "name" | "signature";
187
- };
188
- twitter: { card?: "summary_large_image" | "any" };
189
- "twitter-text": NoOptions;
190
- "json-ld-parse": NoOptions;
191
- "json-ld-present": NoOptions;
192
- "json-ld-context": NoOptions;
193
- "json-ld-ids": NoOptions;
194
- "json-ld-types": { types?: Readonly<Record<PathPattern, readonly string[]>> };
195
- "json-ld-breadcrumbs": {
196
- scope?: readonly PathPattern[];
197
- nodes?: "first" | "all";
198
- item?: readonly ("url" | "id")[];
199
- /** Whether a `BreadcrumbList` must have exactly that `@type`, whatever `typeArrays` says. */
200
- exactType?: boolean;
201
- /** What an `itemListElement` that isn't a list does: `skip`, or `iterate` it, failing when it can't. */
202
- nonArray?: "skip" | "iterate";
203
- };
204
- "json-ld-article": { scope?: readonly PathPattern[] };
205
- "json-ld-posting": { scope?: readonly PathPattern[] };
206
- "json-ld-organization": {
207
- /** The name no `Organization` may have, like `"Unframework"`. It has no default. */
208
- name: string;
209
- scope?: readonly PathPattern[];
210
- };
211
- "robots-sitemap": { match?: "loose" | "trimmed" | "anchored" | "exact" | "field" };
212
- "robots-crawlers": {
213
- crawlers?: readonly string[];
214
- allow?: false | "first" | "all";
215
- case?: "exact" | "insensitive";
216
- /** Where agent names are read: `groups`, or every `User-agent` line as it is, `lines`. */
217
- agents?: "groups" | "lines";
218
- /** Which lines end a group's run of agents: `all`, `directives` or `allow-disallow`. */
219
- groupRules?: "all" | "directives" | "allow-disallow";
220
- };
221
- "robots-no-disallow": { match?: "lines" | "groups" };
222
- "robots-wildcard": NoOptions;
223
- "robots-directives": NoOptions;
224
- llms: { first?: "line" | "non-empty"; title?: string; nonEmpty?: boolean };
225
- "llms-summary": { position?: "second" | "any"; nonEmpty?: boolean };
226
- "llms-links": {
227
- scope?: readonly PathPattern[];
228
- links?: readonly string[];
229
- form?: "markdown" | "parens";
230
- minPages?: number;
231
- };
232
- "llms-docs-section": NoOptions;
233
- "llms-full": NoOptions;
234
- "markdown-clean": { files?: readonly string[]; tables?: "line-start" | "anywhere" };
235
- "markdown-copy": { scope?: readonly PathPattern[] };
236
- "markdown-heading": { scope?: readonly PathPattern[]; ogTitle?: readonly PathPattern[] };
237
- "markdown-alternate": { scope?: readonly PathPattern[] };
238
- "redirects-permanent": {
239
- /** Whether a rule with no destination is left out. */
240
- needsDestination?: boolean;
241
- };
242
- "headers-noindex": { patterns?: readonly string[]; urls?: readonly string[] };
243
- "headers-duplicates": NoOptions;
244
- "headers-markdown": { scope?: readonly PathPattern[] };
245
- "not-found": NoOptions;
141
+ sitemap: NoOptions;
142
+ "sitemap-host": NoOptions;
143
+ "sitemap-duplicates": NoOptions;
144
+ lastmod: {
145
+ /** `loose`, `date` (`YYYY-MM-DD`) or `w3c`. Defaults to `w3c`. */
146
+ format?: "loose" | "date" | "w3c";
147
+ /** How a value is checked as a date. Defaults to `none`. */
148
+ realDate?: "none" | "date-only" | "parseable";
149
+ };
150
+ "lastmod-future": { skewHours?: number };
151
+ "sitemap-pages": {
152
+ /** How a `<loc>` maps to a file. Defaults to `exact`. */
153
+ paths?: "lookup" | "exact" | "exact-slash";
154
+ /** Fail a page whose file is the same text as `404.html`. */
155
+ notFoundCopy?: boolean;
156
+ };
157
+ "sitemap-indexable": { sources?: ReadonlyArray<IndexSource> };
158
+ "sitemap-coverage": {
159
+ /** The files left out of the sitemap on purpose. Defaults to `sitemap-indexable`'s `sources`. */
160
+ exclude?: ReadonlyArray<IndexSource>;
161
+ };
162
+ title: { max?: number; exactlyOne?: boolean; nonEmpty?: boolean };
163
+ "title-unique": NoOptions;
164
+ description: { min?: number; max?: number; exactlyOne?: boolean };
165
+ "description-unique": NoOptions;
166
+ h1: NoOptions;
167
+ canonical: {
168
+ exactlyOne?: boolean;
169
+ /** `exact`, `exact-any-case` or `token`. */
170
+ rel?: "token" | "exact" | "exact-any-case";
171
+ /** Whether a canonical link with no `href` counts. */
172
+ requireHref?: boolean;
173
+ };
174
+ lang: {
175
+ /** The value `lang` must have. Set it to `false` to accept any value. Defaults to `"en"`. */
176
+ lang?: string | false;
177
+ };
178
+ "open-graph": { url?: "loc" | "canonical" };
179
+ "og-image-alt": NoOptions;
180
+ "meta-conflicts": { keys?: ReadonlyArray<string> };
181
+ "og-image-host": NoOptions;
182
+ "og-image-size-tags": { onHostOnly?: boolean };
183
+ "og-image-file": {
184
+ types?: ReadonlyArray<"png" | "jpeg">;
185
+ /** How a PNG is told apart: `name` (bytes 1 to 3 spell `PNG`) or `signature` (all 8). */
186
+ png?: "name" | "signature";
187
+ };
188
+ twitter: { card?: "summary_large_image" | "any" };
189
+ "twitter-text": NoOptions;
190
+ "json-ld-parse": NoOptions;
191
+ "json-ld-present": NoOptions;
192
+ "json-ld-context": NoOptions;
193
+ "json-ld-ids": NoOptions;
194
+ "json-ld-types": { types?: Readonly<Record<PathPattern, ReadonlyArray<string>>> };
195
+ "json-ld-breadcrumbs": {
196
+ scope?: ReadonlyArray<PathPattern>;
197
+ nodes?: "first" | "all";
198
+ item?: ReadonlyArray<"url" | "id">;
199
+ /** Whether a `BreadcrumbList` must have exactly that `@type`, whatever `typeArrays` says. */
200
+ exactType?: boolean;
201
+ /** What an `itemListElement` that isn't a list does: `skip`, or `iterate` it, failing when it can't. */
202
+ nonArray?: "skip" | "iterate";
203
+ };
204
+ "json-ld-article": { scope?: ReadonlyArray<PathPattern> };
205
+ "json-ld-posting": { scope?: ReadonlyArray<PathPattern> };
206
+ "json-ld-organization": {
207
+ /** The name no `Organization` may have, like `"Unframework"`. It has no default. */
208
+ name: string;
209
+ scope?: ReadonlyArray<PathPattern>;
210
+ };
211
+ "robots-sitemap": { match?: "loose" | "trimmed" | "anchored" | "exact" | "field" };
212
+ "robots-crawlers": {
213
+ crawlers?: ReadonlyArray<string>;
214
+ allow?: false | "first" | "all";
215
+ case?: "exact" | "insensitive";
216
+ /** Where agent names are read: `groups`, or every `User-agent` line as it is, `lines`. */
217
+ agents?: "groups" | "lines";
218
+ /** Which lines end a group's run of agents: `all`, `directives` or `allow-disallow`. */
219
+ groupRules?: "all" | "directives" | "allow-disallow";
220
+ };
221
+ "robots-no-disallow": { match?: "lines" | "groups" };
222
+ "robots-wildcard": NoOptions;
223
+ "robots-directives": NoOptions;
224
+ llms: { first?: "line" | "non-empty"; title?: string; nonEmpty?: boolean };
225
+ "llms-summary": { position?: "second" | "any"; nonEmpty?: boolean };
226
+ "llms-links": {
227
+ scope?: ReadonlyArray<PathPattern>;
228
+ links?: ReadonlyArray<string>;
229
+ form?: "markdown" | "parens";
230
+ minPages?: number;
231
+ };
232
+ "llms-docs-section": NoOptions;
233
+ "llms-full": NoOptions;
234
+ "markdown-clean": { files?: ReadonlyArray<string>; tables?: "line-start" | "anywhere" };
235
+ "markdown-copy": { scope?: ReadonlyArray<PathPattern> };
236
+ "markdown-heading": { scope?: ReadonlyArray<PathPattern>; ogTitle?: ReadonlyArray<PathPattern> };
237
+ "markdown-alternate": { scope?: ReadonlyArray<PathPattern> };
238
+ "redirects-permanent": {
239
+ /** Whether a rule with no destination is left out. */
240
+ needsDestination?: boolean;
241
+ };
242
+ "headers-noindex": { patterns?: ReadonlyArray<string>; urls?: ReadonlyArray<string> };
243
+ "headers-duplicates": NoOptions;
244
+ "headers-markdown": { scope?: ReadonlyArray<PathPattern> };
245
+ "not-found": NoOptions;
246
246
  }
247
247
 
248
248
  export type RuleId = keyof RuleOptions;
249
249
 
250
250
  export type RuleSetting<Id extends RuleId> = RuleOptions[Id] extends NoOptions
251
- ? boolean
252
- : boolean | RuleOptions[Id];
251
+ ? boolean
252
+ : boolean | RuleOptions[Id];
253
253
 
254
254
  export type Rules = {
255
- [Id in Exclude<RuleId, "json-ld-organization">]?: RuleSetting<Id>;
255
+ [Id in Exclude<RuleId, "json-ld-organization">]?: RuleSetting<Id>;
256
256
  } & {
257
- /** It needs a `name`, so it takes `false` or its options, not `true`. */
258
- "json-ld-organization"?: false | RuleOptions["json-ld-organization"];
257
+ /** It needs a `name`, so it takes `false` or its options, not `true`. */
258
+ "json-ld-organization"?: false | RuleOptions["json-ld-organization"];
259
259
  };
260
260
 
261
261
  /** A page the checks read: a `<loc>` of the sitemap, or a path in `pages`, and its file. */
262
262
  export interface CheckedPage {
263
- /** The page's URL, like `https://uxfront.com/docs/`. */
264
- readonly loc: string;
265
- /** The URL's path, like `/docs/`. */
266
- readonly path: string;
267
- /** The file's path in `dist`, like `docs/index.html`. */
268
- readonly file: string;
269
- readonly html: string;
270
- /** The `content` of every `<meta>` whose `name` or `property` is `key`, in order. */
271
- meta(key: string): string[];
272
- /** The `<title>` elements' text, decoded and trimmed. */
273
- readonly titles: readonly string[];
274
- /** The JSON-LD nodes of the page, read as the profile's `nodes` says. */
275
- readonly nodes: readonly Record<string, unknown>[];
263
+ /** The page's URL, like `https://uxfront.com/docs/`. */
264
+ readonly loc: string;
265
+ /** The URL's path, like `/docs/`. */
266
+ readonly path: string;
267
+ /** The file's path in `dist`, like `docs/index.html`. */
268
+ readonly file: string;
269
+ readonly html: string;
270
+ /** The `content` of every `<meta>` whose `name` or `property` is `key`, in order. */
271
+ meta(key: string): Array<string>;
272
+ /** The `<title>` elements' text, decoded and trimmed. */
273
+ readonly titles: ReadonlyArray<string>;
274
+ /** The JSON-LD nodes of the page, read as the profile's `nodes` says. */
275
+ // oxlint-disable-next-line quality/no-unsafe-dictionary-type -- a page's JSON-LD can hold any schema.org type
276
+ readonly nodes: ReadonlyArray<Record<string, unknown>>;
276
277
  }
277
278
 
278
279
  /** A `<url>` of `sitemap.xml`. */
279
280
  export interface SitemapEntry {
280
- /** The decoded `<loc>`, or an empty string. */
281
- readonly loc: string;
282
- readonly lastmod: string | undefined;
281
+ /** The decoded `<loc>`, or an empty string. */
282
+ readonly loc: string;
283
+ readonly lastmod: string | undefined;
283
284
  }
284
285
 
285
286
  /** What an extra rule gets: the parsed site and a way to report problems. */
286
287
  export interface RuleContext {
287
- readonly site: string;
288
- readonly dist: string;
289
- readonly pages: readonly CheckedPage[];
290
- readonly sitemap: readonly SitemapEntry[];
291
- /** A file in `dist` as text, or `undefined` when it doesn't exist. */
292
- read: (file: string) => string | undefined;
293
- /** The headers `_headers` gives a URL, as Cloudflare matches it, with lower-case names. */
294
- headersFor: (url: string) => [name: string, value: string][];
295
- /** Reports a problem with a page's path or a file's name. */
296
- report: (target: string, message: string) => void;
288
+ readonly site: string;
289
+ readonly dist: string;
290
+ readonly pages: ReadonlyArray<CheckedPage>;
291
+ readonly sitemap: ReadonlyArray<SitemapEntry>;
292
+ /** A file in `dist` as text, or `undefined` when it doesn't exist. */
293
+ read: (file: string) => string | undefined;
294
+ /** The headers `_headers` gives a URL, as Cloudflare matches it, with lower-case names. */
295
+ headersFor: (url: string) => Array<[name: string, value: string]>;
296
+ /** Reports a problem with a page's path or a file's name. */
297
+ report: (target: string, message: string) => void;
297
298
  }
298
299
 
299
300
  /** A rule a site adds for itself, run and reported like the others. */
300
301
  export interface ExtraRule {
301
- id: string;
302
- check: (context: RuleContext) => void;
302
+ id: string;
303
+ check: (context: RuleContext) => void;
303
304
  }
304
305
 
305
306
  export interface CheckOptions {
306
- /** The production origin, like `https://uxfront.com`. */
307
- site: string;
308
- /** The build folder. */
309
- dist: string;
310
- /** Site paths to check, like `/` and `/docs/`. Defaults to every `<loc>` in `sitemap.xml`. */
311
- pages?: readonly string[];
312
- parse?: ParseProfile;
313
- rules?: Rules;
314
- extraRules?: readonly ExtraRule[];
315
- /** The time `lastmod-future` compares with. Defaults to now. */
316
- now?: Date;
307
+ /** The production origin, like `https://uxfront.com`. */
308
+ site: string;
309
+ /** The build folder. */
310
+ dist: string;
311
+ /** Site paths to check, like `/` and `/docs/`. Defaults to every `<loc>` in `sitemap.xml`. */
312
+ pages?: ReadonlyArray<string>;
313
+ parse?: ParseProfile;
314
+ rules?: Rules;
315
+ extraRules?: ReadonlyArray<ExtraRule>;
316
+ /** The time `lastmod-future` compares with. Defaults to now. */
317
+ now?: Date;
317
318
  }
318
319
 
319
320
  /** The options a config file exports: everything but `dist`, which the CLI takes. */
320
321
  export type SiteChecksConfig = Omit<CheckOptions, "dist">;
321
322
 
322
323
  export interface Problem {
323
- /** A page's path, or a file's name. */
324
- target: string;
325
- message: string;
324
+ /** A page's path, or a file's name. */
325
+ target: string;
326
+ message: string;
326
327
  }
327
328
 
328
329
  export interface RuleResult {
329
- id: string;
330
- problems: Problem[];
330
+ id: string;
331
+ problems: Array<Problem>;
331
332
  }
332
333
 
333
334
  export interface Report {
334
- /** Every rule that ran, in order, with its problems. */
335
- rules: RuleResult[];
336
- /** The number of pages checked. */
337
- pages: number;
338
- /** The number of problems in all rules. */
339
- problems: number;
335
+ /** Every rule that ran, in order, with its problems. */
336
+ rules: Array<RuleResult>;
337
+ /** The number of pages checked. */
338
+ pages: number;
339
+ /** The number of problems in all rules. */
340
+ problems: number;
340
341
  }
341
342
 
342
343
  /** The nine AI search and assistant crawlers `robots-crawlers` checks by default, like `GPTBot`. */
343
- export declare const AI_CRAWLERS: readonly string[];
344
+ export declare const AI_CRAWLERS: ReadonlyArray<string>;
344
345
 
345
346
  /** The 51 rule IDs, in order. */
346
- export declare const RULE_IDS: readonly RuleId[];
347
+ export declare const RULE_IDS: ReadonlyArray<RuleId>;
347
348
 
348
349
  /** The 20 rules that run when a config doesn't name them. */
349
- export declare const CORE_RULES: readonly RuleId[];
350
+ export declare const CORE_RULES: ReadonlyArray<RuleId>;
350
351
 
351
352
  /** The parsing profile a config gets when it doesn't set `parse`. */
352
353
  export declare const DEFAULT_PARSE: Readonly<Required<ParseProfile>>;