Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accessibility-checker

Package Overview
Dependencies
Maintainers
3
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accessibility-checker - npm Package Compare versions

Comparing version 3.1.29-rc.0 to 3.1.29

1

bin/achecker.js

@@ -65,3 +65,2 @@ #!/usr/bin/env node

var path = require("path");
var request = require("request");
var validCLParams = [

@@ -68,0 +67,0 @@ "inputFile"

30

lib/ACConfigManager.js

@@ -60,4 +60,4 @@ "use strict";

var ACConstants_1 = require("./ACConstants");
var uuid = require("uuid");
var request = require("request");
var uuid_1 = require("uuid");
var axios_1 = require("axios");
/**

@@ -115,3 +115,3 @@ * This function is responsible converting policies into an Array based on string or Array.

return __awaiter(this, void 0, void 0, function () {
var ruleServer, ruleArchiveFile, ruleArchiveParse, err_1, ruleArchivePath, ruleArchiveVersion, ruleArchive, i, errStr, errStr;
var ruleServer, ruleArchiveFile, ruleArchiveParse, response, err_1, ruleArchivePath, ruleArchiveVersion, ruleArchive, i, errStr, errStr;
return __generator(this, function (_a) {

@@ -133,24 +133,18 @@ switch (_a.label) {

case 1:
_a.trys.push([1, 3, , 4]);
_a.trys.push([1, 4, , 5]);
if (ACConfig.ignoreHTTPSErrors) {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
}
return [4 /*yield*/, new Promise(function (resolve, reject) {
request.get(ruleArchiveFile, function (error, response, body) {
if (error) {
reject(error);
}
else {
resolve(JSON.parse(body));
}
});
})];
return [4 /*yield*/, axios_1.default.get(ruleArchiveFile)];
case 2:
response = _a.sent();
return [4 /*yield*/, response.data];
case 3:
ruleArchiveParse = _a.sent();
return [3 /*break*/, 4];
case 3:
return [3 /*break*/, 5];
case 4:
err_1 = _a.sent();
console.log(err_1);
throw new Error(err_1);
case 4:
case 5:
ruleArchivePath = null;

@@ -229,3 +223,3 @@ ruleArchiveVersion = null;

