eaa-kit 0.6.0 → 0.9.0
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 +52 -15
- package/dist/astro/index.d.ts +1 -1
- package/dist/astro/index.js +1 -1
- package/dist/audit/runners/worker.js +1 -1
- package/dist/audit-CJDCQaFY.js +2 -0
- package/dist/{audit-e_uixhPG.js → audit-J2jeLo-y.js} +170 -241
- package/dist/{baseline-BscHfFSW.js → baseline-477B1CZ_.js} +1 -1
- package/dist/baseline-D9ihb-wk.js +2 -0
- package/dist/{baseline-D2qWmUC6.js → baseline-DrFh7joZ.js} +15 -4
- package/dist/baseline-wyJsSIFQ.js +127 -0
- package/dist/cache-D4dOIuOi.js +219 -0
- package/dist/{checklist-BtgkxMEa.js → checklist-Gx2g3LFC.js} +6 -6
- package/dist/cli/index.js +103 -147
- package/dist/{collect-Cu1q9NTB.js → collect-BJYk7_pJ.js} +1 -1
- package/dist/{command-CZKp9Wi_.js → command-BGGMf4vn.js} +35 -8
- package/dist/countries-DRTBubeE.js +25 -0
- package/dist/countries-Dg0BdytB.js +156 -0
- package/dist/coverage-GvaMpV64.js +3 -0
- package/dist/{coverage-BD2_CYns.js → coverage-zdzgSKjz.js} +4 -286
- package/dist/{crawl-BHkJmUkA.js → crawl-DwdqiljK.js} +5 -3
- package/dist/criteria-CnPJKGeb.js +286 -0
- package/dist/{load-vZdV_fD1.js → define-Ctf2uOEh.js} +47 -95
- package/dist/eleventy/index.d.ts +1 -1
- package/dist/eleventy/index.js +1 -1
- package/dist/entry-CjqjrUBY.js +174 -0
- package/dist/{html-Bmh7X_sM.js → html-whingnfj.js} +9 -5
- package/dist/index.d.ts +61 -5
- package/dist/index.js +3 -2
- package/dist/init-CPbFVMuk.js +293 -0
- package/dist/jsdom-BUYuVJJm.js +3 -0
- package/dist/{jsdom-CQar6OQS.js → jsdom-CsW_xVcA.js} +11 -12
- package/dist/{json-HJDgJp09.js → json-CyLmvF5P.js} +1 -1
- package/dist/{json-PNg6BeXp.js → json-SGCgxSPT.js} +4 -3
- package/dist/load-CH-ltdlq.js +99 -0
- package/dist/load-D7lBeOsq.js +2 -0
- package/dist/nuxt/index.d.ts +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/pages-DxY5Z0gl.js +300 -0
- package/dist/{playwright-C-miJP2b.js → playwright-ukCr_5o3.js} +1 -1
- package/dist/{pool-dkexq5xo.js → pool-B4tEUa2S.js} +6 -2
- package/dist/{project-MFrXcw1M.js → project-BLFdCbOq.js} +1 -1
- package/dist/{project-CzOnkLH6.js → project-v2PoRw70.js} +18 -1
- package/dist/{completeness-Dwq3CPB3.js → remediation-Bbs4KcX1.js} +72 -42
- package/dist/{render-CtsqR0k-.js → render-C6zYfaba.js} +69 -7
- package/dist/{result-DfUru6y_.js → result-B7_zVxAX.js} +1 -1
- package/dist/result-CRmjjoAA.js +2 -0
- package/dist/{review-CdMK2GpQ.js → review-Bz0fO9_I.js} +9 -1
- package/dist/{review-DIbOTmOM.js → review-a-2ghjQ5.js} +1 -1
- package/dist/{routes-CmdRUuOs.js → routes-CSctpS1P.js} +1 -1
- package/dist/{run-YiqyQA2b.d.ts → run-BK2blxMI.d.ts} +8 -0
- package/dist/{run-D7hdVXLA.js → run-DzVEOkiF.js} +6 -2
- package/dist/{sarif-BKvq_AUm.js → sarif-9BAgNiOa.js} +5 -3
- package/dist/site-BHMtf3q2.js +72 -0
- package/dist/start-DzOM0p6I.js +101 -0
- package/dist/statement/templates/at.de.md +14 -0
- package/dist/statement/templates/at.en.md +14 -0
- package/dist/statement/templates/be.de.md +148 -0
- package/dist/statement/templates/be.en.md +142 -0
- package/dist/statement/templates/be.fr.md +146 -0
- package/dist/statement/templates/be.nl.md +147 -0
- package/dist/statement/templates/ch.de.md +14 -0
- package/dist/statement/templates/ch.en.md +14 -0
- package/dist/statement/templates/cz.cs.md +137 -0
- package/dist/statement/templates/cz.en.md +139 -0
- package/dist/statement/templates/de.de.md +14 -0
- package/dist/statement/templates/de.en.md +14 -0
- package/dist/statement/templates/dk.da.md +141 -0
- package/dist/statement/templates/dk.en.md +141 -0
- package/dist/statement/templates/es.en.md +14 -0
- package/dist/statement/templates/es.es.md +15 -0
- package/dist/statement/templates/fi.en.md +139 -0
- package/dist/statement/templates/fi.fi.md +141 -0
- package/dist/statement/templates/fr.en.md +14 -0
- package/dist/statement/templates/fr.fr.md +15 -0
- package/dist/statement/templates/ie.en.md +144 -0
- package/dist/statement/templates/it.en.md +14 -0
- package/dist/statement/templates/it.it.md +15 -0
- package/dist/statement/templates/nl.en.md +14 -0
- package/dist/statement/templates/nl.nl.md +15 -0
- package/dist/statement/templates/pl.en.md +143 -0
- package/dist/statement/templates/pl.pl.md +144 -0
- package/dist/statement/templates/pt.en.md +142 -0
- package/dist/statement/templates/pt.pt.md +145 -0
- package/dist/statement/templates/se.en.md +139 -0
- package/dist/statement/templates/se.sv.md +142 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/watch-B2RoUbo0.js +122 -0
- package/dist/webpack/index.d.ts +1 -1
- package/dist/webpack/index.js +1 -1
- package/dist/{worksheet-eUjwYLxC.js → worksheet-B_kQ1pxq.js} +3 -2
- package/package.json +4 -3
- package/dist/audit-DK2StT1_.js +0 -2
- package/dist/coverage-7bQqWNfN.js +0 -2
- package/dist/init-BjKYttxc.js +0 -119
- package/dist/jsdom-DMvU2h-f.js +0 -3
- package/dist/load-Bc_xDGAh.js +0 -2
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { n as count } from "./text-BF1LHMiV.js";
|
|
2
|
+
import { c as nextStep, d as warn, l as note, o as fail, s as failWith } from "./command-BGGMf4vn.js";
|
|
3
|
+
import { i as holdsHtml, n as collectPages, r as emptyDirectoryHint, t as BuildDirectoryError } from "./collect-BJYk7_pJ.js";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
//#region src/cli/pages.ts
|
|
6
|
+
/**
|
|
7
|
+
* Collect the pages to audit, reporting to stderr on the way.
|
|
8
|
+
*
|
|
9
|
+
* Returns undefined when there is nothing to audit, having already explained
|
|
10
|
+
* why. Every caller turns that into exit 2 — a run that reached no verdict,
|
|
11
|
+
* which is not the same as a clean one.
|
|
12
|
+
*/
|
|
13
|
+
async function resolvePages(directory, options = {}) {
|
|
14
|
+
if (directory === void 0 && options.url === void 0) return resolveAutomatically(options);
|
|
15
|
+
if (options.url !== void 0) {
|
|
16
|
+
const crawled = await crawlPages(options.url, options);
|
|
17
|
+
if (!crawled) return void 0;
|
|
18
|
+
if (crawled.pages.length === 0) {
|
|
19
|
+
warn(`No pages could be fetched from ${options.url}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
pages: crawled.pages,
|
|
24
|
+
origin: crawled.origin,
|
|
25
|
+
label: options.url,
|
|
26
|
+
completeness: crawled.completeness
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const cwd = options.cwd ?? process.cwd();
|
|
30
|
+
const shown = options.label ?? directory;
|
|
31
|
+
const unreachable = [];
|
|
32
|
+
let pages;
|
|
33
|
+
try {
|
|
34
|
+
pages = await collectPages(directory, {
|
|
35
|
+
...options.include ? { include: options.include } : {},
|
|
36
|
+
...options.exclude ? { exclude: options.exclude } : {},
|
|
37
|
+
onUnreadable: (relativePath, reason) => unreachable.push({
|
|
38
|
+
location: relativePath,
|
|
39
|
+
reason
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
} catch (cause) {
|
|
43
|
+
if (!(cause instanceof BuildDirectoryError)) throw cause;
|
|
44
|
+
failWith(cause);
|
|
45
|
+
note(await emptyDirectoryHint(shown, cwd));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (pages.length === 0) {
|
|
49
|
+
if ((options.include !== void 0 || options.exclude !== void 0) && await holdsHtml(directory)) {
|
|
50
|
+
warn(`No page in ${shown} matched the filters, so nothing was audited.`);
|
|
51
|
+
if (options.include !== void 0) note(` --include ${options.include.join(" ")}`);
|
|
52
|
+
if (options.exclude !== void 0) note(` --exclude ${options.exclude.join(" ")}`);
|
|
53
|
+
note(" Patterns are relative to the audited directory, with POSIX separators.");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
warn(await emptyDirectoryHint(shown, cwd));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
warnUnmeasured(unreachable, "file", "readable");
|
|
60
|
+
return {
|
|
61
|
+
pages,
|
|
62
|
+
directory,
|
|
63
|
+
label: shown,
|
|
64
|
+
completeness: {
|
|
65
|
+
discovery: "directory",
|
|
66
|
+
collected: pages.length,
|
|
67
|
+
unreachable,
|
|
68
|
+
truncated: false
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Name what was missed, up to ten of them, and count the rest.
|
|
74
|
+
*
|
|
75
|
+
* Both collectors need this and neither may skip it: a file that could not be
|
|
76
|
+
* read and a URL that could not be fetched are pages with no verdict, and a run
|
|
77
|
+
* that mentioned neither would report the rest of the site as though it were
|
|
78
|
+
* the site. Ten because the point is to make the problem recognisable, and two
|
|
79
|
+
* hundred failures usually have the one reason the first few show — the count
|
|
80
|
+
* that follows is what says the list was cut.
|
|
81
|
+
*/
|
|
82
|
+
function warnUnmeasured(missed, noun, reached) {
|
|
83
|
+
if (missed.length === 0) return;
|
|
84
|
+
warn(`${count(missed.length, noun)} ${missed.length === 1 ? "was" : "were"} not ${reached}, and so not audited:`);
|
|
85
|
+
for (const item of missed.slice(0, 10)) note(` ${item.location} — ${item.reason}`);
|
|
86
|
+
if (missed.length > 10) note(` …and ${missed.length - 10} more`);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Fetch the pages of a running site, reporting what happened on the way.
|
|
90
|
+
*
|
|
91
|
+
* Returns undefined when the crawl could not start, which the caller turns into
|
|
92
|
+
* exit 2 — a run that reached no verdict, not a clean one.
|
|
93
|
+
*/
|
|
94
|
+
async function crawlPages(url, options) {
|
|
95
|
+
const { collapsedOnto, crawlSite, CrawlError, parseEntryUrl } = await import("./crawl-DwdqiljK.js");
|
|
96
|
+
let entry;
|
|
97
|
+
try {
|
|
98
|
+
entry = parseEntryUrl(url, options.allowRemote ?? false);
|
|
99
|
+
} catch (cause) {
|
|
100
|
+
if (cause instanceof CrawlError) {
|
|
101
|
+
failWith(cause);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
throw cause;
|
|
105
|
+
}
|
|
106
|
+
note(`Crawling ${entry.origin}…`);
|
|
107
|
+
const followed = await followEntry(entry, options);
|
|
108
|
+
if (followed === void 0) return void 0;
|
|
109
|
+
entry = followed.entry;
|
|
110
|
+
const result = await crawlSite(entry, {
|
|
111
|
+
...options.allowRemote ? { allowRemote: true } : {},
|
|
112
|
+
...options.ignoreRobots ? { ignoreRobots: true } : {},
|
|
113
|
+
...options.sitemap === void 0 ? {} : { sitemap: options.sitemap },
|
|
114
|
+
...options.maxPages === void 0 ? {} : { maxPages: options.maxPages },
|
|
115
|
+
...options.maxDepth === void 0 ? {} : { maxDepth: options.maxDepth },
|
|
116
|
+
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs },
|
|
117
|
+
...options.headers === void 0 ? {} : { headers: options.headers },
|
|
118
|
+
...options.fetchImpl === void 0 ? {} : { fetchImpl: options.fetchImpl }
|
|
119
|
+
});
|
|
120
|
+
if (result.pages.length === 0 && result.failures.length > 0) {
|
|
121
|
+
fail(`Could not fetch ${entry.href} (${result.failures[0]?.reason})`);
|
|
122
|
+
note(" Is the site running at that address?");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const found = result.discovery === "sitemap" ? "sitemap.xml and links" : "links";
|
|
126
|
+
note(`Found ${count(result.pages.length, "page")} from ${found}`);
|
|
127
|
+
const failed = result.failures.map((failure) => ({
|
|
128
|
+
location: failure.url,
|
|
129
|
+
reason: failure.reason
|
|
130
|
+
}));
|
|
131
|
+
warnUnmeasured(failed, "URL", "fetched");
|
|
132
|
+
if (result.truncated) warn(`Stopped at ${count(result.pages.length, "page")}; the site has more. Raise --max-pages to go further.`);
|
|
133
|
+
const collapsed = collapsedOnto(result);
|
|
134
|
+
const { hasPasswordField } = await import("./entry-CjqjrUBY.js");
|
|
135
|
+
const landedOn = collapsed[0]?.landedOn ?? "";
|
|
136
|
+
const signInForm = collapsed.length > 0 && result.pages.some((page) => page.absolutePath === landedOn && hasPasswordField(page.html));
|
|
137
|
+
if (collapsed.length > 0) {
|
|
138
|
+
if (signInForm) warn(`Every page requested answered at ${landedOn}, which has a password field on it: a sign-in page stands in front of the site.`);
|
|
139
|
+
else {
|
|
140
|
+
warn(`Every page requested answered at ${landedOn}, which is not where it was asked.`);
|
|
141
|
+
note(" A sign-in page in front of the site looks like this, and so does a one-page site.");
|
|
142
|
+
}
|
|
143
|
+
nextStep({
|
|
144
|
+
command: `eaa-kit audit --url ${entry.href} --basic-auth user:password`,
|
|
145
|
+
why: "or --header \"Cookie: …\" with a signed-in session; neither is written into a report"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
pages: result.pages,
|
|
150
|
+
origin: result.origin,
|
|
151
|
+
completeness: {
|
|
152
|
+
discovery: result.discovery,
|
|
153
|
+
collected: result.pages.length,
|
|
154
|
+
unreachable: [...failed, ...collapsed.map((redirect) => ({
|
|
155
|
+
location: redirect.requested,
|
|
156
|
+
reason: signInForm ? `answered at ${redirect.landedOn} instead, a sign-in page, so this page was not audited` : `answered at ${redirect.landedOn} instead, so this page was not audited`
|
|
157
|
+
}))],
|
|
158
|
+
truncated: result.truncated,
|
|
159
|
+
...followed.redirect === void 0 ? {} : { entryRedirect: followed.redirect }
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Where the crawl should start, once the entry's redirects are known.
|
|
165
|
+
*
|
|
166
|
+
* Returns undefined when the run must stop, having said why and what to type:
|
|
167
|
+
* a sign-in wall, or a redirect to another site nobody agreed to follow. Those
|
|
168
|
+
* are the two ways a run can audit something other than what it was sent to,
|
|
169
|
+
* and each one ends here rather than in a report about the wrong pages.
|
|
170
|
+
*/
|
|
171
|
+
async function followEntry(entry, options) {
|
|
172
|
+
const { describeSignIn, isSameSite, probeEntry } = await import("./entry-CjqjrUBY.js");
|
|
173
|
+
const { CrawlError, DEFAULT_REQUEST_TIMEOUT_MS, MAX_BODY_BYTES, parseEntryUrl } = await import("./crawl-DwdqiljK.js");
|
|
174
|
+
const probe = await probeEntry(entry, {
|
|
175
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS,
|
|
176
|
+
maxBodyBytes: MAX_BODY_BYTES,
|
|
177
|
+
...options.headers === void 0 ? {} : { headers: options.headers },
|
|
178
|
+
...options.fetchImpl === void 0 ? {} : { fetchImpl: options.fetchImpl }
|
|
179
|
+
});
|
|
180
|
+
if (probe.error !== void 0 && probe.hops.length === 0) return { entry };
|
|
181
|
+
if (probe.error !== void 0) {
|
|
182
|
+
fail(`${entry.href} did not settle on a page: ${probe.error}`);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (probe.signIn !== void 0) {
|
|
186
|
+
const at = probe.final.href;
|
|
187
|
+
fail(`${entry.href} is behind a sign-in wall: ${describeSignIn(probe.signIn, at)}.`);
|
|
188
|
+
note(options.headers !== void 0 ? " The credentials that were sent were not accepted, so nothing was audited." : probe.signIn === "http-401" || probe.signIn === "http-403" ? " Nothing was audited: there is no page to audit until the site lets the run in." : " eaa-kit will not audit a sign-in form as though it were the site, so nothing was audited.");
|
|
189
|
+
nextStep(probe.signIn === "http-401" ? {
|
|
190
|
+
command: `eaa-kit audit --url ${entry.href} --basic-auth user:password`,
|
|
191
|
+
why: "send the credentials it asks for; they are never written into a report"
|
|
192
|
+
} : {
|
|
193
|
+
command: `eaa-kit audit --url ${entry.href} --header "Cookie: <session>"`,
|
|
194
|
+
why: "send a signed-in session, copied from your browser; never written into a report"
|
|
195
|
+
});
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const destination = probe.final;
|
|
199
|
+
if (destination.origin === entry.origin) return { entry };
|
|
200
|
+
const statuses = probe.hops.slice(0, -1).map((hop) => hop.status);
|
|
201
|
+
const chain = `${statuses.join(" → ")}`;
|
|
202
|
+
const sameSite = isSameSite(entry, destination);
|
|
203
|
+
const mode = options.redirects ?? "ask";
|
|
204
|
+
let because;
|
|
205
|
+
if (mode !== "stop" && sameSite) because = "same-site";
|
|
206
|
+
else if (mode === "follow") because = "flag";
|
|
207
|
+
else if (mode === "ask") {
|
|
208
|
+
const confirm = options.confirm ?? terminalConfirm();
|
|
209
|
+
if (confirm !== void 0 && await confirm(`${entry.href} redirects to ${destination.href} (${chain}). Audit ${destination.href} instead?`)) because = "prompt";
|
|
210
|
+
}
|
|
211
|
+
if (because === void 0) {
|
|
212
|
+
fail(`${entry.href} redirects to ${destination.href} (${chain}), ${sameSite ? "the same site at another address" : "which is a different site"}, so nothing was audited.`);
|
|
213
|
+
note(mode === "stop" ? " --redirects stop was asked for, so the redirect was not followed." : " eaa-kit only follows a redirect to another site when you agree to it: otherwise the\n report would describe a site you did not name.");
|
|
214
|
+
const remote = options.allowRemote ? " --allow-remote" : "";
|
|
215
|
+
nextStep({
|
|
216
|
+
command: `eaa-kit audit --url ${destination.href}${remote}`,
|
|
217
|
+
why: "audit the address it leads to"
|
|
218
|
+
});
|
|
219
|
+
nextStep({
|
|
220
|
+
command: `eaa-kit audit --url ${entry.href}${remote} --redirects follow`,
|
|
221
|
+
why: "or follow it on every run, and have each report say so"
|
|
222
|
+
});
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
let target;
|
|
226
|
+
try {
|
|
227
|
+
target = parseEntryUrl(destination.href, options.allowRemote ?? false);
|
|
228
|
+
} catch (cause) {
|
|
229
|
+
if (cause instanceof CrawlError) {
|
|
230
|
+
fail(`${entry.href} redirects to ${destination.href}.`);
|
|
231
|
+
failWith(cause);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
throw cause;
|
|
235
|
+
}
|
|
236
|
+
warn(`${entry.href} redirects to ${target.href} (${chain}). Auditing ${target.href}; every report says so.`);
|
|
237
|
+
return {
|
|
238
|
+
entry: target,
|
|
239
|
+
redirect: {
|
|
240
|
+
requested: entry.href,
|
|
241
|
+
auditedFrom: target.href,
|
|
242
|
+
statuses,
|
|
243
|
+
followedBecause: because
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/** A yes/no question on the terminal, or nothing when there is no terminal to ask at. */
|
|
248
|
+
function terminalConfirm() {
|
|
249
|
+
if (process.stdin.isTTY !== true || process.stderr.isTTY !== true) return void 0;
|
|
250
|
+
return async (question) => {
|
|
251
|
+
const { createInterface } = await import("node:readline/promises");
|
|
252
|
+
const rl = createInterface({
|
|
253
|
+
input: process.stdin,
|
|
254
|
+
output: process.stderr
|
|
255
|
+
});
|
|
256
|
+
try {
|
|
257
|
+
const answer = await rl.question(`${question} (y/N) `);
|
|
258
|
+
return /^y(es)?$/i.test(answer.trim());
|
|
259
|
+
} finally {
|
|
260
|
+
rl.close();
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* No directory and no URL: work out what this project needs.
|
|
266
|
+
*
|
|
267
|
+
* The point is that `eaa-kit audit` on its own does something useful. Anything
|
|
268
|
+
* this starts is handed back as `cleanup` so the caller can stop it once the
|
|
269
|
+
* report is written.
|
|
270
|
+
*/
|
|
271
|
+
async function resolveAutomatically(options) {
|
|
272
|
+
const cwd = options.cwd ?? process.cwd();
|
|
273
|
+
const { autoDetectSource } = await import("./project-BLFdCbOq.js");
|
|
274
|
+
const detected = await autoDetectSource(cwd, {
|
|
275
|
+
...options.noBuild ? { noBuild: true } : {},
|
|
276
|
+
onStep: note
|
|
277
|
+
});
|
|
278
|
+
if (detected?.directory !== void 0) return resolvePages(detected.directory, {
|
|
279
|
+
...options,
|
|
280
|
+
label: path.relative(cwd, detected.directory) || "."
|
|
281
|
+
});
|
|
282
|
+
if (detected?.url !== void 0) {
|
|
283
|
+
const resolved = await resolvePages(void 0, {
|
|
284
|
+
...options,
|
|
285
|
+
url: detected.url
|
|
286
|
+
});
|
|
287
|
+
if (resolved === void 0) {
|
|
288
|
+
await detected.cleanup?.();
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
return {
|
|
292
|
+
...resolved,
|
|
293
|
+
...detected.cleanup ? { cleanup: detected.cleanup } : {}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
await detected?.cleanup?.();
|
|
297
|
+
warn(await emptyDirectoryHint("./dist", cwd));
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
export { resolvePages as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as isFile } from "./fs-BmPtmFke.js";
|
|
2
|
-
import {
|
|
2
|
+
import { c as pageUrl, d as runOptions, f as shapeResults, n as DEFAULT_TAGS, o as failedPage } from "./result-B7_zVxAX.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { stat } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as isFile } from "./fs-BmPtmFke.js";
|
|
2
|
-
import {
|
|
2
|
+
import { c as pageUrl, o as failedPage } from "./result-B7_zVxAX.js";
|
|
3
3
|
import { Worker } from "node:worker_threads";
|
|
4
4
|
import { availableParallelism } from "node:os";
|
|
5
5
|
//#region src/audit/runners/pool.ts
|
|
@@ -105,8 +105,12 @@ async function runPooledAudit(pages, options = {}) {
|
|
|
105
105
|
if (!entry) return auditHere(pages, runnerOptions);
|
|
106
106
|
return runWorkers(pages, runnerOptions, Math.min(workers, pages.length), entry);
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Audit in this process: the fallback for a run with no threads, and the sweep
|
|
110
|
+
* for pages the threads never reported on.
|
|
111
|
+
*/
|
|
108
112
|
async function auditHere(pages, options) {
|
|
109
|
-
const { runJsdomAudit } = await import("./jsdom-
|
|
113
|
+
const { runJsdomAudit } = await import("./jsdom-BUYuVJJm.js");
|
|
110
114
|
return runJsdomAudit(pages, options);
|
|
111
115
|
}
|
|
112
116
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as readPackageJson, t as autoDetectSource } from "./project-
|
|
1
|
+
import { i as readPackageJson, t as autoDetectSource } from "./project-v2PoRw70.js";
|
|
2
2
|
export { autoDetectSource, readPackageJson };
|
|
@@ -71,6 +71,14 @@ async function findBuildOutput(cwd) {
|
|
|
71
71
|
})).length > 0) return directory;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
/** Whether a folder has an HTML file directly in it, not only somewhere below. */
|
|
75
|
+
async function holdsTopLevelHtml(cwd) {
|
|
76
|
+
return (await glob(["*.html", "*.htm"], {
|
|
77
|
+
cwd,
|
|
78
|
+
onlyFiles: true,
|
|
79
|
+
dot: false
|
|
80
|
+
})).length > 0;
|
|
81
|
+
}
|
|
74
82
|
/**
|
|
75
83
|
* How to invoke a package-manager script on this platform.
|
|
76
84
|
*
|
|
@@ -232,7 +240,16 @@ async function autoDetectSource(cwd, options = {}) {
|
|
|
232
240
|
step(`${detected.framework.name} renders on a server and writes no HTML to disk`);
|
|
233
241
|
return { steps };
|
|
234
242
|
}
|
|
235
|
-
if (pkg === void 0)
|
|
243
|
+
if (pkg === void 0) {
|
|
244
|
+
if (detected === void 0 && await holdsTopLevelHtml(cwd)) {
|
|
245
|
+
step("Found hand-written HTML in this folder");
|
|
246
|
+
return {
|
|
247
|
+
directory: cwd,
|
|
248
|
+
steps
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
236
253
|
const scripts = pkg.scripts ?? {};
|
|
237
254
|
if (options.noBuild) return void 0;
|
|
238
255
|
if (scripts["build"] !== void 0) {
|
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
import { o as impactRank } from "./impact-luGCnN8F.js";
|
|
2
2
|
import { t as elementFingerprint } from "./fingerprint-BjYV_0F7.js";
|
|
3
|
-
import {
|
|
3
|
+
import { s as findingElements } from "./result-B7_zVxAX.js";
|
|
4
|
+
//#region src/audit/completeness.ts
|
|
5
|
+
/**
|
|
6
|
+
* Fold what the collector knew together with what the engine managed.
|
|
7
|
+
*
|
|
8
|
+
* The audits carry the second half: a page with an `error` was collected and
|
|
9
|
+
* then not audited, and is as unmeasured as one that was never fetched.
|
|
10
|
+
*/
|
|
11
|
+
function runCompleteness(audits, collection) {
|
|
12
|
+
const errored = audits.filter((audit) => audit.error).length;
|
|
13
|
+
const reused = audits.filter((audit) => audit.reused !== void 0).length;
|
|
14
|
+
return {
|
|
15
|
+
...collection,
|
|
16
|
+
audited: audits.length - errored - reused,
|
|
17
|
+
reused,
|
|
18
|
+
errored,
|
|
19
|
+
complete: collection.unreachable.length === 0 && !collection.truncated && errored === 0
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What a run reused, in one phrase, or nothing when it audited everything.
|
|
24
|
+
*
|
|
25
|
+
* Its own sentence rather than a clause in `missedParts`: nothing was missed
|
|
26
|
+
* here. The pages have verdicts; they were reached on an earlier day, on markup
|
|
27
|
+
* identical to today's, and a reader is entitled to know which.
|
|
28
|
+
*/
|
|
29
|
+
function reusedPart(completeness) {
|
|
30
|
+
if (completeness.reused === 0) return void 0;
|
|
31
|
+
const pages = completeness.reused === 1 ? "page" : "pages";
|
|
32
|
+
return `${completeness.reused} ${pages} unchanged since the last run, so the earlier result was reused`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Where a followed entry redirect took the run, in one sentence every format
|
|
36
|
+
* prints. Undefined when the run went where it was sent.
|
|
37
|
+
*/
|
|
38
|
+
function redirectPart(completeness) {
|
|
39
|
+
const redirect = completeness.entryRedirect;
|
|
40
|
+
if (redirect === void 0) return void 0;
|
|
41
|
+
return `${redirect.requested} redirected to ${redirect.auditedFrom} (${redirect.statuses.join(" → ")}; ${redirectReason(redirect)}), so this report is about ${redirect.auditedFrom}`;
|
|
42
|
+
}
|
|
43
|
+
/** Why a redirect was followed, in words. */
|
|
44
|
+
function redirectReason(redirect) {
|
|
45
|
+
return {
|
|
46
|
+
"same-site": "the same site at another address",
|
|
47
|
+
flag: "followed because --redirects follow was set",
|
|
48
|
+
prompt: "followed because it was approved when asked"
|
|
49
|
+
}[redirect.followedBecause];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* What was missed, as phrases both reports print.
|
|
53
|
+
*
|
|
54
|
+
* Separate clauses rather than one total, for the same reason the coverage
|
|
55
|
+
* parts are: a page that could not be fetched and a page that could not be
|
|
56
|
+
* parsed are different problems with different fixes, and summing them would
|
|
57
|
+
* name neither.
|
|
58
|
+
*/
|
|
59
|
+
function missedParts(completeness) {
|
|
60
|
+
const parts = [];
|
|
61
|
+
if (completeness.unreachable.length > 0) parts.push(`${completeness.unreachable.length} could not be reached`);
|
|
62
|
+
if (completeness.errored > 0) parts.push(`${completeness.errored} could not be audited`);
|
|
63
|
+
if (completeness.truncated) parts.push("the run stopped at its page limit");
|
|
64
|
+
return parts;
|
|
65
|
+
}
|
|
66
|
+
/** How the pages were found, in words, for the run details both reports show. */
|
|
67
|
+
function discoveryLabel(discovery) {
|
|
68
|
+
switch (discovery) {
|
|
69
|
+
case "directory": return "files in the build directory";
|
|
70
|
+
case "sitemap": return "sitemap.xml and links";
|
|
71
|
+
case "links": return "links from the entry page";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
4
74
|
/** Whether this element looks like one component rendered on many pages. */
|
|
5
75
|
function isShared(element) {
|
|
6
76
|
return element.pages.length >= 3;
|
|
@@ -296,44 +366,4 @@ function remediationFor(ruleId, framework) {
|
|
|
296
366
|
};
|
|
297
367
|
}
|
|
298
368
|
//#endregion
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Fold what the collector knew together with what the engine managed.
|
|
302
|
-
*
|
|
303
|
-
* The audits carry the second half: a page with an `error` was collected and
|
|
304
|
-
* then not audited, and is as unmeasured as one that was never fetched.
|
|
305
|
-
*/
|
|
306
|
-
function runCompleteness(audits, collection) {
|
|
307
|
-
const errored = audits.filter((audit) => audit.error).length;
|
|
308
|
-
return {
|
|
309
|
-
...collection,
|
|
310
|
-
audited: audits.length - errored,
|
|
311
|
-
errored,
|
|
312
|
-
complete: collection.unreachable.length === 0 && !collection.truncated && errored === 0
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* What was missed, as phrases both reports print.
|
|
317
|
-
*
|
|
318
|
-
* Separate clauses rather than one total, for the same reason the coverage
|
|
319
|
-
* parts are: a page that could not be fetched and a page that could not be
|
|
320
|
-
* parsed are different problems with different fixes, and summing them would
|
|
321
|
-
* name neither.
|
|
322
|
-
*/
|
|
323
|
-
function missedParts(completeness) {
|
|
324
|
-
const parts = [];
|
|
325
|
-
if (completeness.unreachable.length > 0) parts.push(`${completeness.unreachable.length} could not be reached`);
|
|
326
|
-
if (completeness.errored > 0) parts.push(`${completeness.errored} could not be audited`);
|
|
327
|
-
if (completeness.truncated) parts.push("the run stopped at its page limit");
|
|
328
|
-
return parts;
|
|
329
|
-
}
|
|
330
|
-
/** How the pages were found, in words, for the run details both reports show. */
|
|
331
|
-
function discoveryLabel(discovery) {
|
|
332
|
-
switch (discovery) {
|
|
333
|
-
case "directory": return "files in the build directory";
|
|
334
|
-
case "sitemap": return "sitemap.xml and links";
|
|
335
|
-
case "links": return "links from the entry page";
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
//#endregion
|
|
339
|
-
export { blindRules as a, isShared as c, remediationFor as i, issueTotals as l, missedParts as n, coverageParts as o, runCompleteness as r, groupIssues as s, discoveryLabel as t };
|
|
369
|
+
export { isShared as a, missedParts as c, runCompleteness as d, groupIssues as i, redirectPart as l, blindRules as n, issueTotals as o, coverageParts as r, discoveryLabel as s, remediationFor as t, reusedPart as u };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { n as IMPACT_LEVELS, o as impactRank } from "./impact-luGCnN8F.js";
|
|
2
2
|
import { c as nullable, h as string, l as number, m as safeParse, p as record, s as isoDateTime, t as array, u as object, y as withDefault } from "./schema-DJSF4K05.js";
|
|
3
|
-
import {
|
|
3
|
+
import { s as STATEMENT_LOCALES } from "./define-Ctf2uOEh.js";
|
|
4
4
|
import { n as isDirectory } from "./fs-BmPtmFke.js";
|
|
5
5
|
import { a as isoDate, i as escapeText, n as count, r as escapeAttribute, s as standardsReference } from "./text-BF1LHMiV.js";
|
|
6
6
|
import { t as TOOL_VERSION } from "./version-B3v4rNoG.js";
|
|
7
|
+
import { t as WCAG22_AA_CRITERIA } from "./criteria-CnPJKGeb.js";
|
|
7
8
|
import { readFile, readdir } from "node:fs/promises";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
@@ -18,7 +19,12 @@ import { fileURLToPath } from "node:url";
|
|
|
18
19
|
* it — nothing is emitted at all.
|
|
19
20
|
*/
|
|
20
21
|
var StatementError = class extends Error {
|
|
22
|
+
next;
|
|
21
23
|
name = "StatementError";
|
|
24
|
+
constructor(message, next) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.next = next;
|
|
27
|
+
}
|
|
22
28
|
};
|
|
23
29
|
//#endregion
|
|
24
30
|
//#region src/statement/evidence.ts
|
|
@@ -160,7 +166,10 @@ function summariseAuditReport(value, source = "audit report") {
|
|
|
160
166
|
const result = safeParse(reportSchema, value);
|
|
161
167
|
if (!result.success) throw new StatementError(`${source} is not an eaa-kit JSON report (${result.error.issues.map((issue) => `${issue.path.join(".") || "document"}: ${issue.message}`).slice(0, 5).join("; ")})`);
|
|
162
168
|
const report = result.data;
|
|
163
|
-
if (report.schemaVersion !== 2) throw new StatementError(`${source} has schemaVersion ${report.schemaVersion}; this version of eaa-kit reads 2
|
|
169
|
+
if (report.schemaVersion !== 2) throw new StatementError(`${source} has schemaVersion ${report.schemaVersion}; this version of eaa-kit reads 2`, {
|
|
170
|
+
command: `eaa-kit audit --format json --output ${source}`,
|
|
171
|
+
why: "write it again with this version"
|
|
172
|
+
});
|
|
164
173
|
const byRule = /* @__PURE__ */ new Map();
|
|
165
174
|
const rules = new Map(Object.entries(report.rules));
|
|
166
175
|
for (const page of report.pages) for (const violation of page.violations) {
|
|
@@ -198,7 +207,10 @@ async function readAuditReport(file, cwd = process.cwd()) {
|
|
|
198
207
|
try {
|
|
199
208
|
raw = await readFile(target, "utf8");
|
|
200
209
|
} catch {
|
|
201
|
-
throw new StatementError(`Could not read the audit report at ${file}
|
|
210
|
+
throw new StatementError(`Could not read the audit report at ${file}`, {
|
|
211
|
+
command: `eaa-kit audit --format json --output ${file}`,
|
|
212
|
+
why: "write the report the statement reads its barriers from"
|
|
213
|
+
});
|
|
202
214
|
}
|
|
203
215
|
let value;
|
|
204
216
|
try {
|
|
@@ -513,7 +525,7 @@ async function renderStatement(config, options = {}) {
|
|
|
513
525
|
const country = options.country ?? config.enforcement.country;
|
|
514
526
|
const locale = options.locale ?? defaultLocale(config);
|
|
515
527
|
const template = `${country.toLowerCase()}.${locale}`;
|
|
516
|
-
const markdown = tidy(renderTemplate(await loadTemplate(country, locale), buildScope(config, locale, options
|
|
528
|
+
const markdown = tidy(renderTemplate(await loadTemplate(country, locale), buildScope(config, locale, options)));
|
|
517
529
|
return {
|
|
518
530
|
markdown,
|
|
519
531
|
html: toHtmlDocument(markdown, {
|
|
@@ -543,7 +555,9 @@ function defaultLocale(config) {
|
|
|
543
555
|
* template, which keeps the template language trivial and puts the mapping
|
|
544
556
|
* somewhere that can be typechecked.
|
|
545
557
|
*/
|
|
546
|
-
function buildScope(config, locale,
|
|
558
|
+
function buildScope(config, locale, options) {
|
|
559
|
+
const audit = options.audit;
|
|
560
|
+
const review = options.review ? toReviewScope(options.review, locale) : void 0;
|
|
547
561
|
const issues = [...config.compliance.knownIssues.map((issue) => toIssueScope(issue, locale)), ...(audit?.findings ?? []).map((finding) => toFindingScope(finding, config.compliance.auditReason))];
|
|
548
562
|
return {
|
|
549
563
|
site: { ...config.site },
|
|
@@ -560,6 +574,8 @@ function buildScope(config, locale, audit) {
|
|
|
560
574
|
},
|
|
561
575
|
audit: audit ? toAuditScope(audit, locale) : void 0,
|
|
562
576
|
hasAudit: audit !== void 0,
|
|
577
|
+
review,
|
|
578
|
+
hasReview: review !== void 0,
|
|
563
579
|
hasKnownIssues: issues.length > 0,
|
|
564
580
|
hasNoKnownIssues: issues.length === 0
|
|
565
581
|
};
|
|
@@ -585,6 +601,39 @@ function toAuditScope(audit, locale) {
|
|
|
585
601
|
checkedOnFormatted: formatDate(audit.generatedAt.slice(0, 10), locale)
|
|
586
602
|
};
|
|
587
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* What a person's review contributes to the "preparation" section.
|
|
606
|
+
*
|
|
607
|
+
* One fact: how many of WCAG 2.2's success criteria at A and AA somebody
|
|
608
|
+
* checked by hand, and the last day one of those checks was recorded. It is
|
|
609
|
+
* there because the automated sentences beside it describe a run that cannot
|
|
610
|
+
* reach 34 of those 55 criteria, and a reader with no way to tell an unchecked
|
|
611
|
+
* criterion from an unchecked-by-machine one is being told less than the truth.
|
|
612
|
+
*
|
|
613
|
+
* What it never says is what the review concluded. A recorded result is a claim
|
|
614
|
+
* by a person, and the place for a claim in this document is the barrier list,
|
|
615
|
+
* where a person writes it in their own words. Turning `not-met` into a
|
|
616
|
+
* conformance sentence here would be this tool putting a legal position in
|
|
617
|
+
* somebody's mouth.
|
|
618
|
+
*
|
|
619
|
+
* Returns undefined for a record nobody has answered yet — the ordinary state
|
|
620
|
+
* of the file `eaa-kit checklist` has just written. Generating a worksheet is
|
|
621
|
+
* not doing the review, and the audit report refuses to count it for the same
|
|
622
|
+
* reason.
|
|
623
|
+
*/
|
|
624
|
+
function toReviewScope(record, locale) {
|
|
625
|
+
const answered = Object.values(record.criteria).filter((entry) => entry.result !== "unreviewed");
|
|
626
|
+
if (answered.length === 0) return void 0;
|
|
627
|
+
const latest = answered.map((entry) => entry.reviewedOn).filter((on) => on !== void 0).sort().at(-1);
|
|
628
|
+
return {
|
|
629
|
+
answered: answered.length,
|
|
630
|
+
total: WCAG22_AA_CRITERIA.length,
|
|
631
|
+
isSingle: answered.length === 1,
|
|
632
|
+
isPlural: answered.length > 1,
|
|
633
|
+
hasDate: latest !== void 0,
|
|
634
|
+
checkedOnFormatted: latest === void 0 ? "" : formatDate(latest, locale)
|
|
635
|
+
};
|
|
636
|
+
}
|
|
588
637
|
function toIssueScope(issue, locale) {
|
|
589
638
|
return {
|
|
590
639
|
...reasonScope(issue.reason),
|
|
@@ -639,12 +688,18 @@ function reasonScope(reason) {
|
|
|
639
688
|
* 20 August 2026, not August 20, 2026, in a European legal document.
|
|
640
689
|
*/
|
|
641
690
|
const DATE_LOCALES = {
|
|
691
|
+
cs: "cs-CZ",
|
|
692
|
+
da: "da-DK",
|
|
642
693
|
de: "de-AT",
|
|
643
694
|
en: "en-GB",
|
|
644
695
|
es: "es-ES",
|
|
696
|
+
fi: "fi-FI",
|
|
645
697
|
fr: "fr-FR",
|
|
646
698
|
it: "it-IT",
|
|
647
|
-
nl: "nl-NL"
|
|
699
|
+
nl: "nl-NL",
|
|
700
|
+
pl: "pl-PL",
|
|
701
|
+
pt: "pt-PT",
|
|
702
|
+
sv: "sv-SE"
|
|
648
703
|
};
|
|
649
704
|
/**
|
|
650
705
|
* 2026-08-20 becomes 20. August 2026 or 20 August 2026.
|
|
@@ -695,7 +750,14 @@ async function loadTemplate(country, locale) {
|
|
|
695
750
|
const templates = (await readdir(directory)).filter((entry) => entry.endsWith(".md")).map((entry) => entry.replace(/\.md$/, "")).sort();
|
|
696
751
|
const prefix = `${country.toLowerCase()}.`;
|
|
697
752
|
const forCountry = templates.filter((entry) => entry.startsWith(prefix)).map((entry) => entry.slice(prefix.length));
|
|
698
|
-
|
|
753
|
+
const first = forCountry[0];
|
|
754
|
+
throw new StatementError(first !== void 0 ? `No ${country} statement in ${locale}. ${country} has: ${forCountry.join(", ")}` : `No statement template for ${name}. Available: ${templates.join(", ")}`, first !== void 0 ? {
|
|
755
|
+
command: `eaa-kit statement --lang ${first}`,
|
|
756
|
+
why: `the ${country} statement in ${first}`
|
|
757
|
+
} : {
|
|
758
|
+
command: "eaa-kit countries",
|
|
759
|
+
why: "the countries a statement can be written for"
|
|
760
|
+
});
|
|
699
761
|
}
|
|
700
762
|
}
|
|
701
763
|
/**
|
|
@@ -336,4 +336,4 @@ function enClauses(tags) {
|
|
|
336
336
|
return [...clauses].sort();
|
|
337
337
|
}
|
|
338
338
|
//#endregion
|
|
339
|
-
export {
|
|
339
|
+
export { enClauses as a, pageUrl as c, runOptions as d, shapeResults as f, blindRulesInScope as i, ruleOutcomes as l, uniqueRuleOutcomes as m, DEFAULT_TAGS as n, failedPage as o, successCriteria as p, ENGINE_BLIND_RULES as r, findingElements as s, DEFAULT_PAGE_TIMEOUT_MS as t, runEngine as u };
|
|
@@ -35,7 +35,12 @@ const reviewSchema = object({
|
|
|
35
35
|
criteria: withDefault(record(entrySchema), () => ({}))
|
|
36
36
|
});
|
|
37
37
|
var ReviewError = class extends Error {
|
|
38
|
+
next;
|
|
38
39
|
name = "ReviewError";
|
|
40
|
+
constructor(message, next) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.next = next;
|
|
43
|
+
}
|
|
39
44
|
};
|
|
40
45
|
/**
|
|
41
46
|
* What the record says about one criterion, and whether it counts.
|
|
@@ -135,7 +140,10 @@ async function readReview(file, cwd = process.cwd()) {
|
|
|
135
140
|
try {
|
|
136
141
|
raw = await readFile(target, "utf8");
|
|
137
142
|
} catch {
|
|
138
|
-
throw new ReviewError(`Could not read the review record at ${file}
|
|
143
|
+
throw new ReviewError(`Could not read the review record at ${file}`, {
|
|
144
|
+
command: `eaa-kit checklist --record ${file}`,
|
|
145
|
+
why: "write the record and the worksheet that goes with it"
|
|
146
|
+
});
|
|
139
147
|
}
|
|
140
148
|
let value;
|
|
141
149
|
try {
|