prunelle 0.1.1 → 0.7.2

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.
Files changed (177) hide show
  1. package/LICENSE +21 -0
  2. package/llms.txt +137 -40
  3. package/package.json +11 -2
  4. package/src/a11y/declaration.ts +373 -0
  5. package/src/a11y/index.ts +477 -0
  6. package/src/a11y/rgaa-map.ts +230 -0
  7. package/src/attrs.ts +11 -3
  8. package/src/build/bundle.ts +89 -41
  9. package/src/build/byte-size.ts +11 -0
  10. package/src/build/client-entries.ts +3 -2
  11. package/src/build/client-plugin.ts +11 -5
  12. package/src/build/client-prune.ts +56 -6
  13. package/src/build/compile.ts +13 -10
  14. package/src/build/ecoindex.ts +238 -0
  15. package/src/build/files.ts +15 -0
  16. package/src/build/first-load.ts +85 -14
  17. package/src/build/graph.ts +29 -39
  18. package/src/build/index.ts +225 -122
  19. package/src/build/island-promote.ts +311 -0
  20. package/src/build/islands.ts +14 -203
  21. package/src/build/manifest.ts +56 -116
  22. package/src/build/output.ts +3 -6
  23. package/src/build/plugin-host.ts +115 -41
  24. package/src/build/precompress.ts +16 -3
  25. package/src/build/prerender.ts +177 -39
  26. package/src/build/reach.ts +200 -0
  27. package/src/build/render-rules.ts +2 -2
  28. package/src/build/report.ts +48 -5
  29. package/src/build/resolve.ts +8 -6
  30. package/src/build/routes.ts +175 -10
  31. package/src/build/static-headers.ts +112 -0
  32. package/src/build/static.ts +139 -39
  33. package/src/build/status-pages.ts +127 -0
  34. package/src/build/style-bundles.ts +526 -0
  35. package/src/cli/check-forms.ts +636 -0
  36. package/src/cli/check-imports.ts +31 -0
  37. package/src/cli/check-links.ts +632 -0
  38. package/src/cli/check-security.ts +64 -0
  39. package/src/cli/check.ts +101 -26
  40. package/src/cli/commands.ts +120 -11
  41. package/src/cli/docs.ts +403 -0
  42. package/src/cli/inspect.ts +105 -15
  43. package/src/cli/mcp-tools.ts +492 -0
  44. package/src/cli/mcp.ts +205 -0
  45. package/src/cli/new.ts +16 -5
  46. package/src/cli/render.ts +416 -0
  47. package/src/cli/upgrade-names.ts +73 -13
  48. package/src/cli/upgrade.ts +156 -22
  49. package/src/compiler/analyze.ts +87 -54
  50. package/src/compiler/browser-globals.ts +140 -17
  51. package/src/compiler/cacheability-private.ts +566 -0
  52. package/src/compiler/cacheability.ts +335 -0
  53. package/src/compiler/compliance-eco.ts +71 -0
  54. package/src/compiler/compliance-rgaa.ts +614 -0
  55. package/src/compiler/compliance-urls.ts +148 -0
  56. package/src/compiler/compliance.ts +407 -352
  57. package/src/compiler/data-keys.ts +199 -192
  58. package/src/compiler/dev-source.ts +87 -0
  59. package/src/compiler/dom-attrs.ts +138 -65
  60. package/src/compiler/dom.ts +517 -442
  61. package/src/compiler/expr-context.ts +260 -81
  62. package/src/compiler/foreign-imports.ts +88 -0
  63. package/src/compiler/mistakes.ts +23 -2
  64. package/src/compiler/props-body.ts +60 -0
  65. package/src/compiler/props.ts +87 -36
  66. package/src/compiler/scope.ts +400 -333
  67. package/src/compiler/server-only.ts +190 -151
  68. package/src/compiler/shared.ts +42 -14
  69. package/src/compiler/signal-reads.ts +6 -2
  70. package/src/compiler/spread-handlers.ts +295 -0
  71. package/src/compiler/ssr-prunelle-tags.ts +27 -14
  72. package/src/compiler/ssr.ts +220 -89
  73. package/src/context.ts +34 -0
  74. package/src/dev/error-log.ts +177 -0
  75. package/src/dev/host-check.ts +32 -0
  76. package/src/dev/index.ts +94 -34
  77. package/src/dev/open-editor.ts +228 -0
  78. package/src/dev/protocol.ts +3 -0
  79. package/src/dev/reload.ts +5 -3
  80. package/src/dev/supervisor.ts +50 -25
  81. package/src/dev/watchers.ts +74 -13
  82. package/src/dom/action.ts +47 -21
  83. package/src/dom/attrs.ts +15 -3
  84. package/src/dom/extras.ts +57 -40
  85. package/src/dom/index.ts +54 -14
  86. package/src/dom/island.ts +102 -68
  87. package/src/dom/loop.ts +66 -32
  88. package/src/eco/declaration.ts +328 -0
  89. package/src/eco/index.ts +69 -0
  90. package/src/index.ts +2 -2
  91. package/src/jsx-runtime.ts +2 -2
  92. package/src/plugins/config.ts +18 -12
  93. package/src/plugins/context.ts +44 -1
  94. package/src/plugins/index.ts +2 -2
  95. package/src/plugins/load.ts +30 -10
  96. package/src/plugins/order.ts +38 -1
  97. package/src/plugins/public.ts +6 -3
  98. package/src/plugins/services.ts +84 -0
  99. package/src/plugins/types.ts +51 -2
  100. package/src/reactivity/graph.ts +10 -0
  101. package/src/reactivity/index.ts +24 -16
  102. package/src/reactivity/selector.ts +31 -4
  103. package/src/reactivity/store.ts +64 -20
  104. package/src/server/action-flash.ts +158 -0
  105. package/src/server/action-protect.ts +199 -0
  106. package/src/server/action-registry.ts +1 -1
  107. package/src/server/action.ts +188 -152
  108. package/src/server/app-secret.ts +63 -0
  109. package/src/server/assets.ts +34 -2
  110. package/src/server/compress.ts +96 -10
  111. package/src/server/consent.ts +59 -22
  112. package/src/server/cookies.ts +16 -2
  113. package/src/server/document.ts +25 -10
  114. package/src/server/env.ts +14 -0
  115. package/src/server/errors.ts +308 -65
  116. package/src/server/form-schema.ts +337 -0
  117. package/src/server/health.ts +275 -0
  118. package/src/server/http.ts +186 -39
  119. package/src/server/index.ts +272 -273
  120. package/src/server/loader.ts +15 -2
  121. package/src/server/page.ts +15 -0
  122. package/src/server/param-matchers.ts +112 -0
  123. package/src/server/plugin-host.ts +125 -88
  124. package/src/server/public.ts +6 -5
  125. package/src/server/rate-limit.ts +102 -36
  126. package/src/server/request-body.ts +1 -1
  127. package/src/server/route-cache.ts +541 -0
  128. package/src/server/route-table.ts +356 -11
  129. package/src/server/router.ts +125 -40
  130. package/src/server/routing.ts +112 -63
  131. package/src/server/sanitize-html.ts +309 -0
  132. package/src/server/security.ts +279 -52
  133. package/src/server/serve-handlers.ts +31 -7
  134. package/src/server/standard-schema.ts +17 -0
  135. package/src/server/start.ts +60 -16
  136. package/src/server/static-dir.ts +91 -12
  137. package/src/server/stream.ts +68 -27
  138. package/src/ssr/consent-banner.ts +58 -0
  139. package/src/ssr/context.ts +106 -8
  140. package/src/ssr/index.ts +151 -4
  141. package/src/ssr/navigation.ts +2 -2
  142. package/src/ssr/region.ts +40 -19
  143. package/src/style.ts +64 -1
  144. package/src/test/browser.ts +28 -13
  145. package/src/test/index.ts +97 -12
  146. package/src/ts-plugin/diagnostics.ts +505 -0
  147. package/src/ts-plugin/fixes.ts +364 -0
  148. package/src/ts-plugin/index.ts +194 -0
  149. package/templates/_shared/AGENTS.md +2 -2
  150. package/templates/_shared/gitignore +5 -0
  151. package/templates/_shared/mcp.json +11 -0
  152. package/templates/_shared/src/routes/legal.tsx +15 -1
  153. package/templates/_shared/tsconfig.json +5 -0
  154. package/templates/app/.env.example +4 -0
  155. package/templates/app/package.json +2 -1
  156. package/templates/app/prunelle.config.ts +2 -0
  157. package/templates/app/src/auth.ts +4 -6
  158. package/templates/app/src/mail.ts +4 -0
  159. package/templates/app/src/routes/_layout.tsx +9 -1
  160. package/templates/app/src/routes/dashboard/index.tsx +42 -8
  161. package/templates/app/src/routes/login.tsx +49 -30
  162. package/templates/app/src/routes/privacy.tsx +25 -0
  163. package/templates/app/src/styles/app.css +8 -1
  164. package/templates/app/tests/app.test.ts +44 -3
  165. package/templates/blog/package.json +1 -1
  166. package/templates/blog/prunelle.config.ts +1 -1
  167. package/templates/blog/src/routes/_layout.tsx +6 -1
  168. package/templates/blog/src/routes/index.tsx +5 -1
  169. package/templates/blog/src/styles/app.css +6 -1
  170. package/templates/fullstack/package.json +1 -1
  171. package/templates/fullstack/src/components/GreetForm.tsx +2 -1
  172. package/templates/fullstack/src/routes/_layout.tsx +4 -0
  173. package/templates/fullstack/src/styles/app.css +11 -1
  174. package/templates/minimal/package.json +1 -1
  175. package/templates/minimal/src/routes/_layout.tsx +4 -0
  176. package/templates/minimal/src/styles/app.css +11 -1
  177. package/ts-plugin.cjs +4277 -0