// are done for a single run of karma.
config.scanID = uuid.v4();
config.scanID = (0, uuid_1.v4)();
for (var key in ACConstants_1.ACConstants) {

@@ -232,0 +226,0 @@ config[key] = config[key] || ACConstants_1.ACConstants[key];

@@ -41,5 +41,5 @@ "use strict";

var ACConfigManager_1 = require("./ACConfigManager");
var request = require("request");
var path = require("path");
var fs = require("fs");
var axios_1 = require("axios");
var ace;

@@ -134,3 +134,3 @@ var checker;

return __awaiter(this, void 0, void 0, function () {
var config;
var config, response, data, engineDir, cacheDir;
return __generator(this, function (_b) {

@@ -145,30 +145,33 @@ switch (_b.label) {

config = _b.sent();
return [2 /*return*/, new Promise(function (resolve, reject) {
request.get("".concat(config.rulePack, "/ace-node.js"), function (err, data) {
if (!data) {
console.log("Cannot read: " + "".concat(config.rulePack, "/ace-node.js"));
return [4 /*yield*/, axios_1.default.get("".concat(config.rulePack, "/ace-node.js"))];
case 2:
response = _b.sent();
return [4 /*yield*/, response.data];
case 3:
data = _b.sent();
engineDir = path.join(__dirname, "engine");
if (!fs.existsSync(engineDir)) {
fs.mkdirSync(engineDir);
}
cacheDir = path.join(engineDir, "cache");
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir);
}
return [4 /*yield*/, new Promise(function (resolve, reject) {
fs.writeFile(path.join(engineDir, "ace-node.js"), data, function (err) {
try {
err && console.log(err);
ace = require("./engine/ace-node");
checker = new ace.Checker();
}
data = data.body;
var engineDir = path.join(__dirname, "engine");
if (!fs.existsSync(engineDir)) {
fs.mkdirSync(engineDir);
catch (e) {
console.log(e);
return reject(e);
}
var cacheDir = path.join(engineDir, "cache");
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir);
}
fs.writeFile(path.join(engineDir, "ace-node.js"), data, function (err) {
try {
err && console.log(err);
ace = require("./engine/ace-node");
checker = new ace.Checker();
}
catch (e) {
console.log(e);
return reject(e);
}
resolve();
});
resolve();
});
})];
case 4:
_b.sent();
return [2 /*return*/];
}

@@ -175,0 +178,0 @@ });

@@ -16,2 +16,7 @@ /******************************************************************************

*****************************************************************************/
/*******************************************************************************
* NAME: ACMetricsLogger.js
* DESCRIPTION: Common Metrics logger object which can be shared between tools
* to upload metrics of the tool to the metrics server.
*******************************************************************************/
import { ILogger } from "../api/IChecker";

@@ -67,3 +72,3 @@ /**

*/
sendLogsV2(done: any, rulePack: any): void;
sendLogsV2(done: any, rulePack: any): Promise<void>;
}

@@ -17,11 +17,41 @@ "use strict";

*****************************************************************************/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ACMetricsLogger = void 0;
/*******************************************************************************
* NAME: ACMetricsLogger.js
* DESCRIPTION: Common Metrics logger object which can be shared between tools
* to upload metrics of the tool to the metrics server.
*******************************************************************************/
// Load required modules
var request = require("request");
var axios_1 = require("axios");
/**

@@ -87,57 +117,61 @@ * This function is responsible for constructing the accessibility-checker Metrics object which contains all the function

ACMetricsLogger.prototype.sendLogsV2 = function (done, rulePack) {
this.log.debug("START 'sendLogsV2' function");
// Copy this.log into loggerInScope so that it can be used in callback function
var loggerInScope = this.log;
try {
// Variable Decleration
var numProfiles_1 = 0;
var accountId = "";
// Loop over all the profiles with in the scanTime Object
for (var profile in this.scanTimesV2) {
var _loop_1 = function () {
// Build a truncatedScanTime Array to upload to the metrics server chunck by chunck
var subScanTimes = this_1.scanTimesV2[profile].splice(0, 150);
// Increment the num Profile
++numProfiles_1;
// Start building the Query string to be sent to the metrics server
var qs = "?t=" + this_1.toolName + "&tag=" + profile + "&a=" + accountId + "&pol=" + this_1.policies + "&st=";
subScanTimes.forEach(function (t) {
qs += t;
qs += ",";
});
qs = qs.substr(0, qs.length - 1);
this_1.log.debug("Uploading: " + this_1.metricsURLV2 + "/api/pub/meter/v2" + qs);
// Dispatch the call to the metrics server
// Istanbul is not able to capture the coverate of functions call in a callback therefore we need to skip
/* istanbul ignore next */
request.get(this_1.metricsURLV2 + "/api/pub/meter/v2" + qs, function () {
// Decrement the numProfiles to identify that scan has finished
--numProfiles_1;
// Once all metrics for all profiles have been uploaded we end this function call
if (numProfiles_1 === 0) {
loggerInScope.debug("END 'sendLogsV2' function");
done && done();
return __awaiter(this, void 0, void 0, function () {
var loggerInScope, numProfiles_1, accountId, profile, _loop_1, this_1;
return __generator(this, function (_a) {
this.log.debug("START 'sendLogsV2' function");
loggerInScope = this.log;
try {
numProfiles_1 = 0;
accountId = "";
// Loop over all the profiles with in the scanTime Object
for (profile in this.scanTimesV2) {
_loop_1 = function () {
// Build a truncatedScanTime Array to upload to the metrics server chunck by chunck
var subScanTimes = this_1.scanTimesV2[profile].splice(0, 150);
// Increment the num Profile
++numProfiles_1;
// Start building the Query string to be sent to the metrics server
var qs = "?t=" + this_1.toolName + "&tag=" + profile + "&a=" + accountId + "&pol=" + this_1.policies + "&st=";
subScanTimes.forEach(function (t) {
qs += t;
qs += ",";
});
qs = qs.substr(0, qs.length - 1);
this_1.log.debug("Uploading: " + this_1.metricsURLV2 + "/api/pub/meter/v2" + qs);
// Dispatch the call to the metrics server
// Istanbul is not able to capture the coverate of functions call in a callback therefore we need to skip
/* istanbul ignore next */
axios_1.default.get(this_1.metricsURLV2 + "/api/pub/meter/v2" + qs).then(function () {
// Decrement the numProfiles to identify that scan has finished
--numProfiles_1;
// Once all metrics for all profiles have been uploaded we end this function call
if (numProfiles_1 === 0) {
loggerInScope.debug("END 'sendLogsV2' function");
done && done();
}
});
};
this_1 = this;
// Loop over all the V2 Scan Times until it reaches 0
while (this.scanTimesV2[profile].length > 0) {
_loop_1();
}
});
};
var this_1 = this;
// Loop over all the V2 Scan Times until it reaches 0
while (this.scanTimesV2[profile].length > 0) {
_loop_1();
}
// Once all metrics for all profiles have been uploaded we end this function call
if (numProfiles_1 === 0) {
this.log.debug("END 'sendLogsV2' function");
done && done();
}
}
}
// Once all metrics for all profiles have been uploaded we end this function call
if (numProfiles_1 === 0) {
this.log.debug("END 'sendLogsV2' function");
done && done();
}
}
catch (e) {
/* istanbul ignore next */
this.log.debug("Error uploading metrics logs: " + e);
/* istanbul ignore next */
this.log.debug("END 'sendLogsV2' function");
/* istanbul ignore next */
done && done();
}
catch (e) {
/* istanbul ignore next */
this.log.debug("Error uploading metrics logs: " + e);
/* istanbul ignore next */
this.log.debug("END 'sendLogsV2' function");
/* istanbul ignore next */
done && done();
}
return [2 /*return*/];
});
});
};

@@ -144,0 +178,0 @@ ;

{
"name": "accessibility-checker",
"version": "3.1.29-rc.0",
"version": "3.1.29",
"description": "An automated testing tools for accessibility testing using Puppeteer, Selenium, or Zombie",

@@ -21,2 +21,3 @@ "main": "index.js",

"dependencies": {
"axios": "^0.27.2",
"chromedriver": "*",

@@ -26,3 +27,2 @@ "deep-diff": "^1.0.2",

"puppeteer": "^13.0.0",
"request": "^2.88.2",
"uuid": "^8.3.2"

@@ -29,0 +29,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc