prunelle 0.1.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/llms.txt +23 -19
- package/package.json +8 -2
- package/src/a11y/declaration.ts +335 -0
- package/src/a11y/index.ts +446 -0
- package/src/a11y/rgaa-map.ts +184 -0
- package/src/attrs.ts +11 -3
- package/src/build/bundle.ts +80 -36
- package/src/build/client-entries.ts +3 -2
- package/src/build/client-plugin.ts +8 -4
- package/src/build/client-prune.ts +56 -6
- package/src/build/compile.ts +11 -9
- package/src/build/ecoindex.ts +229 -0
- package/src/build/index.ts +174 -108
- package/src/build/islands.ts +2 -2
- package/src/build/manifest.ts +66 -5
- package/src/build/output.ts +2 -2
- package/src/build/plugin-host.ts +91 -33
- package/src/build/precompress.ts +15 -2
- package/src/build/prerender.ts +128 -46
- package/src/build/report.ts +23 -2
- package/src/build/resolve.ts +8 -6
- package/src/build/routes.ts +175 -10
- package/src/build/static.ts +137 -39
- package/src/build/status-pages.ts +127 -0
- package/src/build/style-bundles.ts +526 -0
- package/src/cli/check-forms.ts +561 -0
- package/src/cli/check-links.ts +632 -0
- package/src/cli/check.ts +75 -20
- package/src/cli/commands.ts +85 -4
- package/src/cli/docs.ts +402 -0
- package/src/cli/inspect.ts +103 -14
- package/src/cli/mcp-tools.ts +490 -0
- package/src/cli/mcp.ts +205 -0
- package/src/cli/new.ts +2 -2
- package/src/cli/render.ts +421 -0
- package/src/cli/upgrade-names.ts +73 -13
- package/src/cli/upgrade.ts +137 -16
- package/src/compiler/analyze.ts +42 -9
- package/src/compiler/browser-globals.ts +140 -17
- package/src/compiler/cacheability.ts +636 -0
- package/src/compiler/compliance-rgaa.ts +508 -0
- package/src/compiler/compliance.ts +241 -289
- package/src/compiler/data-keys.ts +199 -192
- package/src/compiler/dev-source.ts +87 -0
- package/src/compiler/dom-attrs.ts +138 -65
- package/src/compiler/dom.ts +517 -442
- package/src/compiler/expr-context.ts +167 -57
- package/src/compiler/mistakes.ts +4 -1
- package/src/compiler/props.ts +87 -36
- package/src/compiler/scope.ts +400 -333
- package/src/compiler/server-only.ts +190 -151
- package/src/compiler/shared.ts +40 -12
- package/src/compiler/signal-reads.ts +6 -2
- package/src/compiler/ssr-prunelle-tags.ts +27 -14
- package/src/compiler/ssr.ts +218 -87
- package/src/dev/error-log.ts +151 -0
- package/src/dev/index.ts +84 -34
- package/src/dev/open-editor.ts +204 -0
- package/src/dev/protocol.ts +1 -0
- package/src/dev/reload.ts +5 -3
- package/src/dev/supervisor.ts +42 -25
- package/src/dev/watchers.ts +47 -11
- package/src/dom/action.ts +43 -20
- package/src/dom/attrs.ts +15 -3
- package/src/dom/extras.ts +28 -12
- package/src/dom/index.ts +26 -8
- package/src/dom/island.ts +35 -28
- package/src/dom/loop.ts +10 -9
- package/src/plugins/config.ts +8 -7
- package/src/plugins/index.ts +2 -2
- package/src/plugins/load.ts +26 -7
- package/src/plugins/order.ts +38 -1
- package/src/plugins/public.ts +5 -2
- package/src/plugins/services.ts +62 -0
- package/src/plugins/types.ts +32 -0
- package/src/reactivity/graph.ts +10 -0
- package/src/reactivity/index.ts +24 -16
- package/src/reactivity/selector.ts +31 -4
- package/src/reactivity/store.ts +45 -13
- package/src/server/action-protect.ts +198 -0
- package/src/server/action-registry.ts +1 -1
- package/src/server/action.ts +82 -27
- package/src/server/assets.ts +34 -2
- package/src/server/compress.ts +91 -9
- package/src/server/document.ts +25 -10
- package/src/server/errors.ts +303 -65
- package/src/server/form-schema.ts +343 -0
- package/src/server/health.ts +244 -0
- package/src/server/http.ts +128 -31
- package/src/server/index.ts +230 -260
- package/src/server/loader.ts +5 -0
- package/src/server/param-matchers.ts +112 -0
- package/src/server/plugin-host.ts +123 -88
- package/src/server/public.ts +3 -3
- package/src/server/rate-limit.ts +58 -35
- package/src/server/request-body.ts +1 -1
- package/src/server/route-cache.ts +423 -0
- package/src/server/route-table.ts +339 -8
- package/src/server/router.ts +125 -40
- package/src/server/routing.ts +196 -63
- package/src/server/security.ts +208 -32
- package/src/server/serve-handlers.ts +21 -7
- package/src/server/start.ts +60 -16
- package/src/server/static-dir.ts +61 -8
- package/src/server/stream.ts +41 -22
- package/src/ssr/context.ts +85 -3
- package/src/ssr/index.ts +130 -3
- package/src/ssr/region.ts +31 -19
- package/src/test/browser.ts +28 -13
- package/src/test/index.ts +97 -12
- package/src/ts-plugin/diagnostics.ts +505 -0
- package/src/ts-plugin/fixes.ts +364 -0
- package/src/ts-plugin/index.ts +194 -0
- package/templates/_shared/AGENTS.md +2 -2
- package/templates/_shared/mcp.json +11 -0
- package/templates/_shared/src/routes/legal.tsx +5 -0
- package/templates/_shared/tsconfig.json +5 -0
- package/templates/blog/prunelle.config.ts +1 -1
- package/templates/blog/src/routes/index.tsx +4 -0
- package/ts-plugin.cjs +4277 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
// Built-in `a11y()` plugin, axe-core + Chromium route auditor, RGAA 4.1 reporting, and accessibility declaration drafter.
|
|
2
|
+
|
|
3
|
+
import type { RouteManifestEntry } from '../build/manifest'
|
|
4
|
+
import type { PrunellePlugin } from '../plugins/types'
|
|
5
|
+
import type { BrowserTest, BrowserTestOptions } from '../test/browser'
|
|
6
|
+
import type { ComplianceStatus } from './declaration'
|
|
7
|
+
import type { RgaaCriterion } from './rgaa-map'
|
|
8
|
+
import { resolve } from 'node:path'
|
|
9
|
+
import { definePlugin } from '../plugins/config'
|
|
10
|
+
import { DEFAULT_DECLARATION_PATH, draftAccessibilityStatement } from './declaration'
|
|
11
|
+
import { rgaaCriteriaForAxeRule } from './rgaa-map'
|
|
12
|
+
|
|
13
|
+
export { DEFAULT_DECLARATION_PATH, draftAccessibilityStatement, inferComplianceStatus } from './declaration'
|
|
14
|
+
export type { AccessibilityDeclarationOptions, AccessibilityDeclarationResult, ComplianceStatus } from './declaration'
|
|
15
|
+
export { AXE_TO_RGAA, RGAA_CRITERIA, rgaaCriteriaForAxeRule } from './rgaa-map'
|
|
16
|
+
export type { RgaaCriterion } from './rgaa-map'
|
|
17
|
+
|
|
18
|
+
export type A11yImpact = 'minor' | 'moderate' | 'serious' | 'critical'
|
|
19
|
+
|
|
20
|
+
export interface A11yViolationNode {
|
|
21
|
+
target: string[]
|
|
22
|
+
html: string
|
|
23
|
+
failureSummary?: string | undefined
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface A11yViolation {
|
|
27
|
+
id: string
|
|
28
|
+
impact: A11yImpact
|
|
29
|
+
description: string
|
|
30
|
+
help: string
|
|
31
|
+
helpUrl: string
|
|
32
|
+
tags: string[]
|
|
33
|
+
rgaa: RgaaCriterion[]
|
|
34
|
+
nodes: A11yViolationNode[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface A11yRouteReport {
|
|
38
|
+
route: string
|
|
39
|
+
url: string
|
|
40
|
+
violations: A11yViolation[]
|
|
41
|
+
passes: number
|
|
42
|
+
incomplete: number
|
|
43
|
+
pageErrors: string[]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface A11yAuditReport {
|
|
47
|
+
root: string
|
|
48
|
+
auditedAt: string
|
|
49
|
+
axeVersion?: string | undefined
|
|
50
|
+
tags: string[]
|
|
51
|
+
routes: A11yRouteReport[]
|
|
52
|
+
totalViolations: number
|
|
53
|
+
totalNodes: number
|
|
54
|
+
ok: boolean
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface A11yAuditOptions {
|
|
58
|
+
/** Application root directory. */
|
|
59
|
+
root: string
|
|
60
|
+
/** Explicit route paths to audit (overrides manifest discovery). */
|
|
61
|
+
routes?: readonly string[] | undefined
|
|
62
|
+
/** Include static non-dynamic HTML routes even when prerendered routes exist. */
|
|
63
|
+
includeAllStatic?: boolean | undefined
|
|
64
|
+
/** Axe WCAG tags to evaluate (default: `['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']`). */
|
|
65
|
+
tags?: readonly string[] | undefined
|
|
66
|
+
/** Chrome or Chromium executable path (forwarded to `testBrowser`). */
|
|
67
|
+
browserPath?: string | undefined
|
|
68
|
+
/** Per-page navigation/evaluation timeout in milliseconds (default: 10000). */
|
|
69
|
+
timeout?: number | undefined
|
|
70
|
+
/** Optional custom `routesDir` (forwarded to `testBrowser`). */
|
|
71
|
+
routesDir?: string | undefined
|
|
72
|
+
/** Optional custom `outDir` (forwarded to `testBrowser`). */
|
|
73
|
+
outDir?: string | undefined
|
|
74
|
+
/** Optional plugin override (forwarded to `testBrowser`). */
|
|
75
|
+
plugins?: PrunellePlugin[] | undefined
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface A11yPluginOptions {
|
|
79
|
+
/** Default routes to audit when `--routes` is not given on the CLI. */
|
|
80
|
+
routes?: readonly string[] | undefined
|
|
81
|
+
/** Include static non-dynamic HTML routes alongside prerendered routes (default: `false`). */
|
|
82
|
+
includeAllStatic?: boolean | undefined
|
|
83
|
+
/** Axe WCAG tags to evaluate (default: `['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']`). */
|
|
84
|
+
tags?: readonly string[] | undefined
|
|
85
|
+
/** Default destination path for `prunelle a11y --draft` (default: `'src/routes/accessibilite.tsx'`). */
|
|
86
|
+
declarationPath?: string | undefined
|
|
87
|
+
/** Organization name pre-filled in `--draft` declarations. */
|
|
88
|
+
organization?: string | undefined
|
|
89
|
+
/** Contact email pre-filled in `--draft` declarations. */
|
|
90
|
+
contactEmail?: string | undefined
|
|
91
|
+
/** Chrome or Chromium executable path. */
|
|
92
|
+
browserPath?: string | undefined
|
|
93
|
+
/** Per-page timeout in milliseconds. */
|
|
94
|
+
timeout?: number | undefined
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const DEFAULT_AXE_TAGS: readonly string[] = ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']
|
|
98
|
+
|
|
99
|
+
const AXE_SPECIFIER = 'axe-core'
|
|
100
|
+
const CLI_KIT_SPECIFIER = '@kaynooo/cli-kit'
|
|
101
|
+
const COMPLIANCE_STATUSES = ['full', 'partial', 'none'] as const
|
|
102
|
+
|
|
103
|
+
interface LoadedAxe {
|
|
104
|
+
source: string
|
|
105
|
+
version?: string | undefined
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface RawAxeNode {
|
|
109
|
+
target?: unknown[] | undefined
|
|
110
|
+
html?: string | undefined
|
|
111
|
+
failureSummary?: string | undefined
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface RawAxeViolation {
|
|
115
|
+
id: string
|
|
116
|
+
impact?: string | null | undefined
|
|
117
|
+
description: string
|
|
118
|
+
help: string
|
|
119
|
+
helpUrl: string
|
|
120
|
+
tags: string[]
|
|
121
|
+
nodes: RawAxeNode[]
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface RawAxeRunResult {
|
|
125
|
+
violations: RawAxeViolation[]
|
|
126
|
+
passes: number
|
|
127
|
+
incomplete: number
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface TestBrowserModule {
|
|
131
|
+
testBrowser: (options: BrowserTestOptions) => Promise<BrowserTest>
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Keep axe-core and testBrowser dynamically resolved so neither axe-core nor playwright-core enters any client or server bundle.
|
|
135
|
+
async function loadAxe(): Promise<LoadedAxe> {
|
|
136
|
+
try {
|
|
137
|
+
const mod = await import(AXE_SPECIFIER) as { source?: unknown, version?: unknown, default?: { source?: unknown, version?: unknown } }
|
|
138
|
+
const source = typeof mod.source === 'string' ? mod.source : mod.default?.source
|
|
139
|
+
const version = typeof mod.version === 'string' ? mod.version : typeof mod.default?.version === 'string' ? mod.default.version : undefined
|
|
140
|
+
if (typeof source !== 'string' || source.length === 0)
|
|
141
|
+
throw new Error('axe-core did not expose a `source` script string')
|
|
142
|
+
return { source, version }
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (error instanceof Error && error.message.startsWith('axe-core did not'))
|
|
146
|
+
throw new Error(`prunelle: ${error.message}.`, { cause: error })
|
|
147
|
+
throw new Error('prunelle: a11y audit needs axe-core, and it is not installed: run `bun add -d axe-core`.', { cause: error })
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function loadTestBrowser(): Promise<TestBrowserModule['testBrowser']> {
|
|
152
|
+
const url = new URL('../test/browser.ts', import.meta.url).href
|
|
153
|
+
const mod = await import(url) as TestBrowserModule
|
|
154
|
+
return mod.testBrowser
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function normalizeRoutePath(raw: string): string {
|
|
158
|
+
const trimmed = raw.trim()
|
|
159
|
+
if (trimmed === '' || trimmed === '/')
|
|
160
|
+
return '/'
|
|
161
|
+
const withSlash = trimmed.startsWith('/') ? trimmed : `/${trimmed}`
|
|
162
|
+
return withSlash.length > 1 && withSlash.endsWith('/') ? withSlash.slice(0, -1) : withSlash
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function sortRoutes(routes: Iterable<string>): string[] {
|
|
166
|
+
return [...new Set([...routes].map(normalizeRoutePath))].sort((a, b) => {
|
|
167
|
+
if (a === '/')
|
|
168
|
+
return -1
|
|
169
|
+
if (b === '/')
|
|
170
|
+
return 1
|
|
171
|
+
return a.localeCompare(b)
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function collectPrerenderedHtmlRoutes(routes: readonly RouteManifestEntry[]): string[] {
|
|
176
|
+
const urls: string[] = []
|
|
177
|
+
for (const route of routes) {
|
|
178
|
+
if (route.prerendered === undefined)
|
|
179
|
+
continue
|
|
180
|
+
for (const [url, relFile] of Object.entries(route.prerendered)) {
|
|
181
|
+
if (relFile.endsWith('.html') || relFile.endsWith('.htm'))
|
|
182
|
+
urls.push(url)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return sortRoutes(urls)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async function discoverRoutesToAudit(
|
|
189
|
+
browser: BrowserTest,
|
|
190
|
+
explicitRoutes: readonly string[] | undefined,
|
|
191
|
+
includeAllStatic: boolean,
|
|
192
|
+
): Promise<string[]> {
|
|
193
|
+
if (explicitRoutes !== undefined && explicitRoutes.length > 0)
|
|
194
|
+
return sortRoutes(explicitRoutes)
|
|
195
|
+
|
|
196
|
+
const manifestRoutes = browser.app.manifest?.routes ?? []
|
|
197
|
+
const prerendered = collectPrerenderedHtmlRoutes(manifestRoutes)
|
|
198
|
+
if (prerendered.length > 0 && !includeAllStatic)
|
|
199
|
+
return prerendered
|
|
200
|
+
|
|
201
|
+
const discovered = new Set<string>(prerendered)
|
|
202
|
+
for (const route of manifestRoutes) {
|
|
203
|
+
if (route.path.includes(':') || route.path.includes('*'))
|
|
204
|
+
continue
|
|
205
|
+
const normalized = normalizeRoutePath(route.path)
|
|
206
|
+
if (discovered.has(normalized))
|
|
207
|
+
continue
|
|
208
|
+
const probe = await browser.app.get(normalized)
|
|
209
|
+
const contentType = (probe.headers.get('content-type') ?? '').toLowerCase()
|
|
210
|
+
if (probe.status < 400 && contentType.includes('text/html'))
|
|
211
|
+
discovered.add(normalized)
|
|
212
|
+
}
|
|
213
|
+
return sortRoutes(discovered)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function normalizeImpact(raw: string | null | undefined): A11yImpact {
|
|
217
|
+
if (raw === 'minor' || raw === 'moderate' || raw === 'serious' || raw === 'critical')
|
|
218
|
+
return raw
|
|
219
|
+
return 'moderate'
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function mapAxeViolations(rawViolations: readonly RawAxeViolation[]): A11yViolation[] {
|
|
223
|
+
return rawViolations.map(v => ({
|
|
224
|
+
id: v.id,
|
|
225
|
+
impact: normalizeImpact(v.impact),
|
|
226
|
+
description: v.description,
|
|
227
|
+
help: v.help,
|
|
228
|
+
helpUrl: v.helpUrl,
|
|
229
|
+
tags: Array.isArray(v.tags) ? v.tags.map(String) : [],
|
|
230
|
+
rgaa: rgaaCriteriaForAxeRule(v.id),
|
|
231
|
+
nodes: (Array.isArray(v.nodes) ? v.nodes : []).map(n => ({
|
|
232
|
+
target: Array.isArray(n.target) ? n.target.map(String) : [],
|
|
233
|
+
html: typeof n.html === 'string' ? n.html : '',
|
|
234
|
+
failureSummary: typeof n.failureSummary === 'string' && n.failureSummary.length > 0 ? n.failureSummary : undefined,
|
|
235
|
+
})),
|
|
236
|
+
}))
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async function auditRoute(browser: BrowserTest, route: string, axeSource: string, tags: readonly string[]): Promise<A11yRouteReport> {
|
|
240
|
+
const page = await browser.open(route)
|
|
241
|
+
try {
|
|
242
|
+
await page.evaluate(`${axeSource};\nvoid 0`)
|
|
243
|
+
const runExpr = `(() => {
|
|
244
|
+
if (!window.axe || typeof window.axe.run !== 'function')
|
|
245
|
+
throw new Error('axe-core failed to initialize in page');
|
|
246
|
+
return window.axe.run(document, ${JSON.stringify({ runOnly: { type: 'tag', values: tags } })}).then((res) => ({
|
|
247
|
+
violations: res.violations.map((v) => ({
|
|
248
|
+
id: v.id,
|
|
249
|
+
impact: v.impact || 'moderate',
|
|
250
|
+
description: v.description,
|
|
251
|
+
help: v.help,
|
|
252
|
+
helpUrl: v.helpUrl,
|
|
253
|
+
tags: v.tags,
|
|
254
|
+
nodes: v.nodes.map((n) => ({
|
|
255
|
+
target: Array.isArray(n.target) ? n.target.map(String) : [],
|
|
256
|
+
html: n.html || '',
|
|
257
|
+
failureSummary: n.failureSummary || undefined,
|
|
258
|
+
})),
|
|
259
|
+
})),
|
|
260
|
+
passes: res.passes.length,
|
|
261
|
+
incomplete: res.incomplete.length,
|
|
262
|
+
}));
|
|
263
|
+
})()`
|
|
264
|
+
const raw = await page.evaluate<RawAxeRunResult>(runExpr)
|
|
265
|
+
return {
|
|
266
|
+
route,
|
|
267
|
+
url: page.url,
|
|
268
|
+
violations: mapAxeViolations(raw.violations),
|
|
269
|
+
passes: raw.passes,
|
|
270
|
+
incomplete: raw.incomplete,
|
|
271
|
+
pageErrors: [...page.errors],
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
finally {
|
|
275
|
+
await page.close()
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Builds the app, serves it in Chromium via `testBrowser`, and runs `axe-core` on every discovered route. */
|
|
280
|
+
export async function auditAccessibility(options: A11yAuditOptions): Promise<A11yAuditReport> {
|
|
281
|
+
const root = resolve(options.root)
|
|
282
|
+
const tags = options.tags !== undefined && options.tags.length > 0 ? [...options.tags] : [...DEFAULT_AXE_TAGS]
|
|
283
|
+
const axe = await loadAxe()
|
|
284
|
+
const runBrowser = await loadTestBrowser()
|
|
285
|
+
|
|
286
|
+
const browser = await runBrowser({
|
|
287
|
+
root,
|
|
288
|
+
routesDir: options.routesDir,
|
|
289
|
+
outDir: options.outDir,
|
|
290
|
+
plugins: options.plugins,
|
|
291
|
+
browserPath: options.browserPath,
|
|
292
|
+
timeout: options.timeout,
|
|
293
|
+
})
|
|
294
|
+
|
|
295
|
+
try {
|
|
296
|
+
const routes = await discoverRoutesToAudit(browser, options.routes, options.includeAllStatic === true)
|
|
297
|
+
const results: A11yRouteReport[] = []
|
|
298
|
+
for (const route of routes)
|
|
299
|
+
results.push(await auditRoute(browser, route, axe.source, tags))
|
|
300
|
+
|
|
301
|
+
let totalViolations = 0
|
|
302
|
+
let totalNodes = 0
|
|
303
|
+
for (const r of results) {
|
|
304
|
+
totalViolations += r.violations.length
|
|
305
|
+
for (const v of r.violations)
|
|
306
|
+
totalNodes += v.nodes.length
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
root,
|
|
311
|
+
auditedAt: new Date().toISOString(),
|
|
312
|
+
axeVersion: axe.version,
|
|
313
|
+
tags,
|
|
314
|
+
routes: results,
|
|
315
|
+
totalViolations,
|
|
316
|
+
totalNodes,
|
|
317
|
+
ok: totalViolations === 0,
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
finally {
|
|
321
|
+
await browser.close()
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** Formats an `A11yAuditReport` into a human-readable CLI report grouped by route with RGAA 4.1 criteria. */
|
|
326
|
+
export function formatA11yReport(report: A11yAuditReport): string {
|
|
327
|
+
const lines: string[] = []
|
|
328
|
+
const routeWord = report.routes.length === 1 ? 'route' : 'routes'
|
|
329
|
+
lines.push(`prunelle a11y: audited ${report.routes.length} ${routeWord} (${report.tags.join(', ')})`)
|
|
330
|
+
|
|
331
|
+
if (report.routes.length === 0) {
|
|
332
|
+
lines.push(' No prerendered or static HTML routes were found to audit. Pass --routes /path to target specific routes.')
|
|
333
|
+
return lines.join('\n')
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
for (const r of report.routes) {
|
|
337
|
+
if (r.violations.length === 0) {
|
|
338
|
+
lines.push(` ✓ ${r.route} (0 violations, ${r.passes} passes)`)
|
|
339
|
+
continue
|
|
340
|
+
}
|
|
341
|
+
const routeNodes = r.violations.reduce((sum, v) => sum + v.nodes.length, 0)
|
|
342
|
+
const vWord = r.violations.length === 1 ? 'violation' : 'violations'
|
|
343
|
+
const eWord = routeNodes === 1 ? 'element' : 'elements'
|
|
344
|
+
lines.push(` ✗ ${r.route} (${r.violations.length} ${vWord}, ${routeNodes} ${eWord})`)
|
|
345
|
+
for (const v of r.violations) {
|
|
346
|
+
const rgaaSuffix = v.rgaa.length > 0 ? ` (RGAA ${v.rgaa.map(c => c.id).join(', ')})` : ''
|
|
347
|
+
const count = v.nodes.length
|
|
348
|
+
const elemWord = count === 1 ? 'element' : 'elements'
|
|
349
|
+
lines.push(` [${v.impact}] ${v.id}${rgaaSuffix} — ${count} ${elemWord}`)
|
|
350
|
+
lines.push(` ${v.help}`)
|
|
351
|
+
const firstSelector = v.nodes[0]?.target.join(' > ')
|
|
352
|
+
if (firstSelector)
|
|
353
|
+
lines.push(` Selector: ${firstSelector}`)
|
|
354
|
+
lines.push(` Help: ${v.helpUrl}`)
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if (report.ok) {
|
|
359
|
+
lines.push(`✓ 0 accessibility violations across ${report.routes.length} ${routeWord}.`)
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
const failedRoutes = report.routes.filter(r => r.violations.length > 0).length
|
|
363
|
+
lines.push(`✗ ${report.totalViolations} violation${report.totalViolations === 1 ? '' : 's'} across ${report.totalNodes} element${report.totalNodes === 1 ? '' : 's'} on ${failedRoutes} ${failedRoutes === 1 ? 'route' : 'routes'}.`)
|
|
364
|
+
}
|
|
365
|
+
return lines.join('\n')
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async function runA11yCommand(args: string[], root: string, pluginOptions: A11yPluginOptions): Promise<void> {
|
|
369
|
+
const { badUsage, Exit, parse } = await import(CLI_KIT_SPECIFIER) as typeof import('@kaynooo/cli-kit')
|
|
370
|
+
const { values, positionals } = parse(args, 'prunelle a11y [options]: audits rendered routes with axe-core + RGAA 4.1 and drafts an accessibility declaration', {
|
|
371
|
+
'routes': { type: 'string', description: 'comma-separated routes to audit (e.g. /,/about)' },
|
|
372
|
+
'all-static': { type: 'boolean', description: 'include static non-dynamic HTML routes alongside prerendered routes' },
|
|
373
|
+
'json': { type: 'boolean', description: 'print the audit report as JSON on stdout' },
|
|
374
|
+
'draft': { type: 'string', optional: { bare: '' }, description: 'write an editable RGAA 4.1.2 accessibility declaration page (default: src/routes/accessibilite.tsx)' },
|
|
375
|
+
'out': { type: 'string', description: 'destination path for --draft (default: src/routes/accessibilite.tsx)' },
|
|
376
|
+
'status': { type: 'string', choices: COMPLIANCE_STATUSES, description: 'override declaration compliance status (full, partial, none)' },
|
|
377
|
+
'org': { type: 'string', description: 'organization name written into --draft' },
|
|
378
|
+
'contact': { type: 'string', description: 'contact email written into --draft' },
|
|
379
|
+
'no-fail': { type: 'boolean', description: 'exit 0 even when accessibility violations are found' },
|
|
380
|
+
}, {
|
|
381
|
+
positionals: ['[dest]'],
|
|
382
|
+
exits: [
|
|
383
|
+
[0, 'no accessibility violations found (or --draft / --no-fail)'],
|
|
384
|
+
[1, 'one or more accessibility violations found, or audit failed'],
|
|
385
|
+
[2, 'a usage error'],
|
|
386
|
+
],
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
const rawRoutes = values.routes !== undefined
|
|
390
|
+
? values.routes.split(',').map(s => s.trim()).filter(Boolean)
|
|
391
|
+
: pluginOptions.routes
|
|
392
|
+
if (values.routes !== undefined && (rawRoutes === undefined || rawRoutes.length === 0))
|
|
393
|
+
return badUsage('--routes requires at least one route path, e.g. --routes /,/about')
|
|
394
|
+
|
|
395
|
+
const wantDraft = values.draft !== undefined
|
|
396
|
+
const draftDest = values.out
|
|
397
|
+
?? (values.draft !== undefined && values.draft !== '' ? values.draft : undefined)
|
|
398
|
+
?? positionals[0]
|
|
399
|
+
?? pluginOptions.declarationPath
|
|
400
|
+
?? DEFAULT_DECLARATION_PATH
|
|
401
|
+
|
|
402
|
+
const report = await auditAccessibility({
|
|
403
|
+
root,
|
|
404
|
+
routes: rawRoutes,
|
|
405
|
+
includeAllStatic: values['all-static'] === true || pluginOptions.includeAllStatic === true,
|
|
406
|
+
tags: pluginOptions.tags,
|
|
407
|
+
browserPath: pluginOptions.browserPath,
|
|
408
|
+
timeout: pluginOptions.timeout,
|
|
409
|
+
})
|
|
410
|
+
|
|
411
|
+
let drafted: ReturnType<typeof draftAccessibilityStatement> | undefined
|
|
412
|
+
if (wantDraft) {
|
|
413
|
+
drafted = draftAccessibilityStatement({
|
|
414
|
+
root,
|
|
415
|
+
outPath: draftDest,
|
|
416
|
+
report,
|
|
417
|
+
organization: values.org ?? pluginOptions.organization,
|
|
418
|
+
contactEmail: values.contact ?? pluginOptions.contactEmail,
|
|
419
|
+
status: values.status as ComplianceStatus | undefined,
|
|
420
|
+
})
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (values.json === true) {
|
|
424
|
+
console.log(JSON.stringify(drafted !== undefined ? { ...report, declaration: { path: drafted.relativePath, status: drafted.status } } : report, null, 2))
|
|
425
|
+
if (!report.ok && !wantDraft && values['no-fail'] !== true)
|
|
426
|
+
process.exitCode = 1
|
|
427
|
+
return
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
console.log(formatA11yReport(report))
|
|
431
|
+
if (drafted !== undefined)
|
|
432
|
+
console.log(`prunelle a11y: drafted RGAA 4.1.2 accessibility declaration at ${drafted.relativePath} (${drafted.status})`)
|
|
433
|
+
|
|
434
|
+
if (!report.ok && !wantDraft && values['no-fail'] !== true)
|
|
435
|
+
throw new Exit(`found ${report.totalViolations} accessibility violation${report.totalViolations === 1 ? '' : 's'}`, 1)
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** Built-in accessibility plugin: registers `prunelle a11y` (axe-core Chromium audit + RGAA 4.1 mapping + declaration draft). */
|
|
439
|
+
export function a11y(options: A11yPluginOptions = {}): PrunellePlugin {
|
|
440
|
+
return definePlugin({
|
|
441
|
+
name: 'prunelle:a11y',
|
|
442
|
+
commands: {
|
|
443
|
+
a11y: (args, root) => runA11yCommand(args, root, options),
|
|
444
|
+
},
|
|
445
|
+
})
|
|
446
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// Mapping between axe-core rule identifiers and French RGAA 4.1 criteria.
|
|
2
|
+
|
|
3
|
+
export interface RgaaCriterion {
|
|
4
|
+
/** RGAA 4.1 criterion identifier (e.g. `'1.1'`, `'3.2'`, `'11.1'`). */
|
|
5
|
+
id: string
|
|
6
|
+
/** RGAA 4.1 theme number (1–13). */
|
|
7
|
+
theme: number
|
|
8
|
+
/** Short French RGAA 4.1 criterion title. */
|
|
9
|
+
label: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Subset of official French RGAA 4.1 criteria detectable by automated axe-core checks. */
|
|
13
|
+
export const RGAA_CRITERIA: Readonly<Record<string, RgaaCriterion>> = {
|
|
14
|
+
'1.1': { id: '1.1', theme: 1, label: 'Alternative textuelle pour chaque image porteuse d\'information' },
|
|
15
|
+
'1.2': { id: '1.2', theme: 1, label: 'Image de décoration ignorée par les technologies d\'assistance' },
|
|
16
|
+
'1.3': { id: '1.3', theme: 1, label: 'Pertinence de l\'alternative textuelle des images' },
|
|
17
|
+
'2.1': { id: '2.1', theme: 2, label: 'Titre de chaque cadre (iframe)' },
|
|
18
|
+
'2.2': { id: '2.2', theme: 2, label: 'Pertinence du titre de chaque cadre' },
|
|
19
|
+
'3.1': { id: '3.1', theme: 3, label: 'Information non donnée uniquement par la couleur' },
|
|
20
|
+
'3.2': { id: '3.2', theme: 3, label: 'Contraste suffisant entre texte et arrière-plan' },
|
|
21
|
+
'4.1': { id: '4.1', theme: 4, label: 'Transcription textuelle ou audiodescription des médias temporels' },
|
|
22
|
+
'4.10': { id: '4.10', theme: 4, label: 'Contrôle des sons déclenchés automatiquement' },
|
|
23
|
+
'5.1': { id: '5.1', theme: 5, label: 'Résumé des tableaux de données complexes' },
|
|
24
|
+
'5.3': { id: '5.3', theme: 5, label: 'Compréhension du contenu linéarisé des tableaux de mise en forme' },
|
|
25
|
+
'5.4': { id: '5.4', theme: 5, label: 'Association du titre au tableau de données' },
|
|
26
|
+
'5.6': { id: '5.6', theme: 5, label: 'Déclaration des en-têtes de colonnes et de lignes des tableaux' },
|
|
27
|
+
'5.7': { id: '5.7', theme: 5, label: 'Association des cellules de données avec leurs en-têtes' },
|
|
28
|
+
'6.1': { id: '6.1', theme: 6, label: 'Intitulé explicite de chaque lien' },
|
|
29
|
+
'6.2': { id: '6.2', theme: 6, label: 'Présence d\'un intitulé pour chaque lien' },
|
|
30
|
+
'7.1': { id: '7.1', theme: 7, label: 'Compatibilité des scripts et composants ARIA avec les technologies d\'assistance' },
|
|
31
|
+
'7.3': { id: '7.3', theme: 7, label: 'Contrôle au clavier et par tout dispositif de pointage' },
|
|
32
|
+
'8.2': { id: '8.2', theme: 8, label: 'Validité du code source généré (identifiants uniques)' },
|
|
33
|
+
'8.3': { id: '8.3', theme: 8, label: 'Présence de la langue par défaut de la page' },
|
|
34
|
+
'8.4': { id: '8.4', theme: 8, label: 'Pertinence du code de langue par défaut' },
|
|
35
|
+
'8.5': { id: '8.5', theme: 8, label: 'Présence d\'un titre de page (<title>)' },
|
|
36
|
+
'8.7': { id: '8.7', theme: 8, label: 'Indication des changements de langue dans le code source' },
|
|
37
|
+
'9.1': { id: '9.1', theme: 9, label: 'Structuration de l\'information par les titres (h1–h6)' },
|
|
38
|
+
'9.2': { id: '9.2', theme: 9, label: 'Cohérence de la structure et des zones principales (landmarks)' },
|
|
39
|
+
'9.3': { id: '9.3', theme: 9, label: 'Structuration correcte des listes' },
|
|
40
|
+
'10.1': { id: '10.1', theme: 10, label: 'Utilisation des feuilles de styles pour contrôler la présentation' },
|
|
41
|
+
'10.4': { id: '10.4', theme: 10, label: 'Lisibilité du texte lors d\'un agrandissement jusqu\'à 200 %' },
|
|
42
|
+
'10.11': { id: '10.11', theme: 10, label: 'Présentation sans perte d\'information ni défilement horizontal (reflow)' },
|
|
43
|
+
'10.13': { id: '10.13', theme: 10, label: 'Contrôle des contenus additionnels au focus ou au survol' },
|
|
44
|
+
'11.1': { id: '11.1', theme: 11, label: 'Étiquette associée à chaque champ de formulaire' },
|
|
45
|
+
'11.5': { id: '11.5', theme: 11, label: 'Regroupement des champs de même nature dans les formulaires' },
|
|
46
|
+
'11.13': { id: '11.13', theme: 11, label: 'Déduction de la finalité des champs de saisie (autocomplete)' },
|
|
47
|
+
'12.6': { id: '12.6', theme: 12, label: 'Accès et évitement des zones de regroupement de contenus' },
|
|
48
|
+
'12.7': { id: '12.7', theme: 12, label: 'Lien d\'évitement ou d\'accès rapide au contenu principal' },
|
|
49
|
+
'12.8': { id: '12.8', theme: 12, label: 'Cohérence de l\'ordre de tabulation' },
|
|
50
|
+
'13.1': { id: '13.1', theme: 13, label: 'Contrôle par l\'utilisateur de chaque limite de temps' },
|
|
51
|
+
'13.8': { id: '13.8', theme: 13, label: 'Contrôle des contenus en mouvement ou clignotants' },
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Direct lookup from axe-core rule ID to one or more RGAA 4.1 criterion IDs. */
|
|
55
|
+
export const AXE_TO_RGAA: Readonly<Record<string, readonly string[]>> = {
|
|
56
|
+
// Theme 1 — Images
|
|
57
|
+
'image-alt': ['1.1'],
|
|
58
|
+
'input-image-alt': ['1.1'],
|
|
59
|
+
'area-alt': ['1.1'],
|
|
60
|
+
'object-alt': ['1.1'],
|
|
61
|
+
'svg-img-alt': ['1.1'],
|
|
62
|
+
'role-img-alt': ['1.1'],
|
|
63
|
+
'image-redundant-alt': ['1.3'],
|
|
64
|
+
'presentation-role-conflict': ['1.2', '7.1'],
|
|
65
|
+
|
|
66
|
+
// Theme 2 — Cadres
|
|
67
|
+
'frame-title': ['2.1'],
|
|
68
|
+
'frame-title-unique': ['2.2'],
|
|
69
|
+
'frame-focusable-content': ['2.1', '7.3'],
|
|
70
|
+
|
|
71
|
+
// Theme 3 — Couleurs
|
|
72
|
+
'link-in-text-block': ['3.1'],
|
|
73
|
+
'color-contrast': ['3.2'],
|
|
74
|
+
'color-contrast-enhanced': ['3.2'],
|
|
75
|
+
|
|
76
|
+
// Theme 4 — Multimédia
|
|
77
|
+
'audio-caption': ['4.1'],
|
|
78
|
+
'video-caption': ['4.1'],
|
|
79
|
+
'no-autoplay-audio': ['4.10'],
|
|
80
|
+
|
|
81
|
+
// Theme 5 — Tableaux
|
|
82
|
+
'table-duplicate-name': ['5.1'],
|
|
83
|
+
'layout-table': ['5.3'],
|
|
84
|
+
'table-fake-caption': ['5.4'],
|
|
85
|
+
'empty-table-header': ['5.6'],
|
|
86
|
+
'th-has-data-cells': ['5.6'],
|
|
87
|
+
'td-headers-attr': ['5.7'],
|
|
88
|
+
'td-has-header': ['5.7'],
|
|
89
|
+
'scope-attr-valid': ['5.7'],
|
|
90
|
+
|
|
91
|
+
// Theme 6 — Liens
|
|
92
|
+
'link-name': ['6.1', '6.2'],
|
|
93
|
+
'identical-links-same-purpose': ['6.1'],
|
|
94
|
+
|
|
95
|
+
// Theme 7 — Scripts & ARIA
|
|
96
|
+
'button-name': ['7.1'],
|
|
97
|
+
'input-button-name': ['7.1'],
|
|
98
|
+
'summary-name': ['7.1'],
|
|
99
|
+
'nested-interactive': ['7.1'],
|
|
100
|
+
'scrollable-region-focusable': ['7.3'],
|
|
101
|
+
'focus-order-semantics': ['7.3'],
|
|
102
|
+
|
|
103
|
+
// Theme 8 — Éléments obligatoires
|
|
104
|
+
'duplicate-id': ['8.2'],
|
|
105
|
+
'duplicate-id-active': ['8.2'],
|
|
106
|
+
'duplicate-id-aria': ['8.2'],
|
|
107
|
+
'html-has-lang': ['8.3'],
|
|
108
|
+
'html-lang-valid': ['8.4'],
|
|
109
|
+
'html-xml-lang-mismatch': ['8.4'],
|
|
110
|
+
'document-title': ['8.5'],
|
|
111
|
+
'valid-lang': ['8.7'],
|
|
112
|
+
|
|
113
|
+
// Theme 9 — Structuration de l'information
|
|
114
|
+
'heading-order': ['9.1'],
|
|
115
|
+
'empty-heading': ['9.1'],
|
|
116
|
+
'page-has-heading-one': ['9.1'],
|
|
117
|
+
'landmark-one-main': ['9.2'],
|
|
118
|
+
'landmark-no-duplicate-banner': ['9.2'],
|
|
119
|
+
'landmark-no-duplicate-contentinfo': ['9.2'],
|
|
120
|
+
'landmark-no-duplicate-main': ['9.2'],
|
|
121
|
+
'landmark-banner-is-top-level': ['9.2'],
|
|
122
|
+
'landmark-complementary-is-top-level': ['9.2'],
|
|
123
|
+
'landmark-contentinfo-is-top-level': ['9.2'],
|
|
124
|
+
'landmark-main-is-top-level': ['9.2'],
|
|
125
|
+
'landmark-unique': ['9.2'],
|
|
126
|
+
'region': ['9.2'],
|
|
127
|
+
'list': ['9.3'],
|
|
128
|
+
'listitem': ['9.3'],
|
|
129
|
+
'definition-list': ['9.3'],
|
|
130
|
+
'dlitem': ['9.3'],
|
|
131
|
+
|
|
132
|
+
// Theme 10 — Présentation de l'information
|
|
133
|
+
'blink': ['10.1', '13.8'],
|
|
134
|
+
'marquee': ['10.1', '13.8'],
|
|
135
|
+
'meta-viewport': ['10.4'],
|
|
136
|
+
'meta-viewport-large': ['10.4'],
|
|
137
|
+
'avoid-inline-spacing': ['10.11'],
|
|
138
|
+
'target-size': ['10.13'],
|
|
139
|
+
|
|
140
|
+
// Theme 11 — Formulaires
|
|
141
|
+
'label': ['11.1'],
|
|
142
|
+
'label-title-only': ['11.1'],
|
|
143
|
+
'select-name': ['11.1'],
|
|
144
|
+
'form-field-multiple-labels': ['11.1'],
|
|
145
|
+
'fieldset': ['11.5'],
|
|
146
|
+
'radiogroup': ['11.5'],
|
|
147
|
+
'autocomplete-valid': ['11.13'],
|
|
148
|
+
|
|
149
|
+
// Theme 12 — Navigation
|
|
150
|
+
'skip-link': ['12.7'],
|
|
151
|
+
'bypass': ['12.7'],
|
|
152
|
+
'tabindex': ['12.8'],
|
|
153
|
+
'accesskeys': ['12.8'],
|
|
154
|
+
|
|
155
|
+
// Theme 13 — Consultation
|
|
156
|
+
'meta-refresh': ['13.1'],
|
|
157
|
+
'meta-refresh-no-exceptions': ['13.1'],
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function lookupCriteria(ids: readonly string[]): RgaaCriterion[] {
|
|
161
|
+
const out: RgaaCriterion[] = []
|
|
162
|
+
for (const id of ids) {
|
|
163
|
+
const found = RGAA_CRITERIA[id]
|
|
164
|
+
if (found !== undefined)
|
|
165
|
+
out.push(found)
|
|
166
|
+
}
|
|
167
|
+
return out
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Resolves an axe-core rule ID (e.g. `'image-alt'`, `'aria-roles'`) to its matching RGAA 4.1 criteria. */
|
|
171
|
+
export function rgaaCriteriaForAxeRule(ruleId: string): RgaaCriterion[] {
|
|
172
|
+
const exact = AXE_TO_RGAA[ruleId]
|
|
173
|
+
if (exact !== undefined)
|
|
174
|
+
return lookupCriteria(exact)
|
|
175
|
+
if (ruleId.startsWith('aria-'))
|
|
176
|
+
return lookupCriteria(['7.1'])
|
|
177
|
+
if (ruleId.startsWith('table-') || ruleId.startsWith('td-') || ruleId.startsWith('th-'))
|
|
178
|
+
return lookupCriteria(['5.7'])
|
|
179
|
+
if (ruleId.startsWith('landmark-'))
|
|
180
|
+
return lookupCriteria(['9.2'])
|
|
181
|
+
if (ruleId.startsWith('frame-'))
|
|
182
|
+
return lookupCriteria(['2.1'])
|
|
183
|
+
return []
|
|
184
|
+
}
|
package/src/attrs.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
export const VALID_ATTR_NAME = /^[A-Za-z_:][-\w:.]*$/
|
|
4
4
|
export const URL_ATTRS = new Set(['href', 'src', 'action', 'formaction', 'xlink:href', 'data'])
|
|
5
5
|
const UNSAFE_URL_RE = /^(?:javascript|vbscript):/i
|
|
6
|
-
const
|
|
6
|
+
const SAFE_RASTER_DATA_URL_RE = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico|x-icon|vnd\.microsoft\.icon)[;,]/i
|
|
7
|
+
const SAFE_SVG_DATA_URL_RE = /^data:image\/svg\+xml[;,]/i
|
|
8
|
+
const SVG_DATA_SRC_TAGS = new Set(['img', 'source'])
|
|
7
9
|
const STRING_BOOL_ATTRS = new Set(['draggable', 'spellcheck', 'contenteditable'])
|
|
8
10
|
|
|
9
11
|
export const DOM_PROPS = new Set(['value', 'checked', 'selected', 'muted', 'indeterminate'])
|
|
@@ -29,7 +31,13 @@ export function isUnsafeUrlAttr(name: string, value: unknown, tag?: string): boo
|
|
|
29
31
|
return true
|
|
30
32
|
if (!/^data:/i.test(cleaned))
|
|
31
33
|
return false
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const lowerTag = tag?.toLowerCase()
|
|
35
|
+
if (lower === 'src') {
|
|
36
|
+
if (SAFE_RASTER_DATA_URL_RE.test(cleaned))
|
|
37
|
+
return false
|
|
38
|
+
return !(lowerTag !== undefined && SVG_DATA_SRC_TAGS.has(lowerTag) && SAFE_SVG_DATA_URL_RE.test(cleaned))
|
|
39
|
+
}
|
|
40
|
+
if (lower === 'href' && lowerTag === 'link')
|
|
41
|
+
return !(SAFE_RASTER_DATA_URL_RE.test(cleaned) || SAFE_SVG_DATA_URL_RE.test(cleaned))
|
|
34
42
|
return true
|
|
35
43
|
}
|