@@ -0,0 +1,373 @@
1
+ // Generates an editable French RGAA 4.1.2 accessibility declaration page (Décret n° 2019-768).
2
+
3
+ import type { A11yAuditReport } from './index'
4
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
5
+ import { dirname, join, resolve } from 'node:path'
6
+ import { relPosix } from '../build/files'
7
+
8
+ export type ComplianceStatus = 'full' | 'partial' | 'none'
9
+
10
+ /** The manual RGAA audit a statement reports: the day it ended and the share of applicable criteria met. */
11
+ export interface ManualAudit {
12
+ date: Date
13
+ /** Applicable RGAA criteria met, in percent (0 to 100). */
14
+ rate: number
15
+ }
16
+
17
+ export interface AccessibilityDeclarationOptions {
18
+ /** Application root directory. */
19
+ root: string
20
+ /** Destination path relative to `root` (or absolute). Default: `'src/routes/accessibilite.tsx'`. */
21
+ outPath?: string | undefined
22
+ /** Optional audit report from `auditAccessibility()` used to pre-fill test results and non-conformities. */
23
+ report?: A11yAuditReport | undefined
24
+ /** Organization or publisher name (editable placeholder by default). */
25
+ organization?: string | undefined
26
+ /** Public site URL (editable placeholder by default). */
27
+ siteUrl?: string | undefined
28
+ /** Contact email for accessibility feedback (editable placeholder by default). */
29
+ contactEmail?: string | undefined
30
+ /** The manual RGAA audit behind the compliance level; without one the statement says "non conforme". */
31
+ audit?: ManualAudit | undefined
32
+ /** Day the statement is drawn up (defaults to today). */
33
+ date?: Date | undefined
34
+ /** Write the generated TSX page to disk (default: `true`). */
35
+ write?: boolean | undefined
36
+ /** Overwrite an existing declaration file at `outPath` (default: `false`). */
37
+ force?: boolean | undefined
38
+ }
39
+
40
+ export interface AccessibilityDeclarationResult {
41
+ /** Absolute path of the target declaration file. */
42
+ path: string
43
+ /** Root-relative POSIX path (e.g. `'src/routes/accessibilite.tsx'`). */
44
+ relativePath: string
45
+ /** Compliance status written into the declaration. */
46
+ status: ComplianceStatus
47
+ /** Generated TSX source code. */
48
+ content: string
49
+ }
50
+
51
+ export const DEFAULT_DECLARATION_PATH = 'src/routes/accessibilite.tsx'
52
+ /** Marks a fact a drafted statement still lacks: `prunelle check` warns while a published statement holds one. */
53
+ export const STATEMENT_PLACEHOLDER = '[à compléter'
54
+
55
+ const STATUS_LABELS: Readonly<Record<ComplianceStatus, string>> = {
56
+ full: 'totalement conforme',
57
+ partial: 'partiellement conforme',
58
+ none: 'non conforme',
59
+ }
60
+
61
+ /** The RGAA compliance level a manual audit supports: all criteria met, at least half, or less, or no audit at all. Automated checks never raise it. */
62
+ export function inferComplianceStatus(audit: ManualAudit | undefined): ComplianceStatus {
63
+ if (audit === undefined)
64
+ return 'none'
65
+ if (Number.isNaN(audit.date.getTime()))
66
+ throw new Error('prunelle: the manual audit date is not a valid date: pass the day the audit ended, such as 2026-03-31.')
67
+ if (!(audit.rate >= 0 && audit.rate <= 100))
68
+ throw new Error(`prunelle: the manual audit rate must be a percentage from 0 to 100, got ${audit.rate}.`)
69
+ if (audit.rate === 100)
70
+ return 'full'
71
+ return audit.rate >= 50 ? 'partial' : 'none'
72
+ }
73
+
74
+ export function escapeJsxText(value: string): string {
75
+ return value
76
+ .replaceAll('&', '&amp;')
77
+ .replaceAll('<', '&lt;')
78
+ .replaceAll('>', '&gt;')
79
+ .replaceAll('{', '&#123;')
80
+ .replaceAll('}', '&#125;')
81
+ }
82
+
83
+ export function escapeAttr(value: string): string {
84
+ return value
85
+ .replaceAll('&', '&amp;')
86
+ .replaceAll('"', '&quot;')
87
+ .replaceAll('<', '&lt;')
88
+ .replaceAll('>', '&gt;')
89
+ }
90
+
91
+ export function formatFrenchDate(date: Date): { iso: string, human: string } {
92
+ const iso = date.toISOString().slice(0, 10)
93
+ const human = new Intl.DateTimeFormat('fr-FR', {
94
+ day: 'numeric',
95
+ month: 'long',
96
+ year: 'numeric',
97
+ timeZone: 'UTC',
98
+ }).format(date)
99
+ return { iso, human }
100
+ }
101
+
102
+ function renderNonConformities(report: A11yAuditReport | undefined): string {
103
+ if (report === undefined)
104
+ return ' <p>Aucun audit n\'a encore été réalisé : les non-conformités ne sont pas encore connues.</p>'
105
+ const routesWithIssues = report?.routes.filter(r => r.violations.length > 0) ?? []
106
+ if (routesWithIssues.length === 0) {
107
+ return [
108
+ ' <p>',
109
+ ' {/* TODO: compléter avec les non-conformités relevées lors de l\'audit manuel RGAA 4.1.2 */}',
110
+ ' Aucune non-conformité n\'a été détectée par l\'audit automatisé axe-core.',
111
+ ' </p>',
112
+ ].join('\n')
113
+ }
114
+
115
+ const items: string[] = []
116
+ for (const route of routesWithIssues) {
117
+ for (const v of route.violations) {
118
+ const rgaaLabel = v.rgaa.length > 0
119
+ ? `RGAA ${v.rgaa.map(c => c.id).join(', ')}`
120
+ : 'WCAG / axe-core'
121
+ const count = v.nodes.length
122
+ const elemWord = count === 1 ? 'élément' : 'éléments'
123
+ const line = `${route.route} — ${rgaaLabel} (${v.id}, impact ${v.impact}, ${count} ${elemWord}) : ${v.help}.`
124
+ items.push(` <li>${escapeJsxText(line)}</li>`)
125
+ }
126
+ }
127
+ return [
128
+ ' <p>Les non-conformités suivantes ont été détectées automatiquement par axe-core :</p>',
129
+ ' <ul>',
130
+ ...items,
131
+ ' </ul>',
132
+ ].join('\n')
133
+ }
134
+
135
+ function renderAuditedRoutes(report: A11yAuditReport | undefined): string {
136
+ const routes = report?.routes ?? []
137
+ if (routes.length === 0) {
138
+ return [
139
+ ' <ul>',
140
+ ` <li>${STATEMENT_PLACEHOLDER} : pages de l'échantillon audité]</li>`,
141
+ ' </ul>',
142
+ ].join('\n')
143
+ }
144
+ const items = routes.map((r) => {
145
+ const summary = r.violations.length === 0
146
+ ? '0 violation automatisée'
147
+ : `${r.violations.length} violation${r.violations.length === 1 ? '' : 's'} automatisée${r.violations.length === 1 ? '' : 's'}`
148
+ return ` <li><code>${escapeJsxText(r.route)}</code> (${escapeJsxText(summary)})</li>`
149
+ })
150
+ return [
151
+ ' <ul>',
152
+ ...items,
153
+ ' </ul>',
154
+ ].join('\n')
155
+ }
156
+
157
+ function automatedResultParagraph(report: A11yAuditReport | undefined, axeLabel: string): string {
158
+ if (report === undefined)
159
+ return ' <p>Aucun audit automatisé n\'a encore été réalisé.</p>'
160
+ const routeCount = report.routes.length
161
+ const violationCount = report.totalViolations
162
+ return [
163
+ ' <p>',
164
+ ` L'audit automatisé réalisé via <code>prunelle a11y</code> (${escapeJsxText(axeLabel)}, règles RGAA 4 d'axe-core et WCAG 2.1`,
165
+ ` niveaux A et AA) a porté sur <strong>${routeCount}</strong> page${routeCount === 1 ? '' : 's'} et a relevé{' '}`,
166
+ ` <strong>${violationCount}</strong> violation${violationCount === 1 ? '' : 's'} automatisée${violationCount === 1 ? '' : 's'}.`,
167
+ ' </p>',
168
+ ].join('\n')
169
+ }
170
+
171
+ function testEnvironmentItems(report: A11yAuditReport | undefined, axeLabel: string): string {
172
+ if (report === undefined)
173
+ return ` <li>${STATEMENT_PLACEHOLDER} : navigateurs et technologies d'assistance de l'audit]</li>`
174
+ return [
175
+ ' <li>Navigateur : Chromium (headless via Playwright)</li>',
176
+ ` <li>Moteur d'analyse : ${escapeJsxText(axeLabel)}</li>`,
177
+ ' {/* TODO: ajouter les combinaisons navigateur et lecteur d\'écran de l\'audit manuel (ex. Firefox + NVDA, Safari + VoiceOver) */}',
178
+ ].join('\n')
179
+ }
180
+
181
+ function buildStatusParagraph(status: ComplianceStatus, siteUrl: string, audit: ManualAudit | undefined): string {
182
+ const reason = audit === undefined
183
+ ? ' en l\'absence d\'audit de conformité RGAA 4.1.2'
184
+ : status === 'full' ? '' : ' en raison des non-conformités listées ci-dessous'
185
+ return [
186
+ ` <p>`,
187
+ ` <strong>${escapeJsxText(siteUrl)}</strong> est <strong>${STATUS_LABELS[status]}</strong> avec le référentiel général d'amélioration de l'accessibilité (RGAA), version 4.1.2${escapeJsxText(reason)}.`,
188
+ ` </p>`,
189
+ ].join('\n')
190
+ }
191
+
192
+ function manualAuditParagraph(audit: ManualAudit | undefined, automated: boolean): string {
193
+ if (audit === undefined && !automated)
194
+ return ' <p>Aucun audit de conformité manuel RGAA 4.1.2 n\'a encore été réalisé.</p>'
195
+ if (audit === undefined)
196
+ return ' <p>Aucun audit de conformité manuel RGAA 4.1.2 n\'a encore été réalisé : seules les vérifications automatisées ci-dessus ont été menées.</p>'
197
+ const { iso, human } = formatFrenchDate(audit.date)
198
+ const rate = new Intl.NumberFormat('fr-FR', { maximumFractionDigits: 1 }).format(audit.rate)
199
+ return [
200
+ ` <p>`,
201
+ ` L'audit de conformité manuel RGAA 4.1.2, achevé le <time dateTime="${escapeAttr(iso)}">${escapeJsxText(human)}</time>, révèle que <strong>${rate} %</strong> des critères du RGAA version 4.1.2 sont respectés.`,
202
+ ` </p>`,
203
+ ].join('\n')
204
+ }
205
+
206
+ function contactLine(contactEmail: string | undefined): string {
207
+ if (contactEmail === undefined)
208
+ return ` <li>Envoyer un courriel : ${STATEMENT_PLACEHOLDER} : adresse de contact accessibilité]</li>`
209
+ return ` <li>Envoyer un courriel : <a href="mailto:${escapeAttr(contactEmail)}">${escapeJsxText(contactEmail)}</a></li>`
210
+ }
211
+
212
+ // The layouts above the page, nearest first, up to the app root: one already rendering <main> holds the statement, which must not open a second.
213
+ export function layoutRendersMain(root: string, dest: string): boolean {
214
+ for (let dir = dirname(dest); dir.startsWith(root); dir = dirname(dir)) {
215
+ const layout = join(dir, '_layout.tsx')
216
+ if (existsSync(layout) && /<main[\s>]/.test(readFileSync(layout, 'utf8')))
217
+ return true
218
+ if (dir === root)
219
+ break
220
+ }
221
+ return false
222
+ }
223
+
224
+ /** Generates (and optionally writes) a draft French RGAA 4.1.2 accessibility declaration page in TSX. */
225
+ export function draftAccessibilityStatement(options: AccessibilityDeclarationOptions): AccessibilityDeclarationResult {
226
+ const root = resolve(options.root)
227
+ const dest = resolve(root, options.outPath ?? DEFAULT_DECLARATION_PATH)
228
+ const relativePath = relPosix(root, dest)
229
+ const status = inferComplianceStatus(options.audit)
230
+ const org = options.organization?.trim() || `${STATEMENT_PLACEHOLDER} : nom de l'organisme]`
231
+ const siteUrl = options.siteUrl?.trim() || `${STATEMENT_PLACEHOLDER} : adresse du site]`
232
+ const { iso, human } = formatFrenchDate(options.date ?? new Date())
233
+ const axeLabel = options.report?.axeVersion ? `axe-core ${options.report.axeVersion}` : 'axe-core'
234
+ const wrapper = layoutRendersMain(root, dest) ? 'article' : 'main'
235
+
236
+ const content = `// Brouillon de déclaration d'accessibilité RGAA 4.1.2 (Décret n° 2019-768) généré par \`prunelle a11y --draft\`.
237
+ // Les vérifications automatisées axe-core ne couvrent qu'une partie des 106 critères du RGAA 4.1.2 : le niveau de conformité vient de l'audit manuel (\`--audit-date\` et \`--rate\`).
238
+ // Remplacez chaque mention entre crochets avant publication : \`prunelle check\` signale celles qui restent.
239
+
240
+ import { Head } from 'prunelle'
241
+
242
+ export const prerender = true
243
+
244
+ export default function Accessibilite() {
245
+ return (
246
+ <>
247
+ <Head>
248
+ <title>Déclaration d'accessibilité</title>
249
+ </Head>
250
+ <${wrapper} lang="fr">
251
+ <h1>Déclaration d'accessibilité</h1>
252
+ <p>
253
+ <strong>${escapeJsxText(org)}</strong> s'engage à rendre ses sites internet, intranet, extranet et ses progiciels
254
+ accessibles (et ses applications mobiles et mobilier urbain numérique) conformément à l'article 47 de la loi n° 2005-102
255
+ du 11 février 2005.
256
+ </p>
257
+ <p>
258
+ Cette déclaration d'accessibilité s'applique à <strong>${escapeJsxText(siteUrl)}</strong>.
259
+ </p>
260
+
261
+ <section>
262
+ <h2>État de conformité</h2>
263
+ ${buildStatusParagraph(status, siteUrl, options.audit)}
264
+ </section>
265
+
266
+ <section>
267
+ <h2>Résultats des tests</h2>
268
+ ${automatedResultParagraph(options.report, axeLabel)}
269
+ ${manualAuditParagraph(options.audit, options.report !== undefined)}
270
+ </section>
271
+
272
+ <section>
273
+ <h2>Contenus non accessibles</h2>
274
+
275
+ <h3>Non-conformités</h3>
276
+ ${renderNonConformities(options.report)}
277
+
278
+ <h3>Dérogations pour charge disproportionnée</h3>
279
+ <p>
280
+ {/* TODO: lister ici les éventuelles dérogations justifiées */}
281
+ Aucune.
282
+ </p>
283
+
284
+ <h3>Contenus non soumis à l'obligation d'accessibilité</h3>
285
+ <p>
286
+ {/* TODO: lister ici les contenus tiers ou archives hors périmètre */}
287
+ Aucun.
288
+ </p>
289
+ </section>
290
+
291
+ <section>
292
+ <h2>Établissement de cette déclaration d'accessibilité</h2>
293
+ <p>
294
+ Cette déclaration a été établie le <time dateTime="${escapeAttr(iso)}">${escapeJsxText(human)}</time>.
295
+ </p>
296
+
297
+ <h3>Technologies utilisées pour la réalisation du site</h3>
298
+ <ul>
299
+ <li>HTML5</li>
300
+ <li>CSS</li>
301
+ <li>JavaScript</li>
302
+ <li>Prunelle</li>
303
+ </ul>
304
+
305
+ <h3>Environnement de test</h3>
306
+ <p>
307
+ Les vérifications de restitution de contenus ont été réalisées dans l'environnement suivant :
308
+ </p>
309
+ <ul>
310
+ ${testEnvironmentItems(options.report, axeLabel)}
311
+ </ul>
312
+
313
+ <h3>Outils pour évaluer l'accessibilité</h3>
314
+ <ul>
315
+ <li><code>prunelle a11y</code> (${escapeJsxText(axeLabel)})</li>
316
+ <li><code>prunelle check</code> (vérifications statiques RGAA sur le JSX)</li>
317
+ </ul>
318
+
319
+ <h3>Pages du site ayant fait l'objet de la vérification de conformité</h3>
320
+ ${renderAuditedRoutes(options.report)}
321
+ </section>
322
+
323
+ <section>
324
+ <h2>Retour d'information et contact</h2>
325
+ <p>
326
+ Si vous n'arrivez pas à accéder à un contenu ou à un service, vous pouvez contacter le responsable de{' '}
327
+ <strong>${escapeJsxText(siteUrl)}</strong> pour être orienté vers une alternative accessible ou obtenir le contenu sous une autre forme.
328
+ </p>
329
+ <ul>
330
+ ${contactLine(options.contactEmail?.trim() || undefined)}
331
+ {/* TODO: ajouter si besoin l'adresse postale ou le lien du formulaire de contact */}
332
+ </ul>
333
+ </section>
334
+
335
+ <section>
336
+ <h2>Voies de recours</h2>
337
+ <p>
338
+ Cette procédure est à utiliser dans le cas suivant : vous avez signalé au responsable du site internet un défaut
339
+ d'accessibilité qui vous empêche d'accéder à un contenu ou à un des services du portail et vous n'avez pas obtenu
340
+ de réponse satisfaisante.
341
+ </p>
342
+ <ul>
343
+ <li>
344
+ <a href="https://formulaire.defenseurdesdroits.fr/">Écrire un message au Défenseur des droits</a>
345
+ </li>
346
+ <li>
347
+ <a href="https://www.defenseurdesdroits.fr/saisir/delegues">Contacter le délégué du Défenseur des droits dans votre région</a>
348
+ </li>
349
+ <li>
350
+ Envoyer un courrier par la poste (gratuit, ne pas mettre de timbre) : Défenseur des droits, Libre réponse 71120, 75342 Paris CEDEX 07.
351
+ </li>
352
+ </ul>
353
+ </section>
354
+ </${wrapper}>
355
+ </>
356
+ )
357
+ }
358
+ `
359
+
360
+ if (options.write !== false) {
361
+ if (existsSync(dest) && options.force !== true)
362
+ throw new Error(`prunelle: ${relativePath} already exists: pass --force to overwrite it.`)
363
+ mkdirSync(dirname(dest), { recursive: true })
364
+ writeFileSync(dest, content)
365
+ }
366
+
367
+ return {
368
+ path: dest,
369
+ relativePath,
370
+ status,
371
+ content,
372
+ }
373
+ }