uiaudit.js 1.0.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/dist/auditor.d.ts +11 -0
- package/dist/auditor.d.ts.map +1 -0
- package/dist/auditor.js +70 -0
- package/dist/auditor.js.map +1 -0
- package/dist/auditors/accessibility.d.ts +8 -0
- package/dist/auditors/accessibility.d.ts.map +1 -0
- package/dist/auditors/accessibility.js +1769 -0
- package/dist/auditors/accessibility.js.map +1 -0
- package/dist/auditors/performance.d.ts +8 -0
- package/dist/auditors/performance.d.ts.map +1 -0
- package/dist/auditors/performance.js +168 -0
- package/dist/auditors/performance.js.map +1 -0
- package/dist/auditors/seo.d.ts +8 -0
- package/dist/auditors/seo.d.ts.map +1 -0
- package/dist/auditors/seo.js +171 -0
- package/dist/auditors/seo.js.map +1 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +115 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/index.d.ts +18 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +87 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/traverse.d.ts +10 -0
- package/dist/parser/traverse.d.ts.map +1 -0
- package/dist/parser/traverse.js +13 -0
- package/dist/parser/traverse.js.map +1 -0
- package/dist/reporter/terminal.d.ts +3 -0
- package/dist/reporter/terminal.d.ts.map +1 -0
- package/dist/reporter/terminal.js +200 -0
- package/dist/reporter/terminal.js.map +1 -0
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +39 -0
- package/src/auditor.ts +100 -0
- package/src/auditors/accessibility.ts +2125 -0
- package/src/auditors/performance.ts +212 -0
- package/src/auditors/seo.ts +212 -0
- package/src/cli.ts +162 -0
- package/src/index.ts +22 -0
- package/src/parser/index.ts +106 -0
- package/src/parser/traverse.ts +14 -0
- package/src/reporter/terminal.ts +247 -0
- package/src/types.ts +51 -0
- package/tsconfig.json +47 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* UIAudit CLI entry point.
|
|
4
|
+
* This file is what runs when someone types `uiaudit` in their terminal.
|
|
5
|
+
*
|
|
6
|
+
* The bin field in package.json points to `dist/cli.js` (compiled version).
|
|
7
|
+
* During development: `npx ts-node src/cli.ts audit ./src`
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from 'commander';
|
|
10
|
+
import ora from 'ora';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import * as fs from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { runAudit } from './auditor.js';
|
|
15
|
+
import { renderTerminal } from './reporter/terminal.js';
|
|
16
|
+
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
17
|
+
const ALL_CATEGORIES = ['performance', 'seo', 'accessibility'];
|
|
18
|
+
const VERSION = '1.0.0';
|
|
19
|
+
// ─── CLI setup ────────────────────────────────────────────────────────────────
|
|
20
|
+
const program = new Command();
|
|
21
|
+
program
|
|
22
|
+
.name('uiaudit')
|
|
23
|
+
.description('Audit React/Next.js components for performance, SEO, and accessibility issues')
|
|
24
|
+
.version(VERSION);
|
|
25
|
+
// ─── Main command: uiaudit audit <target> ────────────────────────────────────
|
|
26
|
+
program
|
|
27
|
+
.command('audit <target>')
|
|
28
|
+
.description('Audit a file or directory of React/Next.js components')
|
|
29
|
+
.option('-t, --type <types>', 'Comma-separated audit categories to run: performance, seo, accessibility', 'performance,seo,accessibility')
|
|
30
|
+
.option('-o, --output <format>', 'Output format: terminal (default) or json', 'terminal')
|
|
31
|
+
.option('-f, --file <path>', 'Save JSON report to a file (also prints to terminal by default)')
|
|
32
|
+
.action((target, opts) => {
|
|
33
|
+
const types = parseTypes(opts.type);
|
|
34
|
+
if (!types)
|
|
35
|
+
process.exit(1);
|
|
36
|
+
runAuditCommand(target, types, opts.output, opts.file);
|
|
37
|
+
});
|
|
38
|
+
// ─── Shorthand commands ───────────────────────────────────────────────────────
|
|
39
|
+
// These exist so developers can type `uiaudit perf ./src` instead of the
|
|
40
|
+
// full `uiaudit audit ./src --type performance`. Less typing = more usage.
|
|
41
|
+
program
|
|
42
|
+
.command('perf <target>')
|
|
43
|
+
.description('Shorthand: run performance audit only')
|
|
44
|
+
.option('-o, --output <format>', 'Output format: terminal or json', 'terminal')
|
|
45
|
+
.option('-f, --file <path>', 'Save JSON report to a file')
|
|
46
|
+
.action((target, opts) => {
|
|
47
|
+
runAuditCommand(target, ['performance'], opts.output, opts.file);
|
|
48
|
+
});
|
|
49
|
+
program
|
|
50
|
+
.command('seo <target>')
|
|
51
|
+
.description('Shorthand: run SEO audit only')
|
|
52
|
+
.option('-o, --output <format>', 'Output format: terminal or json', 'terminal')
|
|
53
|
+
.option('-f, --file <path>', 'Save JSON report to a file')
|
|
54
|
+
.action((target, opts) => {
|
|
55
|
+
runAuditCommand(target, ['seo'], opts.output, opts.file);
|
|
56
|
+
});
|
|
57
|
+
program
|
|
58
|
+
.command('a11y <target>')
|
|
59
|
+
.description('Shorthand: run accessibility audit only')
|
|
60
|
+
.option('-o, --output <format>', 'Output format: terminal or json', 'terminal')
|
|
61
|
+
.option('-f, --file <path>', 'Save JSON report to a file')
|
|
62
|
+
.action((target, opts) => {
|
|
63
|
+
runAuditCommand(target, ['accessibility'], opts.output, opts.file);
|
|
64
|
+
});
|
|
65
|
+
program.parse(process.argv);
|
|
66
|
+
// ─── Shared action handler ────────────────────────────────────────────────────
|
|
67
|
+
function runAuditCommand(target, types, output, outputFile) {
|
|
68
|
+
const spinner = ora({
|
|
69
|
+
text: `Scanning ${chalk.cyan(target)}...`,
|
|
70
|
+
color: 'cyan',
|
|
71
|
+
}).start();
|
|
72
|
+
try {
|
|
73
|
+
const report = runAudit(target, { types });
|
|
74
|
+
spinner.succeed(chalk.green(`Scanned ${report.totalFiles} file${report.totalFiles !== 1 ? 's' : ''}`));
|
|
75
|
+
// Save JSON report to file if requested
|
|
76
|
+
if (outputFile) {
|
|
77
|
+
const resolvedPath = path.resolve(outputFile);
|
|
78
|
+
fs.writeFileSync(resolvedPath, JSON.stringify(report, null, 2), 'utf-8');
|
|
79
|
+
console.log(chalk.green(`\n ✓ Report saved → ${resolvedPath}\n`));
|
|
80
|
+
}
|
|
81
|
+
// Render output
|
|
82
|
+
if (output === 'json') {
|
|
83
|
+
console.log(JSON.stringify(report, null, 2));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
renderTerminal(report);
|
|
87
|
+
}
|
|
88
|
+
// Exit code 1 if any critical issues — makes this useful in CI pipelines.
|
|
89
|
+
// Example: `uiaudit audit ./src && git push` will block the push if crits exist.
|
|
90
|
+
const hasCritical = Object.values(report.results).some((r) => r && r.counts.critical > 0);
|
|
91
|
+
process.exit(hasCritical ? 1 : 0);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
spinner.fail(chalk.red(`Audit failed: ${err.message}`));
|
|
95
|
+
if (process.env.DEBUG) {
|
|
96
|
+
console.error('\n', err);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
console.error(chalk.dim(' Run with DEBUG=1 for stack trace.'));
|
|
100
|
+
}
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
105
|
+
function parseTypes(raw) {
|
|
106
|
+
const parts = raw.split(',').map((t) => t.trim().toLowerCase());
|
|
107
|
+
const invalid = parts.filter((p) => !ALL_CATEGORIES.includes(p));
|
|
108
|
+
if (invalid.length > 0) {
|
|
109
|
+
console.error(chalk.red(`\n Unknown category: "${invalid.join('", "')}"\n`) +
|
|
110
|
+
chalk.dim(` Valid options: ${ALL_CATEGORIES.join(', ')}\n`));
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
return parts;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,GAAG,MAAc,KAAK,CAAC;AAC9B,OAAO,KAAK,MAAY,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,MAAU,IAAI,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAQ,MAAM,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAa,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAO,wBAAwB,CAAC;AAGzD,iFAAiF;AAEjF,MAAM,cAAc,GAAoB,CAAC,aAAa,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAChF,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,iFAAiF;AAEjF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,+EAA+E,CAAC;KAC5F,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,gFAAgF;AAEhF,OAAO;KACJ,OAAO,CAAC,gBAAgB,CAAC;KACzB,WAAW,CAAC,uDAAuD,CAAC;KACpE,MAAM,CACL,oBAAoB,EACpB,0EAA0E,EAC1E,+BAA+B,CAChC;KACA,MAAM,CACL,uBAAuB,EACvB,2CAA2C,EAC3C,UAAU,CACX;KACA,MAAM,CACL,mBAAmB,EACnB,iEAAiE,CAClE;KACA,MAAM,CAAC,CAAC,MAAc,EAAE,IAAqD,EAAE,EAAE;IAChF,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC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KAAK,CAAC,GAAG,CAAC,0BAA0B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9D,KAAK,CAAC,GAAG,CAAC,oBAAoB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7D,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIAudit — Public programmatic API
|
|
3
|
+
*
|
|
4
|
+
* This is what the VS Code extension (and any other programmatic consumer)
|
|
5
|
+
* will import. The CLI (src/cli.ts) uses this same API under the hood.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { runAudit } from 'uiaudit';
|
|
9
|
+
* const report = runAudit('./src/components', { types: ['accessibility', 'performance'] });
|
|
10
|
+
*/
|
|
11
|
+
export { runAudit } from './auditor.js';
|
|
12
|
+
export type { AuditReport, AuditResult, AuditOptions, AuditCategory, Issue, IssueImpact, IssueStatus, } from './types.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,YAAY,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,KAAK,EACL,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIAudit — Public programmatic API
|
|
3
|
+
*
|
|
4
|
+
* This is what the VS Code extension (and any other programmatic consumer)
|
|
5
|
+
* will import. The CLI (src/cli.ts) uses this same API under the hood.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { runAudit } from 'uiaudit';
|
|
9
|
+
* const report = runAudit('./src/components', { types: ['accessibility', 'performance'] });
|
|
10
|
+
*/
|
|
11
|
+
export { runAudit } from './auditor.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { File } from '@babel/types';
|
|
2
|
+
export interface ParsedFile {
|
|
3
|
+
filePath: string;
|
|
4
|
+
ast: File;
|
|
5
|
+
source: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parse a single file with Babel.
|
|
9
|
+
* Returns null for unsupported extensions or parse errors (we never crash on
|
|
10
|
+
* a single bad file — we just skip it and continue).
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseFile(filePath: string): ParsedFile | null;
|
|
13
|
+
/**
|
|
14
|
+
* Recursively collect all supported source files under a target path.
|
|
15
|
+
* Target can be either a single file or a directory.
|
|
16
|
+
*/
|
|
17
|
+
export declare function collectFiles(target: string): string[];
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIzC,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,IAAI,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;CAChB;AAcD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAyB7D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBrD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as parser from '@babel/parser';
|
|
4
|
+
// ─── Constants ───────────────────────────────────────────────────────────────
|
|
5
|
+
const SUPPORTED_EXT = new Set(['.tsx', '.ts', '.jsx', '.js']);
|
|
6
|
+
// Directories we never descend into
|
|
7
|
+
const IGNORED_DIRS = new Set([
|
|
8
|
+
'node_modules', '.next', 'dist', 'build', '.git',
|
|
9
|
+
'.cache', 'coverage', 'out', '.turbo', 'storybook-static',
|
|
10
|
+
]);
|
|
11
|
+
// ─── Public API ──────────────────────────────────────────────────────────────
|
|
12
|
+
/**
|
|
13
|
+
* Parse a single file with Babel.
|
|
14
|
+
* Returns null for unsupported extensions or parse errors (we never crash on
|
|
15
|
+
* a single bad file — we just skip it and continue).
|
|
16
|
+
*/
|
|
17
|
+
export function parseFile(filePath) {
|
|
18
|
+
if (!SUPPORTED_EXT.has(path.extname(filePath)))
|
|
19
|
+
return null;
|
|
20
|
+
try {
|
|
21
|
+
const source = fs.readFileSync(filePath, 'utf-8');
|
|
22
|
+
const ast = parser.parse(source, {
|
|
23
|
+
sourceType: 'module',
|
|
24
|
+
// Enable all syntax that appears in real React/Next.js projects
|
|
25
|
+
plugins: [
|
|
26
|
+
'jsx',
|
|
27
|
+
'typescript',
|
|
28
|
+
'decorators-legacy',
|
|
29
|
+
'classProperties',
|
|
30
|
+
'classStaticBlock',
|
|
31
|
+
'optionalChaining',
|
|
32
|
+
'nullishCoalescingOperator',
|
|
33
|
+
'importAssertions',
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
return { filePath, ast, source };
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Silently skip files that fail to parse.
|
|
40
|
+
// This happens with binary files, unusual encodings, or unsupported syntax.
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Recursively collect all supported source files under a target path.
|
|
46
|
+
* Target can be either a single file or a directory.
|
|
47
|
+
*/
|
|
48
|
+
export function collectFiles(target) {
|
|
49
|
+
const absTarget = path.resolve(target);
|
|
50
|
+
let stat;
|
|
51
|
+
try {
|
|
52
|
+
stat = fs.statSync(absTarget);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
throw new Error(`Path not found: ${absTarget}`);
|
|
56
|
+
}
|
|
57
|
+
if (stat.isFile()) {
|
|
58
|
+
return SUPPORTED_EXT.has(path.extname(absTarget)) ? [absTarget] : [];
|
|
59
|
+
}
|
|
60
|
+
if (stat.isDirectory()) {
|
|
61
|
+
return walkDir(absTarget);
|
|
62
|
+
}
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
// ─── Private helpers ─────────────────────────────────────────────────────────
|
|
66
|
+
function walkDir(dir) {
|
|
67
|
+
const results = [];
|
|
68
|
+
for (const entry of fs.readdirSync(dir)) {
|
|
69
|
+
if (IGNORED_DIRS.has(entry))
|
|
70
|
+
continue;
|
|
71
|
+
const fullPath = path.join(dir, entry);
|
|
72
|
+
try {
|
|
73
|
+
const entryStat = fs.statSync(fullPath);
|
|
74
|
+
if (entryStat.isDirectory()) {
|
|
75
|
+
results.push(...walkDir(fullPath));
|
|
76
|
+
}
|
|
77
|
+
else if (SUPPORTED_EXT.has(path.extname(entry))) {
|
|
78
|
+
results.push(fullPath);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Skip files we can't stat (permission issues, broken symlinks, etc.)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;A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;QAAC,MAAM,CAAC;YACP,sEAAsE;QACxE,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @babel/traverse has a well-known CommonJS interop quirk.
|
|
3
|
+
* Depending on the Node version and moduleResolution settings,
|
|
4
|
+
* the default export may land on `.default` or on the module itself.
|
|
5
|
+
* This file normalises that into a single reliable `traverse` export.
|
|
6
|
+
*
|
|
7
|
+
* All auditors import traverse from HERE, not directly from @babel/traverse.
|
|
8
|
+
*/
|
|
9
|
+
export declare const traverse: (ast: any, visitors: any) => any;
|
|
10
|
+
//# sourceMappingURL=traverse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../src/parser/traverse.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,eAAO,MAAM,QAAQ,EAEK,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,GAAG,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @babel/traverse has a well-known CommonJS interop quirk.
|
|
3
|
+
* Depending on the Node version and moduleResolution settings,
|
|
4
|
+
* the default export may land on `.default` or on the module itself.
|
|
5
|
+
* This file normalises that into a single reliable `traverse` export.
|
|
6
|
+
*
|
|
7
|
+
* All auditors import traverse from HERE, not directly from @babel/traverse.
|
|
8
|
+
*/
|
|
9
|
+
import _traverse from '@babel/traverse';
|
|
10
|
+
export const traverse = (typeof _traverse.default === 'function'
|
|
11
|
+
? _traverse.default
|
|
12
|
+
: _traverse);
|
|
13
|
+
//# sourceMappingURL=traverse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/parser/traverse.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAI,CAAC,OAAQ,SAAiB,CAAC,OAAO,KAAK,UAAU;IACxE,CAAC,CAAE,SAAiB,CAAC,OAAO;IAC5B,CAAC,CAAC,SAAS,CAA6C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/reporter/terminal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAmC,MAAM,aAAa,CAAC;AAYhF,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAYxD"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
// ─── Impact colour map ────────────────────────────────────────────────────────
|
|
3
|
+
const IMPACT_BADGE = {
|
|
4
|
+
critical: chalk.bgRed.white.bold(' CRITICAL '),
|
|
5
|
+
major: chalk.bgYellow.black.bold(' MAJOR '),
|
|
6
|
+
minor: chalk.bgGray.white(' MINOR '),
|
|
7
|
+
};
|
|
8
|
+
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
9
|
+
export function renderTerminal(report) {
|
|
10
|
+
console.log('');
|
|
11
|
+
printHeader(report);
|
|
12
|
+
printScoreSummary(report);
|
|
13
|
+
const { results } = report;
|
|
14
|
+
if (results.performance)
|
|
15
|
+
printCategorySection(results.performance);
|
|
16
|
+
if (results.seo)
|
|
17
|
+
printCategorySection(results.seo);
|
|
18
|
+
if (results.accessibility)
|
|
19
|
+
printCategorySection(results.accessibility);
|
|
20
|
+
printCriticalSummary(report);
|
|
21
|
+
printFooter(report);
|
|
22
|
+
}
|
|
23
|
+
// ─── Header ──────────────────────────────────────────────────────────────────
|
|
24
|
+
function printHeader(report) {
|
|
25
|
+
const W = 66;
|
|
26
|
+
const rule = '─'.repeat(W);
|
|
27
|
+
const centre = (text) => {
|
|
28
|
+
const pad = Math.max(0, Math.floor((W - text.length) / 2));
|
|
29
|
+
return ' '.repeat(pad) + text + ' '.repeat(Math.max(0, W - pad - text.length));
|
|
30
|
+
};
|
|
31
|
+
console.log(chalk.cyan(`┌${rule}┐`));
|
|
32
|
+
console.log(chalk.cyan('│') + chalk.bold(centre('🔍 UIAudit')) + chalk.cyan('│'));
|
|
33
|
+
console.log(chalk.cyan('│') + chalk.cyan(centre(truncate(report.target, W - 2))) + chalk.cyan('│'));
|
|
34
|
+
console.log(chalk.cyan('│') + chalk.dim(centre(new Date(report.timestamp).toLocaleString())) + chalk.cyan('│'));
|
|
35
|
+
console.log(chalk.cyan(`└${rule}┘`));
|
|
36
|
+
console.log('');
|
|
37
|
+
}
|
|
38
|
+
// ─── Score summary table ──────────────────────────────────────────────────────
|
|
39
|
+
function printScoreSummary(report) {
|
|
40
|
+
const { overallScore, totalFiles, results } = report;
|
|
41
|
+
console.log(`${chalk.bold('Overall Score:')} ${colorScore(overallScore)(`${overallScore}/100`)} ${scoreLabel(overallScore)}` +
|
|
42
|
+
chalk.dim(` (${totalFiles} file${totalFiles !== 1 ? 's' : ''} scanned)\n`));
|
|
43
|
+
const rows = [
|
|
44
|
+
['Performance', results.performance],
|
|
45
|
+
['SEO', results.seo],
|
|
46
|
+
['Accessibility', results.accessibility],
|
|
47
|
+
];
|
|
48
|
+
for (const [label, result] of rows) {
|
|
49
|
+
if (!result)
|
|
50
|
+
continue;
|
|
51
|
+
const { score, counts } = result;
|
|
52
|
+
const bar = scoreBar(score);
|
|
53
|
+
const scoreStr = colorScore(score)(`${score}/100`.padEnd(8));
|
|
54
|
+
const summary = counts.total === 0
|
|
55
|
+
? chalk.green('No issues ✓')
|
|
56
|
+
: [
|
|
57
|
+
counts.critical ? chalk.red.bold(`${counts.critical} critical`) : '',
|
|
58
|
+
counts.major ? chalk.yellow(`${counts.major} major`) : '',
|
|
59
|
+
counts.minor ? chalk.gray(`${counts.minor} minor`) : '',
|
|
60
|
+
]
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.join(chalk.dim(' '));
|
|
63
|
+
console.log(` ${chalk.bold(label.padEnd(15))} ${scoreStr} ${bar} ${summary}`);
|
|
64
|
+
}
|
|
65
|
+
console.log('');
|
|
66
|
+
}
|
|
67
|
+
// ─── Category section ─────────────────────────────────────────────────────────
|
|
68
|
+
function printCategorySection(result) {
|
|
69
|
+
const CATEGORY_COLORS = {
|
|
70
|
+
performance: chalk.blue.bold,
|
|
71
|
+
seo: chalk.green.bold,
|
|
72
|
+
accessibility: chalk.magenta.bold,
|
|
73
|
+
};
|
|
74
|
+
const color = CATEGORY_COLORS[result.category] ?? chalk.bold;
|
|
75
|
+
const title = result.category.toUpperCase();
|
|
76
|
+
console.log(color('═'.repeat(62)));
|
|
77
|
+
console.log(color(` ${title}`) +
|
|
78
|
+
color(' · ') +
|
|
79
|
+
colorScore(result.score)(`${result.score}/100`));
|
|
80
|
+
console.log(color('═'.repeat(62)));
|
|
81
|
+
console.log('');
|
|
82
|
+
if (result.issues.length === 0) {
|
|
83
|
+
console.log(` ${chalk.green('✅')} No issues found.\n`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Print issues grouped by impact level (critical → major → minor)
|
|
87
|
+
const groups = ['critical', 'major', 'minor'];
|
|
88
|
+
for (const impact of groups) {
|
|
89
|
+
const group = result.issues.filter((i) => i.impact === impact);
|
|
90
|
+
if (group.length === 0)
|
|
91
|
+
continue;
|
|
92
|
+
for (const issue of group) {
|
|
93
|
+
printIssue(issue);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
console.log('');
|
|
97
|
+
}
|
|
98
|
+
// ─── Single issue block ───────────────────────────────────────────────────────
|
|
99
|
+
function printIssue(issue) {
|
|
100
|
+
const statusIcon = issue.status === 'fail' ? '❌' : '⚠️ ';
|
|
101
|
+
const badge = IMPACT_BADGE[issue.impact];
|
|
102
|
+
// Location string (file:line)
|
|
103
|
+
const location = issue.file && issue.line
|
|
104
|
+
? chalk.dim(` ${shortPath(issue.file)}:${issue.line}`)
|
|
105
|
+
: '';
|
|
106
|
+
console.log(` ${statusIcon} ${badge} ${chalk.bold(issue.title)}${location}`);
|
|
107
|
+
console.log(` ${chalk.dim(issue.description)}`);
|
|
108
|
+
console.log('');
|
|
109
|
+
// Code snippet (what's wrong)
|
|
110
|
+
if (issue.codeSnippet) {
|
|
111
|
+
console.log(` ${chalk.red.dim('✗')} ${chalk.red.dim(issue.codeSnippet)}`);
|
|
112
|
+
}
|
|
113
|
+
// Fix snippet (what to write instead)
|
|
114
|
+
if (issue.fixSnippet) {
|
|
115
|
+
console.log(` ${chalk.green.dim('✓')} ${chalk.green(issue.fixSnippet)}`);
|
|
116
|
+
}
|
|
117
|
+
// Multi-line suggestion
|
|
118
|
+
console.log('');
|
|
119
|
+
const suggestionLines = issue.suggestion.split('\n');
|
|
120
|
+
console.log(` ${chalk.cyan('💡 Fix:')} ${suggestionLines[0]}`);
|
|
121
|
+
for (const line of suggestionLines.slice(1)) {
|
|
122
|
+
console.log(` ${chalk.dim(line)}`);
|
|
123
|
+
}
|
|
124
|
+
console.log('');
|
|
125
|
+
console.log(' ' + chalk.dim('─'.repeat(54)));
|
|
126
|
+
console.log('');
|
|
127
|
+
}
|
|
128
|
+
// ─── Critical summary (always shown at the end if any critical exist) ─────────
|
|
129
|
+
function printCriticalSummary(report) {
|
|
130
|
+
const criticals = [];
|
|
131
|
+
for (const result of Object.values(report.results)) {
|
|
132
|
+
if (!result)
|
|
133
|
+
continue;
|
|
134
|
+
criticals.push(...result.issues.filter((i) => i.impact === 'critical'));
|
|
135
|
+
}
|
|
136
|
+
if (criticals.length === 0)
|
|
137
|
+
return;
|
|
138
|
+
console.log(chalk.red.bold(`┌─ 🚨 Fix These First (${criticals.length} critical issue${criticals.length !== 1 ? 's' : ''}) ${'─'.repeat(25)}┐`));
|
|
139
|
+
console.log('');
|
|
140
|
+
criticals.slice(0, 6).forEach((issue, idx) => {
|
|
141
|
+
const cat = issue.category.padEnd(13);
|
|
142
|
+
console.log(` ${chalk.red.bold(String(idx + 1) + '.')} ` +
|
|
143
|
+
chalk.dim(`[${cat}]`) + ' ' +
|
|
144
|
+
chalk.bold(issue.title));
|
|
145
|
+
if (issue.file) {
|
|
146
|
+
console.log(` ${chalk.dim(shortPath(issue.file))}${issue.line ? chalk.dim(`:${issue.line}`) : ''}`);
|
|
147
|
+
}
|
|
148
|
+
console.log('');
|
|
149
|
+
});
|
|
150
|
+
console.log(chalk.red.bold('└' + '─'.repeat(58) + '┘'));
|
|
151
|
+
console.log('');
|
|
152
|
+
}
|
|
153
|
+
// ─── Footer ───────────────────────────────────────────────────────────────────
|
|
154
|
+
function printFooter(report) {
|
|
155
|
+
const totalIssues = Object.values(report.results)
|
|
156
|
+
.filter(Boolean)
|
|
157
|
+
.reduce((sum, r) => sum + r.counts.total, 0);
|
|
158
|
+
if (totalIssues === 0) {
|
|
159
|
+
console.log(chalk.green.bold(' ✅ All checks passed. Your code looks good!\n'));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
console.log(chalk.dim(` Found ${totalIssues} issue${totalIssues !== 1 ? 's' : ''} across ` +
|
|
163
|
+
`${report.totalFiles} file${report.totalFiles !== 1 ? 's' : ''}. ` +
|
|
164
|
+
`Run with --output json to export the full report.\n`));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
168
|
+
function scoreBar(score) {
|
|
169
|
+
const filled = Math.round(score / 10);
|
|
170
|
+
const empty = 10 - filled;
|
|
171
|
+
const color = score >= 90 ? chalk.green : score >= 70 ? chalk.yellow : chalk.red;
|
|
172
|
+
return color('█'.repeat(filled)) + chalk.gray('░'.repeat(empty));
|
|
173
|
+
}
|
|
174
|
+
function colorScore(score) {
|
|
175
|
+
if (score >= 90)
|
|
176
|
+
return chalk.green.bold;
|
|
177
|
+
if (score >= 70)
|
|
178
|
+
return chalk.yellow.bold;
|
|
179
|
+
if (score >= 50)
|
|
180
|
+
return chalk.yellow;
|
|
181
|
+
return chalk.red.bold;
|
|
182
|
+
}
|
|
183
|
+
function scoreLabel(score) {
|
|
184
|
+
if (score >= 90)
|
|
185
|
+
return chalk.green('Excellent ✓');
|
|
186
|
+
if (score >= 70)
|
|
187
|
+
return chalk.yellow('Good');
|
|
188
|
+
if (score >= 50)
|
|
189
|
+
return chalk.yellow('Needs work');
|
|
190
|
+
return chalk.red.bold('Critical issues found');
|
|
191
|
+
}
|
|
192
|
+
/** Show only the last 3 path segments to keep output readable. */
|
|
193
|
+
function shortPath(filePath) {
|
|
194
|
+
const parts = filePath.replace(/\\/g, '/').split('/');
|
|
195
|
+
return (parts.length > 3 ? '…/' : '') + parts.slice(-3).join('/');
|
|
196
|
+
}
|
|
197
|
+
function truncate(str, maxLen) {
|
|
198
|
+
return str.length > maxLen ? '…' + str.slice(-(maxLen - 1)) : str;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../src/reporter/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,iFAAiF;AAEjF,MAAM,YAAY,GAAgC;IAChD,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;IAC9C,KAAK,EAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;IACjD,KAAK,EAAK,KAAK,CAAC,MAAM,CAAC,KAAK,CAAM,YAAY,CAAC;CAChD,CAAC;AAEF,iFAAiF;AAEjF,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,WAAW,CAAC,MAAM,CAAC,CAAC;IACpB,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAE1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC3B,IAAI,OAAO,CAAC,WAAW;Q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G,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACpE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type AuditCategory = 'performance' | 'seo' | 'accessibility';
|
|
2
|
+
export type IssueImpact = 'critical' | 'major' | 'minor';
|
|
3
|
+
export type IssueStatus = 'fail' | 'warning';
|
|
4
|
+
export interface Issue {
|
|
5
|
+
id: string;
|
|
6
|
+
category: AuditCategory;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
impact: IssueImpact;
|
|
10
|
+
status: IssueStatus;
|
|
11
|
+
suggestion: string;
|
|
12
|
+
codeSnippet?: string;
|
|
13
|
+
fixSnippet?: string;
|
|
14
|
+
file?: string;
|
|
15
|
+
line?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface AuditResult {
|
|
18
|
+
category: AuditCategory;
|
|
19
|
+
score: number;
|
|
20
|
+
issues: Issue[];
|
|
21
|
+
counts: {
|
|
22
|
+
critical: number;
|
|
23
|
+
major: number;
|
|
24
|
+
minor: number;
|
|
25
|
+
total: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface AuditReport {
|
|
29
|
+
target: string;
|
|
30
|
+
timestamp: string;
|
|
31
|
+
overallScore: number;
|
|
32
|
+
totalFiles: number;
|
|
33
|
+
results: Partial<Record<AuditCategory, AuditResult>>;
|
|
34
|
+
}
|
|
35
|
+
export interface AuditOptions {
|
|
36
|
+
types: AuditCategory[];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,KAAK,GAAG,eAAe,CAAC;AACpE,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAI7C,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAID,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;CACtD;AAID,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "uiaudit.js",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A CLI and VS Code extension to audit React/Next.js Components",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"next.js",
|
|
8
|
+
"accessibility",
|
|
9
|
+
"performance",
|
|
10
|
+
"seo",
|
|
11
|
+
"audit"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Dheeraj p",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "ts-node src/index.ts",
|
|
20
|
+
"start": "node dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"uiaudit": "./dist/cli.js"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@babel/parser": "^7.29.7",
|
|
27
|
+
"@babel/traverse": "^7.29.7",
|
|
28
|
+
"chalk": "^4.1.2",
|
|
29
|
+
"commander": "^12.1.0",
|
|
30
|
+
"ora": "^5.4.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/types": "^7.29.7",
|
|
34
|
+
"@types/babel__traverse": "^7.28.0",
|
|
35
|
+
"@types/node": "^20.19.43",
|
|
36
|
+
"ts-node": "^10.9.2",
|
|
37
|
+
"typescript": "^5.9.3"
|
|
38
|
+
}
|
|
39
|
+
}
|