@casoon/auditmysite
Version:
Professional website analysis suite with robust accessibility testing, Core Web Vitals performance monitoring, SEO analysis, and content optimization insights. Features isolated browser contexts, retry mechanisms, and comprehensive API endpoints for profe
168 lines • 7.04 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.runStreamingAudit = runStreamingAudit;
const standard_pipeline_1 = require("../pipeline/standard-pipeline");
const streaming_reporter_1 = require("../reporting/streaming-reporter");
/**
* Handle streaming audit mode for Tauri integration
*/
async function runStreamingAudit(sitemapUrl, options) {
const sessionId = options.sessionId;
const chunkSize = parseInt(options.chunkSize) || 1000;
try {
// Initialize streaming reporter
const reporter = new streaming_reporter_1.StreamingReporter(process.stdout, sessionId, {
enabled: true,
chunkSize,
bufferTimeout: 1000,
includeDetailedResults: true,
compressResults: false
});
// Configuration for streaming mode
const config = {
maxPages: options.full ? 1000 : 5,
standard: 'WCAG2AA',
format: options.format || 'json',
outputDir: options.outputDir || './reports',
timeout: 10000,
maxConcurrent: 2,
generateDetailedReport: true,
generatePerformanceReport: true,
generateSeoReport: false,
generateSecurityReport: false,
verbose: options.verbose || false,
collectPerformanceMetrics: true,
// Enhanced v1.3 features enabled
modernHtml5: true,
ariaEnhanced: true,
chrome135Features: true,
semanticAnalysis: true
};
// Initialize pipeline
const pipeline = new standard_pipeline_1.StandardPipeline();
// Get URL count from sitemap first
let urlCount = config.maxPages;
try {
const { SitemapParser } = await Promise.resolve().then(() => __importStar(require('../../parsers/sitemap-parser')));
const sitemapParser = new SitemapParser();
const urls = await sitemapParser.parseSitemap(sitemapUrl);
urlCount = Math.min(urls.length, config.maxPages);
}
catch (error) {
// Continue with default count
}
// Start streaming
reporter.init(urlCount, config);
// Mock progress reporting for now
// In real implementation, this would integrate with the pipeline
let current = 0;
const interval = setInterval(() => {
current++;
if (current <= urlCount) {
reporter.reportProgress({
current,
total: urlCount,
currentUrl: `${sitemapUrl.replace('/sitemap.xml', '')}/${current}`,
stage: current === urlCount ? 'generating_report' : 'testing_pages'
});
}
if (current > urlCount) {
clearInterval(interval);
// Complete streaming
const mockSummary = {
totalTime: Date.now() - Date.now(),
totalPages: urlCount,
successfulPages: Math.floor(urlCount * 0.8),
failedPages: Math.ceil(urlCount * 0.2),
summary: {
testedPages: urlCount,
passedPages: Math.floor(urlCount * 0.8),
failedPages: Math.ceil(urlCount * 0.2),
totalErrors: Math.ceil(urlCount * 0.1),
totalWarnings: Math.ceil(urlCount * 0.3),
avgAccessibilityScore: 85,
avgPerformanceScore: 78,
html5Analysis: {
totalModernElements: 45,
semanticStructureScore: 82,
detailsSummaryIssues: 1,
dialogAccessibilityIssues: 0,
modernUsagePercentage: 75
},
ariaAnalysis: {
totalAriaElements: 23,
ariaScore: 88,
criticalIssues: 0,
seriousIssues: 1,
moderateIssues: 2,
minorIssues: 3,
landmarkUsage: ['main', 'navigation', 'banner'],
modernAriaFeatures: true
},
chrome135Features: {
performanceOptimizations: true,
enhancedDialogSupport: true,
improvedAccessibilityTree: true
},
semanticQuality: {
overallSemanticScore: 80,
structuralComplexity: 'intermediate',
recommendationsCount: 5,
bestPracticesFollowed: 12
}
}
};
reporter.complete(mockSummary.summary, mockSummary.totalPages, mockSummary.successfulPages);
}
}, 2000);
}
catch (error) {
// Emit error event
const errorEvent = {
type: 'error',
sessionId,
timestamp: new Date().toISOString(),
data: {
error: error instanceof Error ? error.message : String(error),
stage: 'initialization',
recoverable: false
}
};
console.log(JSON.stringify(errorEvent));
process.exit(1);
}
}
//# sourceMappingURL=streaming-audit-handler.js.map