tessera-learn 0.2.2 → 0.2.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/AGENTS.md +117 -515
- package/dist/{audit-B9VHgVjk.js → audit--fSWIOgK.js} +10 -13
- package/dist/{audit-B9VHgVjk.js.map → audit--fSWIOgK.js.map} +1 -1
- package/dist/{build-commands-D127jw0J.js → build-commands-Qyrlsp3n.js} +2 -2
- package/dist/{build-commands-D127jw0J.js.map → build-commands-Qyrlsp3n.js.map} +1 -1
- package/dist/{inline-config-eHjv9XuA.js → inline-config-DqAKsCNl.js} +2 -2
- package/dist/{inline-config-eHjv9XuA.js.map → inline-config-DqAKsCNl.js.map} +1 -1
- package/dist/plugin/cli.d.ts.map +1 -1
- package/dist/plugin/cli.js +9 -12
- package/dist/plugin/cli.js.map +1 -1
- package/dist/plugin/index.d.ts +0 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +2 -2
- package/dist/{plugin--8H9xQIl.js → plugin-B-aiL9-V.js} +2 -2
- package/dist/{plugin--8H9xQIl.js.map → plugin-B-aiL9-V.js.map} +1 -1
- package/package.json +11 -8
- package/src/plugin/a11y/audit.ts +8 -13
- package/src/plugin/a11y-cli.ts +1 -4
- package/src/plugin/cli.ts +2 -3
- package/src/plugin/validate-cli.ts +10 -4
package/src/plugin/a11y/audit.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn, type SpawnOptions } from 'node:child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import { dirname, resolve } from 'node:path';
|
|
5
5
|
import { generateManifest, readCourseConfig } from '../manifest.js';
|
|
@@ -8,8 +8,6 @@ import { normalizeA11y, type A11ySettings } from '../validation.js';
|
|
|
8
8
|
export interface AuditOptions {
|
|
9
9
|
/** Minimum violation impact that fails the run (CI gate). Default 'serious'. */
|
|
10
10
|
threshold?: ImpactLevel;
|
|
11
|
-
/** Force a fresh `vite build` even if dist/ exists. */
|
|
12
|
-
rebuild?: boolean;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export type ImpactLevel = 'minor' | 'moderate' | 'serious' | 'critical';
|
|
@@ -378,7 +376,6 @@ export async function runAudit(
|
|
|
378
376
|
|
|
379
377
|
// A throwaway web build, kept out of dist/ so a real LMS export is untouched.
|
|
380
378
|
const auditDist = resolve(projectRoot, 'node_modules', '.tessera-a11y');
|
|
381
|
-
const distHtml = resolve(auditDist, 'index.html');
|
|
382
379
|
|
|
383
380
|
const prevEnv = process.env[AUDIT_ENV_FLAG];
|
|
384
381
|
process.env[AUDIT_ENV_FLAG] = '1';
|
|
@@ -386,15 +383,13 @@ export async function runAudit(
|
|
|
386
383
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
387
384
|
let server: any;
|
|
388
385
|
try {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
);
|
|
397
|
-
}
|
|
386
|
+
console.log('[tessera a11y] Building course…');
|
|
387
|
+
await vite.build(
|
|
388
|
+
vite.mergeConfig(auditBaseConfig, {
|
|
389
|
+
build: { outDir: auditDist, emptyOutDir: true },
|
|
390
|
+
logLevel: 'warn',
|
|
391
|
+
}),
|
|
392
|
+
);
|
|
398
393
|
|
|
399
394
|
server = await vite.preview({
|
|
400
395
|
root: projectRoot,
|
package/src/plugin/a11y-cli.ts
CHANGED
|
@@ -13,7 +13,6 @@ export type ParsedA11yArgs =
|
|
|
13
13
|
|
|
14
14
|
export function parseA11yArgs(argv: string[]): ParsedA11yArgs {
|
|
15
15
|
let threshold: ImpactLevel | undefined;
|
|
16
|
-
let rebuild = false;
|
|
17
16
|
|
|
18
17
|
for (let i = 0; i < argv.length; i++) {
|
|
19
18
|
const arg = argv[i];
|
|
@@ -26,14 +25,12 @@ export function parseA11yArgs(argv: string[]): ParsedA11yArgs {
|
|
|
26
25
|
};
|
|
27
26
|
}
|
|
28
27
|
threshold = value;
|
|
29
|
-
} else if (arg === '--build') {
|
|
30
|
-
rebuild = true;
|
|
31
28
|
} else {
|
|
32
29
|
return { ok: false, error: `Unknown argument: ${arg}` };
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
const args: AuditOptions = {
|
|
33
|
+
const args: AuditOptions = {};
|
|
37
34
|
if (threshold !== undefined) args.threshold = threshold;
|
|
38
35
|
return { ok: true, args };
|
|
39
36
|
}
|
package/src/plugin/cli.ts
CHANGED
|
@@ -19,8 +19,7 @@ Commands:
|
|
|
19
19
|
Run a command from inside a course folder, or name the course explicitly.
|
|
20
20
|
|
|
21
21
|
a11y/check options:
|
|
22
|
-
--threshold <minor|moderate|serious|critical> Failing impact (default: serious)
|
|
23
|
-
--build Force a fresh build first`;
|
|
22
|
+
--threshold <minor|moderate|serious|critical> Failing impact (default: serious)`;
|
|
24
23
|
|
|
25
24
|
// The course is a leading positional: `tessera <cmd> [course] [flags]`. Only the
|
|
26
25
|
// first token can be the course, and only when it isn't a flag — otherwise a flag
|
|
@@ -74,7 +73,7 @@ export async function main(
|
|
|
74
73
|
case 'validate':
|
|
75
74
|
return runValidate(courseRoot);
|
|
76
75
|
case 'check': {
|
|
77
|
-
const validateCode = runValidate(courseRoot);
|
|
76
|
+
const validateCode = runValidate(courseRoot, { showA11yTip: false });
|
|
78
77
|
if (validateCode !== 0) return validateCode;
|
|
79
78
|
return runA11y(courseRoot, workspaceRoot, flags);
|
|
80
79
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { basename } from 'node:path';
|
|
1
2
|
import { validateProject, reportValidationIssues } from './validation.js';
|
|
2
3
|
|
|
3
|
-
export function runValidate(
|
|
4
|
+
export function runValidate(
|
|
5
|
+
projectRoot: string,
|
|
6
|
+
{ showA11yTip = true }: { showA11yTip?: boolean } = {},
|
|
7
|
+
): number {
|
|
4
8
|
const { errors, warnings } = validateProject(projectRoot);
|
|
5
9
|
|
|
6
10
|
reportValidationIssues({ errors, warnings });
|
|
@@ -23,8 +27,10 @@ export function runValidate(projectRoot: string): number {
|
|
|
23
27
|
'\x1b[32m[tessera]\x1b[0m Validation passed — no issues found.',
|
|
24
28
|
);
|
|
25
29
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
if (showA11yTip) {
|
|
31
|
+
console.log(
|
|
32
|
+
`\x1b[2m[tessera] Static checks only. For a full runtime accessibility audit, run: pnpm a11y ${basename(projectRoot)}\x1b[0m`,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
29
35
|
return 0;
|
|
30
36
|
}
|