allyward 1.0.0 → 1.2.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/chunks/{chunk-SFKKPIGE.mjs → chunk-5WE6XNNZ.mjs} +10 -10
- package/cli.mjs +29 -29
- package/package.json +2 -2
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{a as k,c as x,d as
|
|
2
|
+
import{a as k,c as x,d as S}from"./chunk-6W3JS6DP.mjs";import{a as B,c as j,d as q,g as N}from"./chunk-SNU37HWC.mjs";import{h as M}from"./chunk-7UDH5BXX.mjs";function E(a){let[e]=a.split(/\r?\n/,1);return e.length>200?`${e.slice(0,200)}\u2026`:e}var U={html:"html",htm:"html",vue:"vue",svelte:"svelte",jsx:"javascriptreact",tsx:"typescriptreact",astro:"astro",ts:"typescript"},ke=`**/*.{${Object.keys(U).join(",")}}`;function Ae(a){let e=/\.([^./]+)$/.exec(a)?.[1].toLowerCase();return e===void 0?void 0:U[e]}var _e=1;async function Ce(a,e,t,n,s){let o={languageId:e,text:t};if(!N(o))return;let i=await n(o);if(i.status!=="done"){let r=i.status==="paused"?i.reason:"The Check was interrupted";return{file:a,languageId:e,status:"failed",error:r,findings:[],needsReview:[],ignored:0}}return te(a,e,t,i.result,await s?.(i.result)??i.result.findings.map(()=>!1))}function te(a,e,t,n,s){let o=M(t),i=l=>{let g=o.length;for(;o[g-1]>l;)g--;return{line:g,column:l-o[g-1]+1,offset:l}},r=l=>({start:i(l.start),end:i(l.end)});return{file:a,languageId:e,status:"checked",findings:n.findings.map((l,g)=>({ruleId:l.ruleId,criteria:l.criteria,severity:l.severity,layer:"check",message:l.message,helpUrl:l.helpUrl,proof:"proven",range:r(l.range),...l.fix?{fix:l.fix.map(c=>({range:r(c.range),newText:c.newText}))}:{},baselined:s[g]})),needsReview:n.needsReview.map(l=>({criterion:l.criterion,reason:l.reason,...l.ruleId?{ruleId:l.ruleId,proof:"unproven"}:{},...l.range?{range:r(l.range)}:{}})),ignored:n.ignored??0}}var d={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",cyan:"\x1B[36m"};function Se(a=process.stdout,e=process.env){return e.NO_COLOR!==void 0&&e.NO_COLOR!==""?!1:e.FORCE_COLOR!==void 0&&e.FORCE_COLOR!=="0"?!0:!!a.isTTY}function Ee(a,e={}){let t=!!e.color,n=(o,i)=>t?`${o}${i}${d.reset}`:i;return[` ${n(d.dim,"\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E")} ${n(d.bold+d.cyan,"allyward")} ${n(d.dim,`v${a}`)}`,` ${n(d.dim,"\u2502")} ${n(d.green,"\u2593\u2593\u2593\u2593\u2593\u2593\u2593")} ${n(d.dim,"\u2502")} Local WCAG 2.2 AA accessibility checker`,` ${n(d.dim,"\u2502")} ${n(d.green,"\u2593 \u2714 \u2593")} ${n(d.dim,"\u2502")} ${n(d.dim,"HTML \xB7 React \xB7 Vue \xB7 Svelte \xB7 Angular \xB7 Astro")}`,` ${n(d.dim,"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F")} ${n(d.dim,"Offline \xB7 Zero telemetry \xB7 Zero workspace code execution")}`,""].join(`
|
|
3
|
+
`)}function Le(a,e={}){let t=!!e.color,n=(r,l)=>t?`${r}${l}${d.reset}`:l,s=[];t&&s.push(n(d.dim,"\u256D\u2500 ")+n(d.bold+d.cyan,"allyward")+n(d.dim," \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));for(let r of a.files){if(r.status==="failed"){s.push(n(d.bold+d.underline,r.file),` ${n(d.red,"could not be checked:")} ${r.error}`,"");continue}let l=r.findings.filter(c=>!c.baselined),g=r.needsReview.filter(c=>c.range);if(!(l.length===0&&g.length===0)){s.push(n(d.bold+d.underline,r.file));for(let c of l){let p=n(d.dim,`${c.range.start.line}:${c.range.start.column}`),y=c.severity==="error"?d.red:c.severity==="warning"?d.yellow:d.cyan,C=n(y,c.severity.padEnd(11)),ee=n(d.dim,`WCAG ${c.criteria[0]} ${c.ruleId}`);s.push(` ${p} ${C} ${c.message} ${ee}`,` ${n(d.dim,c.helpUrl)}`)}for(let c of g){let p=n(d.dim,`${c.range.start.line}:${c.range.start.column}`);s.push(` ${p} ${n(d.yellow,"needs review")} WCAG ${c.criterion}: ${c.reason}`)}s.push("")}}let o=a.summary,i=[`${o.files} ${o.files===1?"file":"files"} checked`,`${o.blocking} blocking ${o.blocking===1?"Finding":"Findings"}`,...o.findings>o.blocking?[`${o.findings-o.blocking} not blocking`]:[],...o.baselined||o.fixedSinceBaseline?[`${o.baselined} baselined (${o.fixedSinceBaseline} fixed since the baseline)`]:[],`${o.needsReview} Needs Review`,...o.failedFiles?[`${o.failedFiles} could not be checked`]:[]];if(t){let l=o.blocking===0&&o.failedFiles===0?n(d.bold+d.green,"\u2714"):n(d.bold+d.red,"\u2716");s.push(n(d.dim,"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),s.push(`${l} ${i.join(", ")}`)}else s.push(i.join(", "));return s.join(`
|
|
4
|
+
`)+`
|
|
5
|
+
`}var ae={error:"error",warning:"warning",information:"note"};function Pe(a,e){let t=i=>({startLine:i.start.line,startColumn:i.start.column,endLine:i.end.line,endColumn:i.end.column}),n=(i,r)=>[{physicalLocation:{artifactLocation:{uri:i},region:t(r)}}],s=new Map,o=a.files.flatMap(i=>[...i.findings.map(r=>(s.has(r.ruleId)||s.set(r.ruleId,{id:r.ruleId,helpUri:r.helpUrl,shortDescription:{text:r.message}}),{ruleId:r.ruleId,level:ae[r.severity],message:{text:`${r.message} (WCAG ${r.criteria.join(", ")})`},locations:n(i.file,r.range),...r.baselined?{suppressions:[{kind:"external",justification:"In the Allyward baseline"}]}:{}})),...i.needsReview.flatMap(r=>r.range?[{ruleId:r.ruleId??`needs-review/${r.criterion}`,level:"note",message:{text:`Needs Review, WCAG ${r.criterion}: ${r.reason}`},locations:n(i.file,r.range)}]:[]),...i.status==="failed"?[{ruleId:"allyward/not-checked",level:"error",message:{text:`Could not be checked: ${i.error}`},locations:[{physicalLocation:{artifactLocation:{uri:i.file}}}]}]:[]]);for(let i of o)s.has(i.ruleId)||s.set(i.ruleId,{id:i.ruleId,shortDescription:{text:i.message.text}});return{$schema:"https://json.schemastore.org/sarif-2.1.0.json",version:"2.1.0",runs:[{tool:{driver:{name:"Allyward",version:e,informationUri:"https://github.com/NotAisu/allyward",rules:[...s.values()]}},results:o}]}}var W={"23a2a8":"Image has non-empty accessible name","24afc2":"Important letter spacing in style attributes is wide enough","2779a5":"HTML page has non-empty title","2ee8b8":"Visible label is part of accessible name","2t702h":"Summary element has non-empty accessible name","307n5z":"Element with presentational children has no focusable content","46ca7f":"Element marked as decorative is not exposed","4b1c6c":"Iframe elements with identical accessible names have equivalent purpose","4e8ab6":"Element with role attribute has required states and properties","59796f":"Image button has non-empty accessible name","5b7ae0":"HTML page lang and xml:lang attributes have matching values","5c01ea":"ARIA state or property is permitted","5effbb":"Link in context is descriptive","5f99a7":"ARIA attribute is defined in WAI-ARIA","674b10":"Role attribute has valid value","6a7281":"ARIA state or property has valid value","6cfa84":"Element with aria-hidden has no content in sequential focus navigation","73f2c2":"Autocomplete attribute has valid value","78fd32":"Important line height in style attributes is wide enough","7d6734":"SVG element with explicit role has non-empty accessible name","80f0bf":"Audio or video element avoids automatically playing audio","8fc3b6":"Object element rendering non-text content has non-empty accessible name","97a4e1":"Button has non-empty accessible name","9e45ec":"Important word spacing in style attributes is wide enough",a25f45:"Headers attribute specified on a cell refers to cells in the same table element",afw4f7:"Text has minimum contrast",akn7bn:"Iframe with interactive elements is not excluded from tab-order",b33eff:"Orientation of the page is not restricted using CSS transforms",b4f0c3:"Meta viewport allows for zoom",b5c3f8:"HTML page has lang attribute",bc4a75:"ARIA required owned elements",bc659a:"Meta element has no refresh delay",bf051a:"HTML page lang attribute has valid language tag",c487ae:"Link has non-empty accessible name",cae760:"Iframe element has non-empty accessible name",cf77f2:"Bypass Blocks of Repeated Content",d0f69e:"Table header cell has assigned cells",de46e4:"Element with lang attribute has valid language tag",e086e5:"Form field has non-empty accessible name",e7aa44:"Audio element content has text alternative",eac66b:"Video element auditory content has accessible alternative",f51b46:"Video element auditory content has captions",ff89c9:"ARIA required context role",ffd0e9:"Heading has non-empty accessible name",kb1m8s:"ARIA global properties not used where prohibited",m6b1q3:"Menuitem has non-empty accessible name",qt1vmo:"Image accessible name is descriptive"},h=a=>[`jsx-a11y-x/${a}`,`astro/jsx-a11y/${a}`],m=a=>`vuejs-accessibility/${a}`,b=a=>`@angular-eslint/template/${a}`,u=a=>`svelte/${a}`,w=a=>`@html-eslint/${a}`,A=a=>`allyward/${a}`,G=[{rules:[...h("alt-text"),m("alt-text"),b("alt-text"),"image-alt"],message:"Images need a text alternative",why:"Screen reader users hear nothing, or just the file name, for an image without alt text and miss what it shows.",fix:'Add an alt attribute that says what the image conveys; use alt="" for a purely decorative image.',wcag:["1.1.1"],act:["23a2a8"],example:{bad:'<img src="chart.png">',good:'<img src="chart.png" alt="Sales rose 20% in May">'}},{rules:["input-image-alt"],message:"Image buttons need a text alternative",why:'An <input type="image"> is a button; without alt text screen readers cannot say what it does.',fix:"Add an alt attribute that names the action, not the picture.",wcag:["1.1.1","4.1.2"],act:["59796f"],example:{bad:'<input type="image" src="search.svg">',good:'<input type="image" src="search.svg" alt="Search">'}},{rules:["area-alt"],message:"Image map areas need a text alternative",why:"Each <area> with an href is a link; without alt text screen readers cannot say where it leads.",fix:"Add an alt attribute to every area that names its destination.",wcag:["2.4.4","4.1.2"],act:["c487ae"],example:{bad:`<map name="floors">
|
|
3
6
|
<area shape="rect" coords="0,0,80,40" href="/floor-1">
|
|
4
7
|
</map>`,good:`<map name="floors">
|
|
5
8
|
<area shape="rect" coords="0,0,80,40" href="/floor-1" alt="First floor">
|
|
@@ -18,7 +21,7 @@ import{a as k,c as x,d as I}from"./chunk-6W3JS6DP.mjs";import{c as M,d as j,g as
|
|
|
18
21
|
<map name="stores">
|
|
19
22
|
<area shape="rect" coords="0,0,80,40" href="/stores/berlin" alt="Berlin">
|
|
20
23
|
</map>
|
|
21
|
-
</div>`}},{rules:[...h("aria-props"),...h("aria-proptypes"),m("aria-props"),b("valid-aria"),"aria-valid-attr","aria-valid-attr-value",u("a11y_unknown_aria_attribute"),u("a11y_incorrect_aria_attribute_type"),...["boolean","id","idlist","integer","token","tokenlist","tristate"].map(
|
|
24
|
+
</div>`}},{rules:[...h("aria-props"),...h("aria-proptypes"),m("aria-props"),b("valid-aria"),"aria-valid-attr","aria-valid-attr-value",u("a11y_unknown_aria_attribute"),u("a11y_incorrect_aria_attribute_type"),...["boolean","id","idlist","integer","token","tokenlist","tristate"].map(a=>u(`a11y_incorrect_aria_attribute_type_${a}`))],message:"ARIA attributes must exist and have valid values",why:"Assistive technology ignores a misspelled ARIA attribute or a value of the wrong type, so the state it should convey is lost.",fix:"Fix the spelling and use a value of the type the attribute takes, such as true or false for aria-expanded, or an existing id for aria-controls.",wcag:["4.1.2"],act:["5f99a7","6a7281"],example:{bad:'<button type="button" aria-expanded="yes" aria-labeledby="menu-label">Menu</button>',good:'<button type="button" aria-expanded="false">Menu</button>'}},{rules:[...h("aria-role"),m("aria-role"),"aria-roles","aria-deprecated-role",u("a11y_unknown_role"),u("a11y_no_abstract_role"),w("no-abstract-roles")],message:"Roles must be valid, concrete ARIA roles",why:"An unknown, abstract or deprecated role is ignored or misread, so assistive technology cannot tell what the element is.",fix:"Use a non-abstract, non-deprecated role from WAI-ARIA, or a native element that already has the role.",wcag:["4.1.2"],act:["674b10"],example:{bad:'<div role="alrt">Saved</div>',good:'<div role="alert">Saved</div>'}},{rules:[...h("aria-unsupported-elements"),m("aria-unsupported-elements"),u("a11y_aria_attributes"),u("a11y_misplaced_role")],message:"Elements that are never rendered take no role or ARIA attributes",why:"<meta>, <html>, <script> and <style> are not exposed to assistive technology, so a role or ARIA attribute on them does nothing.",fix:"Remove the role and aria-* attributes, or move them to the element they were meant for.",wcag:["4.1.2"],example:{bad:'<meta name="description" content="Handmade shoes" aria-hidden="true">',good:'<meta name="description" content="Handmade shoes">'},overrides:{svelte:{bad:`<svelte:head>
|
|
22
25
|
<meta name="description" content="Handmade shoes" aria-hidden="true">
|
|
23
26
|
</svelte:head>`,good:`<svelte:head>
|
|
24
27
|
<meta name="description" content="Handmade shoes">
|
|
@@ -163,15 +166,12 @@ import{a as k,c as x,d as I}from"./chunk-6W3JS6DP.mjs";import{c as M,d as j,g as
|
|
|
163
166
|
@media (orientation: portrait) {
|
|
164
167
|
.gallery { grid-template-columns: 1fr; }
|
|
165
168
|
}
|
|
166
|
-
</style>`},overrides:Object.fromEntries(["jsx","vue","svelte","angular","astro"].map(
|
|
169
|
+
</style>`},overrides:Object.fromEntries(["jsx","vue","svelte","angular","astro"].map(a=>[a,{language:"css",file:"styles.css",bad:`@media (orientation: portrait) {
|
|
167
170
|
body { transform: rotate(90deg); }
|
|
168
171
|
}`,good:`@media (orientation: portrait) {
|
|
169
172
|
.gallery { grid-template-columns: 1fr; }
|
|
170
|
-
}`}]))},{rules:["avoid-inline-spacing"],message:"Inline text spacing must stay adjustable",why:"People with dyslexia or low vision override letter, word and line spacing with their own styles; !important in a style attribute blocks that.",fix:"Remove !important from letter-spacing, word-spacing and line-height in style attributes.",wcag:["1.4.12"],act:["24afc2","78fd32","9e45ec"],example:{bad:'<p style="letter-spacing: 0.05em !important">Terms</p>',good:'<p style="letter-spacing: 0.05em">Terms</p>'},overrides:{jsx:{bad:"<p ref={p => p?.style.setProperty('letter-spacing', '0.05em', 'important')}>Terms</p>",good:"<p style={{ letterSpacing: '0.05em' }}>Terms</p>"}}},{rules:[A("text-contrast")],message:"Text needs enough contrast with its background",why:"Low-contrast text is hard or impossible to read for people with low vision or colour deficiencies, and for anyone in bright light.",fix:"Darken the text or lighten the background (or the other way round) until the ratio reaches 4.5:1, or 3:1 for large text (24 px, or 18.66 px bold).",wcag:["1.4.3"],act:["afw4f7"],details:!0,example:{bad:'<p style="color: #999999; background-color: #ffffff">Free returns</p>',good:'<p style="color: #595959; background-color: #ffffff">Free returns</p>'}},{rules:[A("non-text-contrast")],message:"Text field boundaries need enough contrast",why:"People with low vision cannot find a field whose border and background barely differ from what surrounds it.",fix:"Give the border, or the field's background, a contrast of at least 3:1 against the surrounding background.",wcag:["1.4.11"],details:!0,example:{bad:'<input type="text" aria-label="Search" style="border: 1px solid #dddddd; background-color: #ffffff">',good:'<input type="text" aria-label="Search" style="border: 1px solid #767676; background-color: #ffffff">'}}];var
|
|
171
|
-
${
|
|
172
|
-
</template>`,svelte:
|
|
173
|
-
`)+`
|
|
174
|
-
`}var f=(t,e,n=`${e}s`)=>`${t} ${t===1?e:n}`;function le(t,e){let n=t.flatMap(o=>o.findings),a=o=>n.filter(i=>i.severity===o).length,s=t.filter(o=>o.status==="failed").length;return["## Summary","",`- ${f(n.length,"Finding")}: ${f(a("error"),"error")}, ${f(a("warning"),"warning")}, ${a("information")} information`,`- ${f(n.filter(o=>o.baselined).length,"baselined Finding")}`,`- ${f(e,"ignored Finding")}`,`- ${f(t.reduce((o,i)=>o+i.needsReview.length,0),"Needs Review entry","Needs Review entries")}`,...s?[`- ${f(s,"file")} could not be checked`]:[]]}function de(t){let e=t.flatMap(n=>n.findings.map(a=>({file:n.file,line:a.range.start.line,criterion:a.criteria[0],finding:a})));return e.length===0?["## Findings","","The Check found no Findings."]:["## Findings","",...V(e,["Location","Severity","Rule","Message"],({file:n,line:a,finding:s})=>[$(`${n}:${a}`),s.baselined?`${s.severity}, baselined`:s.severity,$(s.ruleId),v(s.message)+(s.criteria.length>1?` (also WCAG ${s.criteria.slice(1).join(", ")})`:"")])]}function ce(t){let e=t.flatMap(n=>n.needsReview.map(a=>({file:n.file,line:a.range?.start.line??0,criterion:a.criterion,entry:a})));return["## Needs Review (not Findings)","","These are not Findings: the Check cannot decide them from source code alone, so a person, an AI Review or a browser audit has to verify each one.",...e.length?["",...V(e,["Location","Rule","Reason"],({file:n,entry:a})=>[$(a.range?`${n}:${a.range.start.line}`:n),a.ruleId?$(a.ruleId):"",v(a.reason)])]:["","The Check left nothing to review."]]}function ue(t){let e=t.filter(n=>n.status==="failed").sort((n,a)=>z(n.file,a.file));return e.length===0?[]:["","## Files not checked","","| File | Reason |","| --- | --- |",...e.map(n=>`| ${$(n.file)} | ${v(n.error??"unknown")} |`)]}function he(t){let e=Object.keys(R),n=a=>{if(a.layer!=="Check")return"";let s=e.filter(i=>a.provenRules.some(r=>r.languageId===i)),o=e.filter(i=>!s.includes(i)).map(i=>R[i]);return s.length===0?"No Proven rule yet: Needs Review only":`Proven in ${s.map(i=>R[i]).join(", ")}${o.length?`; Needs Review only in ${o.join(", ")}`:""}`};return["## WCAG 2.2 AA coverage","","Every WCAG 2.2 level A and AA criterion (4.1.1 Parsing is obsolete) with the Layer that verifies it: the Check in code, an AI Review, a browser audit or a person. A Check criterion reports Findings only in the languages where it has a Proven rule; elsewhere its matches are Needs Review.","","| Criterion | Level | Layer | Check proof status per language |","| --- | --- | --- | --- |",...t.map(a=>`| [${a.criterion} ${v(a.name)}](${a.url}) | ${a.level} | ${a.layer} | ${n(a)} |`)]}function V(t,e,n){let a=o=>{let i=k.indexOf(o);return i===-1?k.length:i};return[...new Set(t.map(o=>o.criterion))].sort((o,i)=>a(o)-a(i)||o.localeCompare(i)).flatMap(o=>[`### ${o} ${v(x(o))}`,"",`| ${e.join(" | ")} |`,`| ${e.map(()=>"---").join(" | ")} |`,...t.filter(i=>i.criterion===o).sort((i,r)=>z(i.file,r.file)||i.line-r.line).map(i=>`| ${n(i).join(" | ")} |`),""]).slice(0,-1)}var z=(t,e)=>t<e?-1:t>e?1:0;function $(t){let e=t.replace(/[\r\n]+/g," ").replace(/\|/g,"\\|"),n="`".repeat(Math.max(0,...[...e.matchAll(/`+/g)].map(a=>a[0].length))+1);return n.length>1?`${n} ${e} ${n}`:`\`${e}\``}function v(t){return t.replace(/\s*[\r\n]+\s*/g," ").replace(/[\\`*_[\]<>|#~&!]/g,e=>`\\${e}`)}var X={html:"html",htm:"html",vue:"vue",svelte:"svelte",jsx:"javascriptreact",tsx:"typescriptreact",astro:"astro",ts:"typescript"},Fe=`**/*.{${Object.keys(X).join(",")}}`;function Me(t){let e=/\.([^./]+)$/.exec(t)?.[1].toLowerCase();return e===void 0?void 0:X[e]}var Ne=1;async function Ue(t,e,n,a,s){let o={languageId:e,text:n};if(!q(o))return;let i=await a(o);if(i.status!=="done"){let r=i.status==="paused"?i.reason:"The Check was interrupted";return{file:t,languageId:e,status:"failed",error:r,findings:[],needsReview:[],ignored:0}}return ge(t,e,n,i.result,s?.(i.result)??i.result.findings.map(()=>!1))}function ge(t,e,n,a,s){let o=F(n),i=l=>{let g=o.length;for(;o[g-1]>l;)g--;return{line:g,column:l-o[g-1]+1,offset:l}},r=l=>({start:i(l.start),end:i(l.end)});return{file:t,languageId:e,status:"checked",findings:a.findings.map((l,g)=>({ruleId:l.ruleId,criteria:l.criteria,severity:l.severity,layer:"check",message:l.message,helpUrl:l.helpUrl,proof:"proven",range:r(l.range),...l.fix?{fix:l.fix.map(c=>({range:r(c.range),newText:c.newText}))}:{},baselined:s[g]})),needsReview:a.needsReview.map(l=>({criterion:l.criterion,reason:l.reason,...l.ruleId?{ruleId:l.ruleId,proof:"unproven"}:{},...l.range?{range:r(l.range)}:{}})),ignored:a.ignored??0}}var d={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",cyan:"\x1B[36m"};function We(t=process.stdout,e=process.env){return e.NO_COLOR!==void 0&&e.NO_COLOR!==""?!1:e.FORCE_COLOR!==void 0&&e.FORCE_COLOR!=="0"?!0:!!t.isTTY}function Ge(t,e={}){let n=!!e.color,a=(o,i)=>n?`${o}${i}${d.reset}`:i;return[` ${a(d.dim,"\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E")} ${a(d.bold+d.cyan,"allyward")} ${a(d.dim,`v${t}`)}`,` ${a(d.dim,"\u2502")} ${a(d.green,"\u2593\u2593\u2593\u2593\u2593\u2593\u2593")} ${a(d.dim,"\u2502")} Local WCAG 2.2 AA accessibility checker`,` ${a(d.dim,"\u2502")} ${a(d.green,"\u2593 \u2714 \u2593")} ${a(d.dim,"\u2502")} ${a(d.dim,"HTML \xB7 React \xB7 Vue \xB7 Svelte \xB7 Angular \xB7 Astro")}`,` ${a(d.dim,"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F")} ${a(d.dim,"Offline \xB7 Zero telemetry \xB7 Zero workspace code execution")}`,""].join(`
|
|
175
|
-
`)}function De(t,e={}){let n=!!e.color,a=(r,l)=>n?`${r}${l}${d.reset}`:l,s=[];n&&s.push(a(d.dim,"\u256D\u2500 ")+a(d.bold+d.cyan,"allyward")+a(d.dim," \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));for(let r of t.files){if(r.status==="failed"){s.push(a(d.bold+d.underline,r.file),` ${a(d.red,"could not be checked:")} ${r.error}`,"");continue}let l=r.findings.filter(c=>!c.baselined),g=r.needsReview.filter(c=>c.range);if(!(l.length===0&&g.length===0)){s.push(a(d.bold+d.underline,r.file));for(let c of l){let p=a(d.dim,`${c.range.start.line}:${c.range.start.column}`),y=c.severity==="error"?d.red:c.severity==="warning"?d.yellow:d.cyan,C=a(y,c.severity.padEnd(11)),Q=a(d.dim,`WCAG ${c.criteria[0]} ${c.ruleId}`);s.push(` ${p} ${C} ${c.message} ${Q}`,` ${a(d.dim,c.helpUrl)}`)}for(let c of g){let p=a(d.dim,`${c.range.start.line}:${c.range.start.column}`);s.push(` ${p} ${a(d.yellow,"needs review")} WCAG ${c.criterion}: ${c.reason}`)}s.push("")}}let o=t.summary,i=[`${o.files} ${o.files===1?"file":"files"} checked`,`${o.blocking} blocking ${o.blocking===1?"Finding":"Findings"}`,...o.findings>o.blocking?[`${o.findings-o.blocking} not blocking`]:[],...o.baselined||o.fixedSinceBaseline?[`${o.baselined} baselined (${o.fixedSinceBaseline} fixed since the baseline)`]:[],`${o.needsReview} Needs Review`,...o.failedFiles?[`${o.failedFiles} could not be checked`]:[]];if(n){let l=o.blocking===0&&o.failedFiles===0?a(d.bold+d.green,"\u2714"):a(d.bold+d.red,"\u2716");s.push(a(d.dim,"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),s.push(`${l} ${i.join(", ")}`)}else s.push(i.join(", "));return s.join(`
|
|
173
|
+
}`}]))},{rules:["avoid-inline-spacing"],message:"Inline text spacing must stay adjustable",why:"People with dyslexia or low vision override letter, word and line spacing with their own styles; !important in a style attribute blocks that.",fix:"Remove !important from letter-spacing, word-spacing and line-height in style attributes.",wcag:["1.4.12"],act:["24afc2","78fd32","9e45ec"],example:{bad:'<p style="letter-spacing: 0.05em !important">Terms</p>',good:'<p style="letter-spacing: 0.05em">Terms</p>'},overrides:{jsx:{bad:"<p ref={p => p?.style.setProperty('letter-spacing', '0.05em', 'important')}>Terms</p>",good:"<p style={{ letterSpacing: '0.05em' }}>Terms</p>"}}},{rules:[A("text-contrast")],message:"Text needs enough contrast with its background",why:"Low-contrast text is hard or impossible to read for people with low vision or colour deficiencies, and for anyone in bright light.",fix:"Darken the text or lighten the background (or the other way round) until the ratio reaches 4.5:1, or 3:1 for large text (24 px, or 18.66 px bold).",wcag:["1.4.3"],act:["afw4f7"],details:!0,example:{bad:'<p style="color: #999999; background-color: #ffffff">Free returns</p>',good:'<p style="color: #595959; background-color: #ffffff">Free returns</p>'}},{rules:[A("non-text-contrast")],message:"Text field boundaries need enough contrast",why:"People with low vision cannot find a field whose border and background barely differ from what surrounds it.",fix:"Give the border, or the field's background, a contrast of at least 3:1 against the surrounding background.",wcag:["1.4.11"],details:!0,example:{bad:'<input type="text" aria-label="Search" style="border: 1px solid #dddddd; background-color: #ffffff">',good:'<input type="text" aria-label="Search" style="border: 1px solid #767676; background-color: #ffffff">'}}];var ne=["html","jsx","vue","svelte","angular","astro"];function Be(a){switch(a){case"javascriptreact":case"typescriptreact":return"jsx";case"vue":return"vue";case"svelte":return"svelte";case"angular":case"typescript":return"angular";case"astro":return"astro";default:return"html"}}var P=new Map;for(let a of G)for(let e of a.rules){if(P.has(e))throw new Error(`Rule ${e} has two docs entries`);P.set(e,a)}function je(){return[...P.keys()].sort()}function T(a){let e=P.get(a);if(e)return{message:e.message,why:e.why,fix:e.fix,details:e.details??!1,wcag:e.wcag.map(t=>({criterion:t,title:`WCAG ${t} ${x(t)}`,url:S(t)})),act:(e.act??[]).map(t=>({title:`ACT rule: ${W[t]}`,url:`https://www.w3.org/WAI/standards-guidelines/act/rules/${t}/`})),examples:Object.fromEntries(ne.map(t=>[t,ie(e,t)]))}}var D={html:"html",jsx:"jsx",vue:"vue",svelte:"svelte",angular:"html",astro:"astro"},re={vue:"index.html",svelte:"src/app.html",angular:"src/index.html"};function ie(a,e){let t=a.overrides?.[e];if(t)return{language:D[e],...t};let n=a.document?re[e]:void 0;if(n)return{language:"html",file:n,...a.example};let s=oe[e];return{language:D[e],bad:s(a.example.bad),good:s(a.example.good)}}var L=/\son([a-z]+)="(\w+)\(\)"/g,oe={html:a=>a,astro:a=>a,jsx:de,vue:a=>`<template>
|
|
174
|
+
${a.replace(L,' @$1="$2"').replace(/^/gm," ")}
|
|
175
|
+
</template>`,svelte:a=>a.replace(L," on$1={$2}"),angular:a=>a.replace(L,' ($1)="$2()"')},se={click:"onClick",keydown:"onKeyDown",mouseover:"onMouseOver",mouseout:"onMouseOut",focus:"onFocus",blur:"onBlur"},H={class:"className",for:"htmlFor",tabindex:"tabIndex",srclang:"srcLang",charset:"charSet",autocomplete:"autoComplete",autoplay:"autoPlay",colspan:"colSpan",usemap:"useMap","http-equiv":"httpEquiv"},le="area|br|col|embed|hr|img|input|link|meta|source|track|wbr";function de(a){return a.replace(L,(e,t,n)=>` ${se[t]}={${n}}`).replace(/\sstyle="([^"]*)"/g,(e,t)=>` style={{ ${ce(t)} }}`).replace(/(\s)([a-z-]+)(?=[\s=/>])/g,(e,t,n)=>H[n]?t+H[n]:e).replace(new RegExp(`<(${le})\\b([^>]*?)\\s*>`,"g"),"<$1$2 />")}function ce(a){return a.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(":");return`${t.trim().replace(/-([a-z])/g,(o,i)=>i.toUpperCase())}: '${n.join(":").trim()}'`}).join(", ")}var V={"1.1.1":{level:"A",layer:"Check"},"1.2.1":{level:"A",layer:"Person"},"1.2.2":{level:"A",layer:"Person"},"1.2.3":{level:"A",layer:"Person"},"1.2.4":{level:"AA",layer:"Person"},"1.2.5":{level:"AA",layer:"Person"},"1.3.1":{level:"A",layer:"Check"},"1.3.2":{level:"A",layer:"AI Review"},"1.3.3":{level:"A",layer:"AI Review"},"1.3.4":{level:"AA",layer:"Browser audit"},"1.3.5":{level:"AA",layer:"Check"},"1.4.1":{level:"A",layer:"AI Review"},"1.4.2":{level:"A",layer:"Browser audit"},"1.4.3":{level:"AA",layer:"Browser audit"},"1.4.4":{level:"AA",layer:"Browser audit"},"1.4.5":{level:"AA",layer:"Person"},"1.4.10":{level:"AA",layer:"Browser audit"},"1.4.11":{level:"AA",layer:"Browser audit"},"1.4.12":{level:"AA",layer:"Browser audit"},"1.4.13":{level:"AA",layer:"Browser audit"},"2.1.1":{level:"A",layer:"Check"},"2.1.2":{level:"A",layer:"Browser audit"},"2.1.4":{level:"A",layer:"Person"},"2.2.1":{level:"A",layer:"Person"},"2.2.2":{level:"A",layer:"Browser audit"},"2.3.1":{level:"A",layer:"Person"},"2.4.1":{level:"A",layer:"Browser audit"},"2.4.2":{level:"A",layer:"Check"},"2.4.3":{level:"A",layer:"Check"},"2.4.4":{level:"A",layer:"Check"},"2.4.5":{level:"AA",layer:"Person"},"2.4.6":{level:"AA",layer:"Check"},"2.4.7":{level:"AA",layer:"Browser audit"},"2.4.11":{level:"AA",layer:"Browser audit"},"2.5.1":{level:"A",layer:"Person"},"2.5.2":{level:"A",layer:"Browser audit"},"2.5.3":{level:"A",layer:"AI Review"},"2.5.4":{level:"A",layer:"Person"},"2.5.7":{level:"AA",layer:"Person"},"2.5.8":{level:"AA",layer:"Browser audit"},"3.1.1":{level:"A",layer:"Check"},"3.1.2":{level:"AA",layer:"Check"},"3.2.1":{level:"A",layer:"AI Review"},"3.2.2":{level:"A",layer:"AI Review"},"3.2.3":{level:"AA",layer:"Person"},"3.2.4":{level:"AA",layer:"Person"},"3.2.6":{level:"A",layer:"Person"},"3.3.1":{level:"A",layer:"AI Review"},"3.3.2":{level:"A",layer:"AI Review"},"3.3.3":{level:"AA",layer:"AI Review"},"3.3.4":{level:"AA",layer:"Person"},"3.3.7":{level:"A",layer:"Person"},"3.3.8":{level:"AA",layer:"Person"},"4.1.2":{level:"A",layer:"Check"},"4.1.3":{level:"AA",layer:"AI Review"}};var R={html:"HTML",javascriptreact:"JSX",typescriptreact:"TSX",vue:"Vue",svelte:"Svelte",angular:"Angular",typescript:"Angular (TS)",astro:"Astro"};function z(a){return R[a]??a}function X(){let a=V,e=j.rules,t=q,n=new Set,s=new Map;for(let[r,l]of Object.entries(t))for(let g of l??[]){n.add(`${r}:${g}`);let c=T(g);if(c)for(let p of c.wcag){let y=s.get(p.criterion)??[];y.push({languageId:r,languageLabel:z(r),ruleId:g}),s.set(p.criterion,y)}}let o=new Map;for(let[r,l]of Object.entries(e)){let g=T(r);if(!(!g||!l)){for(let[c,p]of Object.entries(l))if(!(!p?.proven||n.has(`${c}:${r}`)))for(let y of g.wcag){let C=o.get(y.criterion)??[];C.push({languageId:c,languageLabel:z(c),ruleId:r,correct:p.correct,wrong:p.wrong,lowerBound:p.lowerBound}),o.set(y.criterion,C)}}}let i=r=>[...r].sort((l,g)=>l.languageLabel.localeCompare(g.languageLabel)||l.ruleId.localeCompare(g.ruleId));return k.map(r=>{let l=a[r];if(!l)throw new Error(`Missing coverage assignment for WCAG ${r}`);let g=l.layer==="Check";return{criterion:r,name:x(r),url:S(r),level:l.level,layer:l.layer,provenRules:g?i(o.get(r)??[]):[],bestPracticeRules:g?i(s.get(r)??[]):[]}})}function Je(a){let e=X(),t=e.filter(r=>r.layer==="Check"),n=t.filter(r=>r.provenRules.length>0).length,s=a.files.filter(r=>r.status==="checked"),o=a.files.reduce((r,l)=>r+l.ignored,0);return[`# Allyward Check report: ${v(a.project)}`,"",`> This report lists what Allyward's automated Check found. Automated checking covers only part of WCAG 2.2 AA: ${n} of ${e.length} criteria are checked in code, with a Proven rule in at least one language, and ${t.length-n} more give Needs Review only; the rest need a browser audit or a person. It does not establish WCAG conformance or legal compliance and does not replace an audit.`,"","| | |","| --- | --- |",`| Project | ${v(a.project)} |`,`| Date | ${a.date.toISOString().slice(0,10)} |`,`| Allyward version | ${v(a.version)} |`,`| Files checked | ${s.length} |`,"",...he(a.files,o),"",...ge(a.files),"",...me(a.files),"","## Ignored Findings","",`${f(o,"Finding is","Findings are")} ignored by an \`allyward-ignore\` comment and not listed.`,...pe(a.files),"",...be(e)].join(`
|
|
176
176
|
`)+`
|
|
177
|
-
`}var
|
|
177
|
+
`}var f=(a,e,t=`${e}s`)=>`${a} ${a===1?e:t}`;function he(a,e){let t=a.flatMap(o=>o.findings),n=o=>t.filter(i=>i.severity===o).length,s=a.filter(o=>o.status==="failed").length;return["## Summary","",`- ${f(t.length,"Finding")}: ${f(n("error"),"error")}, ${f(n("warning"),"warning")}, ${n("information")} information`,`- ${f(t.filter(o=>o.baselined).length,"baselined Finding")}`,`- ${f(e,"ignored Finding")}`,`- ${f(a.reduce((o,i)=>o+i.needsReview.length,0),"Needs Review entry","Needs Review entries")}`,...s?[`- ${f(s,"file")} could not be checked`]:[]]}function ge(a){let e=a.flatMap(t=>t.findings.map(n=>({file:t.file,line:n.range.start.line,criterion:n.criteria[0],finding:n})));return e.length===0?["## Findings","","The Check found no Findings."]:["## Findings","",...J(e,["Location","Severity","Rule","Message"],({file:t,line:n,finding:s})=>[$(`${t}:${n}`),s.baselined?`${s.severity}, baselined`:s.severity,$(s.ruleId),v(s.message)+(s.criteria.length>1?` (also WCAG ${s.criteria.slice(1).join(", ")})`:"")])]}function me(a){let e=a.flatMap(t=>t.needsReview.map(n=>({file:t.file,line:n.range?.start.line??0,criterion:n.criterion,entry:n})));return["## Needs Review (not Findings)","","These are not Findings: the Check cannot decide them from source code alone, so a person, an AI Review or a browser audit has to verify each one.",...e.length?["",...J(e,["Location","Rule","Reason"],({file:t,entry:n})=>[$(n.range?`${t}:${n.range.start.line}`:t),n.ruleId?$(n.ruleId):"",v(n.reason)])]:["","The Check left nothing to review."]]}function pe(a){let e=a.filter(t=>t.status==="failed").sort((t,n)=>K(t.file,n.file));return e.length===0?[]:["","## Files not checked","","| File | Reason |","| --- | --- |",...e.map(t=>`| ${$(t.file)} | ${v(t.error??"unknown")} |`)]}function be(a){let e=Object.keys(R),t=n=>{if(n.layer!=="Check")return"";let s=e.filter(i=>n.provenRules.some(r=>r.languageId===i)),o=e.filter(i=>!s.includes(i)).map(i=>R[i]);return s.length===0?"No Proven rule yet: Needs Review only":`Proven in ${s.map(i=>R[i]).join(", ")}${o.length?`; Needs Review only in ${o.join(", ")}`:""}`};return["## WCAG 2.2 AA coverage","","Every WCAG 2.2 level A and AA criterion (4.1.1 Parsing is obsolete) with the Layer that verifies it: the Check in code, an AI Review, a browser audit or a person. A Check criterion reports Findings only in the languages where it has a Proven rule; elsewhere its matches are Needs Review.","","| Criterion | Level | Layer | Check proof status per language |","| --- | --- | --- | --- |",...a.map(n=>`| [${n.criterion} ${v(n.name)}](${n.url}) | ${n.level} | ${n.layer} | ${t(n)} |`)]}function J(a,e,t){let n=o=>{let i=k.indexOf(o);return i===-1?k.length:i};return[...new Set(a.map(o=>o.criterion))].sort((o,i)=>n(o)-n(i)||o.localeCompare(i)).flatMap(o=>[`### ${o} ${v(x(o))}`,"",`| ${e.join(" | ")} |`,`| ${e.map(()=>"---").join(" | ")} |`,...a.filter(i=>i.criterion===o).sort((i,r)=>K(i.file,r.file)||i.line-r.line).map(i=>`| ${t(i).join(" | ")} |`),""]).slice(0,-1)}var K=(a,e)=>a<e?-1:a>e?1:0;function $(a){let e=a.replace(/[\r\n]+/g," ").replace(/\|/g,"\\|"),t="`".repeat(Math.max(0,...[...e.matchAll(/`+/g)].map(n=>n[0].length))+1);return t.length>1?`${t} ${e} ${t}`:`\`${e}\``}function v(a){return a.replace(/\s*[\r\n]+\s*/g," ").replace(/[\\`*_[\]<>|#~&!]/g,e=>`\\${e}`)}function fe(a,e){let t=a.indexOf(">",e.range.start);return a.slice(e.range.start,t===-1?e.range.end:Math.min(t+1,e.range.start+500)).replace(/\s+/g," ").trim()}var I=a=>JSON.stringify([a.ruleId,a.file,a.element]);function Qe(a){let e=new Map;for(let t of a){let n=I(t),s=e.get(n)??{ruleId:t.ruleId,file:t.file,element:t.element,count:0};s.count++,e.set(n,s)}return{version:1,findings:[...e.values()].sort((t,n)=>t.file.localeCompare(n.file)||t.ruleId.localeCompare(n.ruleId)||t.element.localeCompare(n.element))}}function ve(a,e,t){let n=new Map(a.findings.map(i=>[I(i),i.count])),s=e.map(i=>{let r=n.get(I(i))??0;return r>0&&n.set(I(i),r-1),r>0}),o=a.findings.filter(i=>t.has(i.file)).reduce((i,r)=>i+(n.get(I(r))??0),0);return{baselined:s,fixed:o}}function Ze(a,e,t,n){return a?ve(a,n.map(s=>({ruleId:s.ruleId,file:e,element:fe(t,s)})),new Set).baselined:n.map(()=>!1)}function et(a){let e=JSON.parse(a);if(e.version!==1||!Array.isArray(e.findings)||!e.findings.every(t=>typeof t.ruleId=="string"&&typeof t.file=="string"&&typeof t.element=="string"&&Number.isInteger(t.count)&&t.count>0))throw new Error("not an Allyward baseline (version 1)");return{version:1,findings:e.findings.map(t=>({...t,ruleId:B(t.ruleId)}))}}async function tt(a,e){for(let t=a;;t=t.slice(0,t.lastIndexOf("/"))||"/"){if(await e(t))return t;if(t==="/"||!t.includes("/"))return a}}import{Worker as ye}from"worker_threads";var _=3,Z=3*6e4,Y=`${Z/6e4} minutes`,we=512,Q=class{constructor(e,t={}){let n=t.now??Date.now,{log:s}=t;this.breaker=new F(n,s);let o={script:e,firstLoadMs:t.firstLoadMs??15e3,breaker:this.breaker,now:n,log:s};this.typing=new O({...o,name:"typing worker",deadlineMs:t.deadlineMs??1e3}),this.background=new O({...o,name:"background worker",deadlineMs:t.backgroundDeadlineMs??1e4})}engines(){return this.breaker.engines()}check(e,t,n={},{background:s=!1}={}){return new Promise(o=>{let[i,r]=s?[this.background,this.typing]:[this.typing,this.background];i.drop(e),r.drop(e,{running:!0}),i.add({key:e,document:t,options:n,resolve:o})})}dispose(){this.typing.dispose(),this.background.dispose()}},F=class{constructor(e,t){this.now=e;this.log=t;this.failures=new Map;this.checkedLanguages=new Set}engines(){return{used:[...this.checkedLanguages].sort(),paused:[...this.failures].filter(([,e])=>e.length>=_).map(([e])=>e).sort()}}pausedReason(e){if(!((this.failures.get(e)?.length??0)<_))return`The ${e} engine failed ${_} times within ${Y} and is paused for this session`}recordUse(e){this.checkedLanguages.add(e)}recordFailure(e){let t=this.now(),n=[...(this.failures.get(e)??[]).filter(s=>t-s<=Z),t];this.failures.set(e,n),n.length===_&&this.log?.error(`${e} engine paused for this session after ${_} failures within ${Y}`)}},O=class{constructor(e){this.options=e;this.pending=new Map;this.loaded=new Set}drop(e,{running:t=!1}={}){this.pending.get(e)?.resolve({status:"dropped"}),this.pending.delete(e),t&&this.running?.request.key===e&&(this.running.request.resolve({status:"dropped"}),this.running.request={...this.running.request,resolve:()=>{}})}add(e){this.pending.set(e.key,e),this.next()}dispose(){this.running&&(clearTimeout(this.running.deadline),this.running.request.resolve({status:"dropped"})),this.running=void 0,this.pending.forEach(e=>e.resolve({status:"dropped"})),this.pending.clear(),this.worker?.terminate(),this.worker=void 0}next(){if(this.running)return;let[e]=this.pending.values();if(!e)return;this.pending.delete(e.key);let{breaker:t,name:n,log:s,now:o}=this.options,i=e.document.languageId,r=t.pausedReason(i);if(r!==void 0)return e.resolve({status:"paused",reason:r,deadlineExceeded:!1}),this.next();t.recordUse(i),this.worker??=this.spawn();let l=!this.loaded.has(i),g=l?this.options.firstLoadMs:this.options.deadlineMs,c=setTimeout(()=>{this.worker?.terminate(),this.worker=void 0,s?.warn(`${i} Check took longer than ${g} ms; the ${n} is restarted`),this.finish({status:"paused",reason:`The Check took longer than ${g} ms`,deadlineExceeded:!0},!1)},g);this.running={request:e,deadline:c,started:o(),firstLoad:l},this.worker.postMessage({document:e.document,options:e.options})}finish(e,t=e.status==="paused"){this.running&&(clearTimeout(this.running.deadline),t&&this.options.breaker.recordFailure(this.running.request.document.languageId),this.running.request.resolve(e),this.running=void 0,this.next())}spawn(){let{script:e,name:t,log:n,now:s}=this.options,o=new ye(e,{resourceLimits:{maxOldGenerationSizeMb:we}});this.loaded=new Set,n?.info(`The ${t} started`),o.on("message",r=>{if(o!==this.worker||!this.running)return;let{request:l,started:g,firstLoad:c}=this.running;this.loaded.add(l.document.languageId),"result"in r?this.finish({status:"done",result:r.result,durationMs:s()-g,firstLoad:c}):"parseError"in r?(n?.warn(`${l.document.languageId} Check paused: parse error at ${E(r.position)}`),this.finish({status:"paused",reason:r.parseError,deadlineExceeded:!1},!1)):(n?.error(`${l.document.languageId} engine failed: ${E(r.error)}`),this.finish({status:"paused",reason:r.error,deadlineExceeded:!1}))});let i=r=>{o===this.worker&&(this.worker=void 0,n?.error(E(this.running?`${this.running.request.document.languageId} engine: ${r}`:r)),this.finish({status:"paused",reason:r,deadlineExceeded:!1}))};return o.on("error",r=>i(`The ${t} crashed: ${r.message}`)),o.on("exit",r=>i(`The ${t} stopped (exit code ${r})`)),o.unref(),o}};export{E as a,Q as b,Be as c,je as d,T as e,ke as f,Ae as g,_e as h,Ce as i,Se as j,Ee as k,Le as l,Pe as m,Je as n,fe as o,Qe as p,ve as q,Ze as r,et as s,tt as t};
|