@navinjoseph/web-perf-core 1.0.0-beta.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/dist/audits/accessibility.d.ts +10 -0
- package/dist/audits/accessibility.d.ts.map +1 -0
- package/dist/audits/accessibility.js +258 -0
- package/dist/audits/accessibility.js.map +1 -0
- package/dist/audits/best-practices.d.ts +10 -0
- package/dist/audits/best-practices.d.ts.map +1 -0
- package/dist/audits/best-practices.js +696 -0
- package/dist/audits/best-practices.js.map +1 -0
- package/dist/audits/constants.d.ts +8 -0
- package/dist/audits/constants.d.ts.map +1 -0
- package/dist/audits/constants.js +278 -0
- package/dist/audits/constants.js.map +1 -0
- package/dist/audits/performance.d.ts +11 -0
- package/dist/audits/performance.d.ts.map +1 -0
- package/dist/audits/performance.js +497 -0
- package/dist/audits/performance.js.map +1 -0
- package/dist/audits/pwa.d.ts +10 -0
- package/dist/audits/pwa.d.ts.map +1 -0
- package/dist/audits/pwa.js +396 -0
- package/dist/audits/pwa.js.map +1 -0
- package/dist/audits/security.d.ts +10 -0
- package/dist/audits/security.d.ts.map +1 -0
- package/dist/audits/security.js +249 -0
- package/dist/audits/security.js.map +1 -0
- package/dist/audits/seo.d.ts +10 -0
- package/dist/audits/seo.d.ts.map +1 -0
- package/dist/audits/seo.js +471 -0
- package/dist/audits/seo.js.map +1 -0
- package/dist/browser.d.ts +21 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +178 -0
- package/dist/browser.js.map +1 -0
- package/dist/dom-collector.d.ts +45 -0
- package/dist/dom-collector.d.ts.map +1 -0
- package/dist/dom-collector.js +173 -0
- package/dist/dom-collector.js.map +1 -0
- package/dist/formatter.d.ts +60 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +164 -0
- package/dist/formatter.js.map +1 -0
- package/dist/id-generator.d.ts +22 -0
- package/dist/id-generator.d.ts.map +1 -0
- package/dist/id-generator.js +29 -0
- package/dist/id-generator.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator.d.ts +41 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +194 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/reporters/html.d.ts +6 -0
- package/dist/reporters/html.d.ts.map +1 -0
- package/dist/reporters/html.js +688 -0
- package/dist/reporters/html.js.map +1 -0
- package/dist/reporters/index.d.ts +4 -0
- package/dist/reporters/index.d.ts.map +1 -0
- package/dist/reporters/index.js +17 -0
- package/dist/reporters/index.js.map +1 -0
- package/dist/reporters/json.d.ts +6 -0
- package/dist/reporters/json.d.ts.map +1 -0
- package/dist/reporters/json.js +7 -0
- package/dist/reporters/json.js.map +1 -0
- package/dist/reporters/terminal.d.ts +6 -0
- package/dist/reporters/terminal.d.ts.map +1 -0
- package/dist/reporters/terminal.js +180 -0
- package/dist/reporters/terminal.js.map +1 -0
- package/dist/reporters/types.d.ts +2 -0
- package/dist/reporters/types.d.ts.map +1 -0
- package/dist/reporters/types.js +2 -0
- package/dist/reporters/types.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +36 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Efficient ID generator for issues
|
|
3
|
+
* Uses incremental counter instead of Date.now() for better performance
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Reset the issue counter (useful for testing)
|
|
7
|
+
*/
|
|
8
|
+
export declare function resetIssueCounter(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a unique issue ID
|
|
11
|
+
* @param prefix - Prefix for the ID (e.g., "a11y", "perf", "bp")
|
|
12
|
+
* @returns Unique ID string
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateIssueId(prefix: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Generate ID with additional context
|
|
17
|
+
* @param prefix - Prefix for the ID
|
|
18
|
+
* @param context - Additional context (e.g., rule ID, element index)
|
|
19
|
+
* @returns Unique ID string
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateContextualId(prefix: string, context: string): string;
|
|
22
|
+
//# sourceMappingURL=id-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../src/id-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Efficient ID generator for issues
|
|
3
|
+
* Uses incremental counter instead of Date.now() for better performance
|
|
4
|
+
*/
|
|
5
|
+
let issueCounter = 0;
|
|
6
|
+
/**
|
|
7
|
+
* Reset the issue counter (useful for testing)
|
|
8
|
+
*/
|
|
9
|
+
export function resetIssueCounter() {
|
|
10
|
+
issueCounter = 0;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generate a unique issue ID
|
|
14
|
+
* @param prefix - Prefix for the ID (e.g., "a11y", "perf", "bp")
|
|
15
|
+
* @returns Unique ID string
|
|
16
|
+
*/
|
|
17
|
+
export function generateIssueId(prefix) {
|
|
18
|
+
return `${prefix}-${++issueCounter}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generate ID with additional context
|
|
22
|
+
* @param prefix - Prefix for the ID
|
|
23
|
+
* @param context - Additional context (e.g., rule ID, element index)
|
|
24
|
+
* @returns Unique ID string
|
|
25
|
+
*/
|
|
26
|
+
export function generateContextualId(prefix, context) {
|
|
27
|
+
return `${prefix}-${context}-${++issueCounter}`;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=id-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-generator.js","sourceRoot":"","sources":["../src/id-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,YAAY,GAAG,CAAC,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,GAAG,MAAM,IAAI,EAAE,YAAY,EAAE,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,OAAe;IAClE,OAAO,GAAG,MAAM,IAAI,OAAO,IAAI,EAAE,YAAY,EAAE,CAAC;AAClD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./browser.js";
|
|
3
|
+
export { auditAccessibility } from "./audits/accessibility.js";
|
|
4
|
+
export { auditSEO } from "./audits/seo.js";
|
|
5
|
+
export { auditSecurity } from "./audits/security.js";
|
|
6
|
+
export { auditPerformance } from "./audits/performance.js";
|
|
7
|
+
export { auditBestPractices } from "./audits/best-practices.js";
|
|
8
|
+
export { auditPWA } from "./audits/pwa.js";
|
|
9
|
+
export { WCAG_MAPPINGS } from "./audits/constants.js";
|
|
10
|
+
export * from "./formatter.js";
|
|
11
|
+
export * from "./orchestrator.js";
|
|
12
|
+
export * from "./reporters/terminal.js";
|
|
13
|
+
export * from "./reporters/json.js";
|
|
14
|
+
export * from "./reporters/html.js";
|
|
15
|
+
export * from "./reporters/index.js";
|
|
16
|
+
export * from "./reporters/types.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,cAAc,gBAAgB,CAAC;AAG/B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Core types
|
|
2
|
+
export * from "./types.js";
|
|
3
|
+
// Browser utilities
|
|
4
|
+
export * from "./browser.js";
|
|
5
|
+
// Audit modules
|
|
6
|
+
export { auditAccessibility } from "./audits/accessibility.js";
|
|
7
|
+
export { auditSEO } from "./audits/seo.js";
|
|
8
|
+
export { auditSecurity } from "./audits/security.js";
|
|
9
|
+
export { auditPerformance } from "./audits/performance.js";
|
|
10
|
+
export { auditBestPractices } from "./audits/best-practices.js";
|
|
11
|
+
export { auditPWA } from "./audits/pwa.js";
|
|
12
|
+
export { WCAG_MAPPINGS } from "./audits/constants.js";
|
|
13
|
+
// Result formatter
|
|
14
|
+
export * from "./formatter.js";
|
|
15
|
+
// Audit orchestrator
|
|
16
|
+
export * from "./orchestrator.js";
|
|
17
|
+
// Reporters
|
|
18
|
+
export * from "./reporters/terminal.js";
|
|
19
|
+
export * from "./reporters/json.js";
|
|
20
|
+
export * from "./reporters/html.js";
|
|
21
|
+
export * from "./reporters/index.js";
|
|
22
|
+
export * from "./reporters/types.js";
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,oBAAoB;AACpB,cAAc,cAAc,CAAC;AAE7B,gBAAgB;AAChB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,mBAAmB;AACnB,cAAc,gBAAgB,CAAC;AAE/B,qBAAqB;AACrB,cAAc,mBAAmB,CAAC;AAElC,YAAY;AACZ,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AuditReport } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Available audit types
|
|
4
|
+
*/
|
|
5
|
+
export type AuditType = "accessibility" | "performance" | "seo" | "security" | "best-practices" | "pwa";
|
|
6
|
+
/**
|
|
7
|
+
* Audit options
|
|
8
|
+
*/
|
|
9
|
+
export interface AuditOptions {
|
|
10
|
+
/** Audits to skip */
|
|
11
|
+
skipAudits?: AuditType[];
|
|
12
|
+
/** Maximum time to wait for page load in milliseconds (default: 10000) */
|
|
13
|
+
timeout?: number;
|
|
14
|
+
/** Maximum page size in bytes (default: 10MB) */
|
|
15
|
+
maxSize?: number;
|
|
16
|
+
/** Maximum time for all audits to complete in milliseconds (default: 60000) */
|
|
17
|
+
auditTimeout?: number;
|
|
18
|
+
/** Whether to allow JavaScript execution on the page */
|
|
19
|
+
allowJs?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run a specific subset of audits
|
|
23
|
+
*/
|
|
24
|
+
export declare function runSpecificAudits(url: string, audits: AuditType[], options?: AuditOptions): Promise<AuditReport>;
|
|
25
|
+
/**
|
|
26
|
+
* Get audit metadata
|
|
27
|
+
*/
|
|
28
|
+
export declare function getAuditInfo(auditType: AuditType): {
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
category: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Get all available audit types
|
|
35
|
+
*/
|
|
36
|
+
export declare function getAvailableAudits(): AuditType[];
|
|
37
|
+
/**
|
|
38
|
+
* Run all audits on a page
|
|
39
|
+
*/
|
|
40
|
+
export declare function runAudits(url: string, options?: AuditOptions): Promise<AuditReport>;
|
|
41
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAuB,MAAM,YAAY,CAAC;AAU9D;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,aAAa,GACb,KAAK,GACL,UAAU,GACV,gBAAgB,GAChB,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAoED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CActB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CA4CA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,SAAS,EAAE,CAShD;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAoFtB"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { loadPage } from "./browser.js";
|
|
2
|
+
import { auditAccessibility } from "./audits/accessibility.js";
|
|
3
|
+
import { auditSEO } from "./audits/seo.js";
|
|
4
|
+
import { auditSecurity } from "./audits/security.js";
|
|
5
|
+
import { auditPerformance } from "./audits/performance.js";
|
|
6
|
+
import { auditBestPractices } from "./audits/best-practices.js";
|
|
7
|
+
import { auditPWA } from "./audits/pwa.js";
|
|
8
|
+
import { formatResults, mergeAuditResults } from "./formatter.js";
|
|
9
|
+
/**
|
|
10
|
+
* Run a single audit with error handling
|
|
11
|
+
*/
|
|
12
|
+
async function runSingleAudit(page, auditType) {
|
|
13
|
+
const startTime = Date.now();
|
|
14
|
+
try {
|
|
15
|
+
let result;
|
|
16
|
+
switch (auditType) {
|
|
17
|
+
case "accessibility":
|
|
18
|
+
result = await auditAccessibility(page);
|
|
19
|
+
break;
|
|
20
|
+
case "performance":
|
|
21
|
+
result = await auditPerformance(page);
|
|
22
|
+
break;
|
|
23
|
+
case "seo":
|
|
24
|
+
result = await auditSEO(page);
|
|
25
|
+
break;
|
|
26
|
+
case "security":
|
|
27
|
+
result = await auditSecurity(page);
|
|
28
|
+
break;
|
|
29
|
+
case "best-practices":
|
|
30
|
+
result = await auditBestPractices(page);
|
|
31
|
+
break;
|
|
32
|
+
case "pwa":
|
|
33
|
+
result = await auditPWA(page);
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
throw new Error(`Unknown audit type: ${auditType}`);
|
|
37
|
+
}
|
|
38
|
+
const duration = Date.now() - startTime;
|
|
39
|
+
return {
|
|
40
|
+
type: auditType,
|
|
41
|
+
issues: result.issues,
|
|
42
|
+
passed: result.passed,
|
|
43
|
+
duration,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const duration = Date.now() - startTime;
|
|
48
|
+
return {
|
|
49
|
+
type: auditType,
|
|
50
|
+
issues: [],
|
|
51
|
+
passed: [],
|
|
52
|
+
duration,
|
|
53
|
+
error: error instanceof Error ? error.message : String(error),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Run a specific subset of audits
|
|
59
|
+
*/
|
|
60
|
+
export async function runSpecificAudits(url, audits, options = {}) {
|
|
61
|
+
// Calculate which audits to skip
|
|
62
|
+
const allAudits = [
|
|
63
|
+
"accessibility",
|
|
64
|
+
"performance",
|
|
65
|
+
"seo",
|
|
66
|
+
"security",
|
|
67
|
+
"best-practices",
|
|
68
|
+
"pwa",
|
|
69
|
+
];
|
|
70
|
+
const skipAudits = allAudits.filter((audit) => !audits.includes(audit));
|
|
71
|
+
return runAudits(url, { ...options, skipAudits });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get audit metadata
|
|
75
|
+
*/
|
|
76
|
+
export function getAuditInfo(auditType) {
|
|
77
|
+
const auditInfo = {
|
|
78
|
+
accessibility: {
|
|
79
|
+
name: "Accessibility",
|
|
80
|
+
description: "Checks WCAG 2.1 compliance using axe-core, covering images, interactive elements, forms, color contrast, ARIA, and document structure",
|
|
81
|
+
category: "Compliance",
|
|
82
|
+
},
|
|
83
|
+
performance: {
|
|
84
|
+
name: "Performance",
|
|
85
|
+
description: "Analyzes page performance including resource optimization, image loading, JavaScript efficiency, and layout stability",
|
|
86
|
+
category: "Speed",
|
|
87
|
+
},
|
|
88
|
+
seo: {
|
|
89
|
+
name: "SEO",
|
|
90
|
+
description: "Validates SEO best practices including meta tags, headings, structured data, and crawlability",
|
|
91
|
+
category: "Discoverability",
|
|
92
|
+
},
|
|
93
|
+
security: {
|
|
94
|
+
name: "Security",
|
|
95
|
+
description: "Checks security headers, HTTPS usage, mixed content, and password field security",
|
|
96
|
+
category: "Safety",
|
|
97
|
+
},
|
|
98
|
+
"best-practices": {
|
|
99
|
+
name: "Best Practices",
|
|
100
|
+
description: "Validates HTML standards, deprecated elements, unique IDs, and modern web development practices",
|
|
101
|
+
category: "Quality",
|
|
102
|
+
},
|
|
103
|
+
pwa: {
|
|
104
|
+
name: "Progressive Web App",
|
|
105
|
+
description: "Checks PWA requirements including manifest, service worker, HTTPS, and mobile optimization",
|
|
106
|
+
category: "Installability",
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
return auditInfo[auditType];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get all available audit types
|
|
113
|
+
*/
|
|
114
|
+
export function getAvailableAudits() {
|
|
115
|
+
return [
|
|
116
|
+
"accessibility",
|
|
117
|
+
"performance",
|
|
118
|
+
"seo",
|
|
119
|
+
"security",
|
|
120
|
+
"best-practices",
|
|
121
|
+
"pwa",
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Run all audits on a page
|
|
126
|
+
*/
|
|
127
|
+
export async function runAudits(url, options = {}) {
|
|
128
|
+
const startTime = Date.now();
|
|
129
|
+
const skipAudits = options.skipAudits || [];
|
|
130
|
+
const auditTimeout = options.auditTimeout || 60000; // 60 second default
|
|
131
|
+
// Load the page with timeout and size limits
|
|
132
|
+
const page = await loadPage(url, {
|
|
133
|
+
timeout: options.timeout,
|
|
134
|
+
maxSize: options.maxSize,
|
|
135
|
+
allowJs: options.allowJs,
|
|
136
|
+
});
|
|
137
|
+
// TODO: Collect all DOM elements once for performance optimization
|
|
138
|
+
// const collectedElements = collectDOMElements(page);
|
|
139
|
+
// Determine which audits to run
|
|
140
|
+
const auditsToRun = [
|
|
141
|
+
"accessibility",
|
|
142
|
+
"performance",
|
|
143
|
+
"seo",
|
|
144
|
+
"security",
|
|
145
|
+
"best-practices",
|
|
146
|
+
"pwa",
|
|
147
|
+
].filter((audit) => !skipAudits.includes(audit));
|
|
148
|
+
// Run all audits in parallel with timeout
|
|
149
|
+
const auditPromises = auditsToRun.map((auditType) => runSingleAudit(page, auditType));
|
|
150
|
+
// Create timeout promise
|
|
151
|
+
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Audit timeout after ${auditTimeout}ms`)), auditTimeout));
|
|
152
|
+
const auditResults = await Promise.race([
|
|
153
|
+
Promise.all(auditPromises),
|
|
154
|
+
timeoutPromise,
|
|
155
|
+
]);
|
|
156
|
+
// Merge all results
|
|
157
|
+
const allResults = auditResults.map((result) => ({
|
|
158
|
+
issues: result.issues,
|
|
159
|
+
passed: result.passed,
|
|
160
|
+
}));
|
|
161
|
+
const { issues, passed } = mergeAuditResults(allResults);
|
|
162
|
+
// Handle incomplete audits (audits that errored)
|
|
163
|
+
const incomplete = auditResults
|
|
164
|
+
.filter((result) => result.error)
|
|
165
|
+
.map((result) => ({
|
|
166
|
+
id: `audit-error-${result.type}`,
|
|
167
|
+
ruleId: "audit-error",
|
|
168
|
+
severity: "serious",
|
|
169
|
+
category: "technical",
|
|
170
|
+
message: `${result.type} audit failed`,
|
|
171
|
+
description: `The ${result.type} audit could not complete: ${result.error}`,
|
|
172
|
+
helpUrl: "",
|
|
173
|
+
wcag: {
|
|
174
|
+
id: "N/A",
|
|
175
|
+
level: "A",
|
|
176
|
+
name: "Audit Error",
|
|
177
|
+
description: "Audit could not complete",
|
|
178
|
+
},
|
|
179
|
+
element: {
|
|
180
|
+
selector: "",
|
|
181
|
+
html: "",
|
|
182
|
+
failureSummary: result.error || "Unknown error",
|
|
183
|
+
},
|
|
184
|
+
fix: {
|
|
185
|
+
description: "Check the error message for details",
|
|
186
|
+
code: "",
|
|
187
|
+
learnMoreUrl: "",
|
|
188
|
+
},
|
|
189
|
+
}));
|
|
190
|
+
const endTime = Date.now();
|
|
191
|
+
// Format and return the complete report
|
|
192
|
+
return formatResults(url, startTime, endTime, issues, passed, incomplete);
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAyClE;;GAEG;AACH,KAAK,UAAU,cAAc,CAC3B,IAAiB,EACjB,SAAoB;IAEpB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,IAAI,MAAmD,CAAC;QAExD,QAAQ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