Comparing version
441
lib/index.js
"use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
// eslint-disable-next-line import/no-unassigned-import | ||
require('console-polyfill'); | ||
var cuid = require('cuid'); | ||
const cuid = require('cuid'); | ||
var format = require('@ladjs/format-util'); | ||
const format = require('@ladjs/format-util'); | ||
var formatSpecifiers = require('format-specifiers'); | ||
const formatSpecifiers = require('format-specifiers'); | ||
var isError = require('iserror'); | ||
const isError = require('iserror'); | ||
var omit = require('lodash.omit'); | ||
const omit = require('lodash.omit'); | ||
var parseAppInfo = require('parse-app-info'); | ||
const parseAppInfo = require('parse-app-info'); | ||
var parseErr = require('parse-err'); | ||
const parseErr = require('parse-err'); | ||
var safeStringify = require('fast-safe-stringify'); | ||
const safeStringify = require('fast-safe-stringify'); | ||
var superagent = require('superagent'); | ||
const superagent = require('superagent'); | ||
var _require = require('boolean'), | ||
boolean = _require.boolean; | ||
const { | ||
boolean | ||
} = require('boolean'); | ||
var pkg = require('../package.json'); | ||
const pkg = require('../package.json'); | ||
var omittedLoggerKeys = new Set(['config', 'log']); | ||
var levels = ['trace', 'debug', 'info', 'warn', 'error', 'fatal']; | ||
var aliases = { | ||
const omittedLoggerKeys = new Set(['config', 'log']); | ||
const levels = ['trace', 'debug', 'info', 'warn', 'error', 'fatal']; | ||
const aliases = { | ||
warning: 'warn', | ||
err: 'error' | ||
}; | ||
var endpoint = 'https://api.cabinjs.com'; | ||
var levelError = "`level` invalid, must be: ".concat(levels.join(', ')); // <https://stackoverflow.com/a/43233163> | ||
const endpoint = 'https://api.cabinjs.com'; | ||
const levelError = "`level` invalid, must be: ".concat(levels.join(', ')); // <https://stackoverflow.com/a/43233163> | ||
function isEmpty(value) { | ||
return value === undefined || value === null || _typeof(value) === 'object' && Object.keys(value).length === 0 || typeof value === 'string' && value.trim().length === 0; | ||
return value === undefined || value === null || typeof value === 'object' && Object.keys(value).length === 0 || typeof value === 'string' && value.trim().length === 0; | ||
} | ||
@@ -73,3 +52,3 @@ | ||
function isObject(value) { | ||
return _typeof(value) === 'object' && value !== null && !Array.isArray(value); | ||
return typeof value === 'object' && value !== null && !Array.isArray(value); | ||
} | ||
@@ -89,13 +68,10 @@ | ||
var Axe = /*#__PURE__*/function () { | ||
function Axe() { | ||
class Axe { | ||
constructor() { | ||
var _this = this; | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
_classCallCheck(this, Axe); | ||
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
this.config = Object.assign({ | ||
key: '', | ||
endpoint: endpoint, | ||
endpoint, | ||
headers: {}, | ||
@@ -108,5 +84,3 @@ timeout: 5000, | ||
showApp: process.env.SHOW_META_APP ? boolean(process.env.SHOW_META_APP) : false, | ||
omittedFields: process.env.OMIT_META_FIELDS ? process.env.OMIT_META_FIELDS.split(',').map(function (s) { | ||
return s.trim(); | ||
}) : [] | ||
omittedFields: process.env.OMIT_META_FIELDS ? process.env.OMIT_META_FIELDS.split(',').map(s => s.trim()) : [] | ||
}, | ||
@@ -132,47 +106,20 @@ silent: false, | ||
var methods = Object.keys(this.config.logger).filter(function (key) { | ||
return !omittedLoggerKeys.has(key); | ||
}); | ||
const methods = Object.keys(this.config.logger).filter(key => !omittedLoggerKeys.has(key)); | ||
var _iterator = _createForOfIteratorHelper(methods), | ||
_step; | ||
for (const element of methods) { | ||
this[element] = this.config.logger[element]; | ||
} // Bind helper functions for each log level | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var element = _step.value; | ||
this[element] = this.config.logger[element]; | ||
} // Bind helper functions for each log level | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
for (const element of levels) { | ||
this[element] = function () { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var _iterator2 = _createForOfIteratorHelper(levels), | ||
_step2; | ||
try { | ||
var _loop = function _loop() { | ||
var element = _step2.value; | ||
_this[element] = function () { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _this.log.apply(_this, _toConsumableArray([element].concat(Array.prototype.slice.call(args)))); | ||
}; | ||
return _this.log(element, ...Array.prototype.slice.call(args)); | ||
}; | ||
} // We could have used `auto-bind` but it's not compiled for browser | ||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | ||
_loop(); | ||
} // We could have used `auto-bind` but it's not compiled for browser | ||
} catch (err) { | ||
_iterator2.e(err); | ||
} finally { | ||
_iterator2.f(); | ||
} | ||
this.setLevel = this.setLevel.bind(this); | ||
@@ -191,203 +138,199 @@ this.getNormalizedLevel = this.getNormalizedLevel.bind(this); | ||
_createClass(Axe, [{ | ||
key: "setCallback", | ||
value: function setCallback(callback) { | ||
this.config.callback = callback; | ||
} | ||
}, { | ||
key: "setLevel", | ||
value: function setLevel(level) { | ||
if (!isString(level) || !levels.includes(level)) throw new Error(levelError); // Support signale logger and other loggers that use `logLevel` | ||
setCallback(callback) { | ||
this.config.callback = callback; | ||
} | ||
if (isString(this.config.logger.logLevel)) this.config.logger.logLevel = level;else this.config.logger.level = level; // Adjusts `this.config.levels` array | ||
// so that it has all proceeding (inclusive) | ||
setLevel(level) { | ||
if (!isString(level) || !levels.includes(level)) throw new Error(levelError); // Support signale logger and other loggers that use `logLevel` | ||
this.config.levels = levels.slice(levels.indexOf(level)); | ||
} | ||
}, { | ||
key: "getNormalizedLevel", | ||
value: function getNormalizedLevel(level) { | ||
if (!isString(level)) return 'info'; | ||
if (isString(aliases[level])) return aliases[level]; | ||
if (!levels.includes(level)) return 'info'; | ||
return level; | ||
} | ||
}, { | ||
key: "setName", | ||
value: function setName(name) { | ||
if (!isString(name)) throw new Error('`name` must be a String'); // Support signale logger and other loggers that use `scope` | ||
if (isString(this.config.logger.logLevel)) this.config.logger.logLevel = level;else this.config.logger.level = level; // Adjusts `this.config.levels` array | ||
// so that it has all proceeding (inclusive) | ||
if (isString(this.config.logger.scope)) this.config.logger.scope = name;else this.config.logger.name = name; | ||
} // eslint-disable-next-line complexity | ||
this.config.levels = levels.slice(levels.indexOf(level)); | ||
} | ||
}, { | ||
key: "log", | ||
value: function log(level, message, meta) { | ||
var _this2 = this; | ||
getNormalizedLevel(level) { | ||
if (!isString(level)) return 'info'; | ||
if (isString(aliases[level])) return aliases[level]; | ||
if (!levels.includes(level)) return 'info'; | ||
return level; | ||
} | ||
var originalArgs = []; | ||
if (!isUndefined(level)) originalArgs.push(level); | ||
if (!isUndefined(message)) originalArgs.push(message); | ||
if (!isUndefined(meta)) originalArgs.push(meta); | ||
setName(name) { | ||
if (!isString(name)) throw new Error('`name` must be a String'); // Support signale logger and other loggers that use `scope` | ||
for (var _len2 = arguments.length, args = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { | ||
args[_key2 - 3] = arguments[_key2]; | ||
} | ||
if (isString(this.config.logger.scope)) this.config.logger.scope = name;else this.config.logger.name = name; | ||
} // eslint-disable-next-line complexity | ||
originalArgs = originalArgs.concat(Array.prototype.slice.call(args)); | ||
var config = this.config; | ||
var modifier = 0; | ||
if (isString(level) && isString(aliases[level])) { | ||
level = aliases[level]; | ||
} else if (isError(level)) { | ||
meta = message; | ||
message = level; | ||
level = 'error'; | ||
} else if (!isString(level) || !levels.includes(level)) { | ||
meta = message; | ||
message = level; | ||
level = this.getNormalizedLevel(level); | ||
modifier = -1; | ||
} // Bunyan support (meta, message, ...args) | ||
log(level, message, meta) { | ||
const originalArgs = []; | ||
if (!isUndefined(level)) originalArgs.push(level); | ||
if (!isUndefined(message)) originalArgs.push(message); | ||
if (!isUndefined(meta)) originalArgs.push(meta); | ||
for (var _len2 = arguments.length, args = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { | ||
args[_key2 - 3] = arguments[_key2]; | ||
} | ||
var isBunyan = false; | ||
for (const arg of Array.prototype.slice.call(args)) { | ||
originalArgs.push(arg); | ||
} | ||
if ((isObject(message) || Array.isArray(message)) && isString(meta)) { | ||
isBunyan = true; | ||
var _meta = meta; | ||
meta = message; | ||
message = isString(_meta) && originalArgs.length >= 3 + modifier ? format.apply(void 0, _toConsumableArray(originalArgs.slice(2 + modifier))) : _meta; | ||
} // If message was undefined then set it to level | ||
const { | ||
config | ||
} = this; | ||
let modifier = 0; | ||
if (isString(level) && isString(aliases[level])) { | ||
level = aliases[level]; | ||
} else if (isError(level)) { | ||
meta = message; | ||
message = level; | ||
level = 'error'; | ||
} else if (!isString(level) || !levels.includes(level)) { | ||
meta = message; | ||
message = level; | ||
level = this.getNormalizedLevel(level); | ||
modifier = -1; | ||
} // Bunyan support (meta, message, ...args) | ||
if (isUndefined(message)) message = level; // If only `message` was passed then if it was an Object | ||
// preserve it as an Object by setting it as meta | ||
if (originalArgs.slice(1 + modifier).length === 1 && !isString(message) && !isError(message)) { | ||
let isBunyan = false; | ||
if ((isObject(message) || Array.isArray(message)) && isString(meta)) { | ||
isBunyan = true; | ||
const _meta = meta; | ||
meta = message; | ||
message = isString(_meta) && originalArgs.length >= 3 + modifier ? format(...originalArgs.slice(2 + modifier)) : _meta; | ||
} // If message was undefined then set it to level | ||
if (isUndefined(message)) message = level; // If only `message` was passed then if it was an Object | ||
// preserve it as an Object by setting it as meta | ||
if (originalArgs.slice(1 + modifier).length === 1 && !isString(message) && !isError(message)) { | ||
meta = { | ||
message | ||
}; | ||
message = level; | ||
} else if (!isBunyan && originalArgs.length >= 4 + modifier) { | ||
// If there are four or more args | ||
// then infer to use util.format on everything | ||
message = format(...originalArgs.slice(1 + modifier)); | ||
meta = {}; | ||
} else if (!isBunyan && originalArgs.length === 3 + modifier && isString(message) && formatSpecifiers.some(t => message.includes(t))) { | ||
// Otherwise if there are three args and if the `message` contains | ||
// a placeholder token (e.g. '%s' or '%d' - see above `formatSpecifiers` variable) | ||
// then we can infer that the `meta` arg passed is used for formatting | ||
message = format(message, meta); | ||
meta = {}; | ||
} else if (!isError(message)) { | ||
if (isError(meta)) { | ||
meta = { | ||
message: message | ||
}; | ||
message = level; | ||
} else if (!isBunyan && originalArgs.length >= 4 + modifier) { | ||
// If there are four or more args | ||
// then infer to use util.format on everything | ||
message = format.apply(void 0, _toConsumableArray(originalArgs.slice(1 + modifier))); | ||
meta = {}; | ||
} else if (!isBunyan && originalArgs.length === 3 + modifier && isString(message) && formatSpecifiers.some(function (t) { | ||
return message.includes(t); | ||
})) { | ||
// Otherwise if there are three args and if the `message` contains | ||
// a placeholder token (e.g. '%s' or '%d' - see above `formatSpecifiers` variable) | ||
// then we can infer that the `meta` arg passed is used for formatting | ||
err: parseErr(meta) | ||
}; // } else if (!isPlainObject(meta) && !isUndefined(meta) && !isNull(meta)) { | ||
} else if (!isObject(meta) && !isUndefined(meta) && !isNull(meta)) { | ||
// If the `meta` variable passed was not an Object then convert it | ||
message = format(message, meta); | ||
meta = {}; | ||
} else if (!isError(message)) { | ||
if (isError(meta)) { | ||
meta = { | ||
err: parseErr(meta) | ||
}; // } else if (!isPlainObject(meta) && !isUndefined(meta) && !isNull(meta)) { | ||
} else if (!isObject(meta) && !isUndefined(meta) && !isNull(meta)) { | ||
// If the `meta` variable passed was not an Object then convert it | ||
message = format(message, meta); | ||
meta = {}; | ||
} else if (!isString(message)) { | ||
// If the message is not a string then we should run `util.format` on it | ||
// assuming we're formatting it like it was another argument | ||
// (as opposed to using something like fast-json-stringify) | ||
message = format(message); | ||
} | ||
} // If (!isPlainObject(meta)) meta = {}; | ||
} else if (!isString(message)) { | ||
// If the message is not a string then we should run `util.format` on it | ||
// assuming we're formatting it like it was another argument | ||
// (as opposed to using something like fast-json-stringify) | ||
message = format(message); | ||
} | ||
} // If (!isPlainObject(meta)) meta = {}; | ||
if (!isUndefined(meta) && !isObject(meta)) meta = { | ||
meta: meta | ||
};else if (!isObject(meta)) meta = {}; | ||
var error; | ||
if (!isUndefined(meta) && !isObject(meta)) meta = { | ||
meta | ||
};else if (!isObject(meta)) meta = {}; | ||
const hadErrorInMeta = isObject(meta.err); | ||
let error; | ||
if (isError(message)) { | ||
error = message; | ||
if (!isObject(meta.err)) meta.err = parseErr(error); | ||
var _message = message; | ||
message = _message.message; | ||
} else if (isError(meta.err)) { | ||
error = meta.err; | ||
} // Omit `callback` from `meta` if it was passed | ||
if (isError(message)) { | ||
error = message; | ||
if (!hadErrorInMeta) meta.err = parseErr(error); | ||
({ | ||
message | ||
} = message); | ||
} else if (isError(meta.err)) { | ||
error = meta.err; | ||
} // Omit `callback` from `meta` if it was passed | ||
var callback = isFunction(config.callback) && (!isBoolean(meta.callback) || meta.callback); | ||
meta = omit(meta, ['callback']); // Set default level on meta | ||
const callback = isFunction(config.callback) && (!isBoolean(meta.callback) || meta.callback); | ||
meta = omit(meta, ['callback']); // Set default level on meta | ||
meta.level = level; // Add `app` object to metadata | ||
meta.level = level; // Add `app` object to metadata | ||
if (this.appInfo) meta.app = this.appInfo; // Set the body used for returning with and sending logs | ||
// (and also remove circular references) | ||
if (this.appInfo) meta.app = this.appInfo; // Set the body used for returning with and sending logs | ||
// (and also remove circular references) | ||
var body = safeStringify({ | ||
message: message, | ||
meta: meta | ||
}); // Send to Cabin or other logging service here the `message` and `meta` | ||
const body = safeStringify({ | ||
message, | ||
meta | ||
}); // Send to Cabin or other logging service here the `message` and `meta` | ||
if (config.capture && config.levels.includes(level) && (!isError(error) || !error._captureFailed)) { | ||
// If the user didn't specify a key | ||
// and they are using the default endpoint | ||
// then we should throw an error to them | ||
if (config.endpoint === endpoint && !config.key) throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>"); // Capture the log over HTTP | ||
if (config.capture && config.levels.includes(level) && (!isError(error) || !error._captureFailed)) { | ||
// If the user didn't specify a key | ||
// and they are using the default endpoint | ||
// then we should throw an error to them | ||
if (config.endpoint === endpoint && !config.key) throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>"); // Capture the log over HTTP | ||
var request = superagent.post(config.endpoint).set('X-Request-Id', cuid()).timeout(config.timeout); | ||
if (!process.browser) request.set('User-Agent', "axe/".concat(pkg.version)); // Basic auth (e.g. Cabin API key) | ||
const request = superagent.post(config.endpoint).set('X-Request-Id', cuid()).timeout(config.timeout); | ||
if (!process.browser) request.set('User-Agent', "axe/".concat(pkg.version)); // Basic auth (e.g. Cabin API key) | ||
if (config.key) request.auth(config.key); // Set headers if any | ||
if (config.key) request.auth(config.key); // Set headers if any | ||
if (!isEmpty(config.headers)) request.set(config.headers); | ||
request.type('application/json').send(body).retry(config.retry).end(function (error_) { | ||
if (error_) { | ||
error_._captureFailed = true; | ||
if (!isEmpty(config.headers)) request.set(config.headers); | ||
request.type('application/json').send(body).retry(config.retry).end(error_ => { | ||
if (error_) { | ||
error_._captureFailed = true; | ||
this.config.logger.error(error_); | ||
} | ||
}); | ||
} // Custom callback function (e.g. Slack message) | ||
_this2.config.logger.error(error_); | ||
} | ||
}); | ||
} // Custom callback function (e.g. Slack message) | ||
if (callback) config.callback(level, message, meta); // Suppress logs if it was silent | ||
if (callback) config.callback(level, message, meta); // Suppress logs if it was silent | ||
if (config.silent) return body; // Return early if it is not a valid logging level | ||
if (config.silent) return body; // Return early if it is not a valid logging level | ||
if (!config.levels.includes(level)) return body; // | ||
// determine log method to use | ||
// | ||
// if we didn't pass a level as a method | ||
// (e.g. console.info), then we should still | ||
// use the logger's `log` method to output | ||
// | ||
// and fatal should use error (e.g. in browser) | ||
// | ||
if (!config.levels.includes(level)) return body; // | ||
// determine log method to use | ||
// | ||
// if we didn't pass a level as a method | ||
// (e.g. console.info), then we should still | ||
// use the logger's `log` method to output | ||
// | ||
// and fatal should use error (e.g. in browser) | ||
// | ||
let method = level; | ||
if (modifier === -1) method = 'log';else if (level === 'fatal') method = 'error'; // If there was meta information then output it | ||
// setup ommitted fields | ||
var method = level; | ||
if (modifier === -1) method = 'log';else if (level === 'fatal') method = 'error'; // If there was meta information then output it | ||
// setup ommitted fields | ||
const omittedFields = [...this.config.meta.omittedFields]; | ||
omittedFields.push('level'); | ||
if (!hadErrorInMeta) omittedFields.push('err'); // Omit app is configured | ||
var omittedFields = ['level', 'err'].concat(this.config.meta.omittedFields); // Omit app is configured | ||
if (!this.config.meta.showApp) omittedFields.push('app'); | ||
const omitted = omit(meta, omittedFields); // Show stack trace if necessary (along with any metadata) | ||
if (!this.config.meta.showApp) omittedFields.push('app'); | ||
var omitted = omit(meta, omittedFields); // Show stack trace if necessary (along with any metadata) | ||
if (isError(error) && config.showStack) { | ||
if (!config.meta.show || isEmpty(omitted)) this.config.logger[method](error);else this.config.logger[method](error, omitted); | ||
} else if (!config.meta.show || isEmpty(omitted)) { | ||
this.config.logger[method](message); | ||
} else { | ||
this.config.logger[method](message, omitted); | ||
} // Return the parsed body in case we need it | ||
if (method === 'error' && isError(error) && config.showStack) { | ||
if (!config.meta.show || isEmpty(omitted)) this.config.logger.error(error);else this.config.logger.error(error, omitted); | ||
} else if (!config.meta.show || isEmpty(omitted)) { | ||
this.config.logger[method](message); | ||
} else { | ||
this.config.logger[method](message, omitted); | ||
} // Return the parsed body in case we need it | ||
return body; | ||
} | ||
return body; | ||
} | ||
}]); | ||
} | ||
return Axe; | ||
}(); | ||
module.exports = Axe; |
108
package.json
{ | ||
"name": "axe", | ||
"description": "Logging add-on to send logs over HTTP to your server in Node and Browser environments. Works with any logger! Chop up your logs consistently! Made for Cabin and Lad.", | ||
"version": "8.1.2", | ||
"version": "9.0.0", | ||
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)", | ||
"ava": { | ||
"serial": true, | ||
"failFast": true, | ||
"files": [ | ||
"test/*.js", | ||
"test/**/*.js", | ||
"!test/helpers/*.js", | ||
"!test/helpers/**/*.js" | ||
], | ||
"timeout": "30s" | ||
}, | ||
"browser": { | ||
@@ -23,7 +12,2 @@ "parse-app-info": false | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"contributors": [ | ||
@@ -35,3 +19,3 @@ "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)", | ||
"@ladjs/format-util": "^1.0.4", | ||
"boolean": "^3.1.4", | ||
"boolean": "^3.2.0", | ||
"console-polyfill": "^0.3.0", | ||
@@ -43,41 +27,40 @@ "cuid": "^2.1.8", | ||
"lodash.omit": "^4.5.0", | ||
"parse-app-info": "^4.0.2", | ||
"parse-app-info": "^4.0.3", | ||
"parse-err": "^0.0.12", | ||
"superagent": "^7.0.2" | ||
"superagent": "^8.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.16.8", | ||
"@babel/core": "^7.16.7", | ||
"@babel/preset-env": "^7.16.8", | ||
"@commitlint/cli": "^16.0.2", | ||
"@commitlint/config-conventional": "^16.0.0", | ||
"ava": "^4.0.1", | ||
"@babel/cli": "^7.17.10", | ||
"@babel/core": "^7.18.5", | ||
"@babel/preset-env": "^7.18.2", | ||
"@commitlint/cli": "^17.0.2", | ||
"@commitlint/config-conventional": "^17.0.2", | ||
"ava": "^4.3.0", | ||
"babelify": "^10.0.0", | ||
"browserify": "^17.0.0", | ||
"codecov": "^3.8.2", | ||
"consola": "^2.15.3", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.6.0", | ||
"eslint-config-xo-lass": "^1.0.6", | ||
"eslint-plugin-compat": "^4.0.1", | ||
"eslint": "^8.18.0", | ||
"eslint-config-xo-lass": "^2.0.1", | ||
"eslint-plugin-compat": "^4.0.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"express": "^4.17.2", | ||
"express": "^4.18.1", | ||
"fixpack": "^4.0.0", | ||
"husky": "^7.0.4", | ||
"husky": "^8.0.1", | ||
"jsdom": "15.x", | ||
"koa": "^2.13.4", | ||
"lint-staged": "^12.1.7", | ||
"lint-staged": "^13.0.2", | ||
"lodash": "^4.17.21", | ||
"nyc": "^15.1.0", | ||
"pino": "^7.6.3", | ||
"pino": "^8.1.0", | ||
"remark-cli": "^10.0.1", | ||
"remark-preset-github": "^4.0.1", | ||
"remark-preset-github": "^4.0.4", | ||
"rimraf": "^3.0.2", | ||
"signale": "^1.4.0", | ||
"sinon": "^12.0.1", | ||
"tinyify": "https://github.com/niftylettuce/tinyify", | ||
"xo": "^0.47.0" | ||
"sinon": "^14.0.0", | ||
"tinyify": "^3.0.0", | ||
"xo": "^0.50.0" | ||
}, | ||
"engines": { | ||
"node": ">=7.0.0" | ||
"node": ">=14" | ||
}, | ||
@@ -89,8 +72,2 @@ "files": [ | ||
"homepage": "https://github.com/cabinjs/axe", | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"jsdelivr": "dist/axe.min.js", | ||
@@ -135,12 +112,2 @@ "keywords": [ | ||
"main": "lib/index.js", | ||
"prettier": { | ||
"singleQuote": true, | ||
"bracketSpacing": true, | ||
"trailingComma": "none" | ||
}, | ||
"remarkConfig": { | ||
"plugins": [ | ||
"preset-github" | ||
] | ||
}, | ||
"repository": { | ||
@@ -157,28 +124,13 @@ "type": "git", | ||
"build:lib": "babel --config-file ./.lib.babelrc src --out-dir lib", | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"lint": "xo && remark . -qfo && eslint --no-inline-config -c .lib.eslintrc lib && eslint --no-inline-config -c .dist.eslintrc dist", | ||
"lint": "xo --fix && remark . -qfo && fixpack", | ||
"lint-build": "npm run lint-lib && npm run lint-dist", | ||
"lint-dist": "eslint --no-inline-config -c .dist.eslintrc dist", | ||
"lint-lib": "eslint --no-inline-config -c .lib.eslintrc lib", | ||
"minify": "cross-env NODE_ENV=production browserify src/index.js -o dist/axe.min.js -s Axe -g [ babelify --configFile ./.dist.babelrc ] -p tinyify", | ||
"nyc": "cross-env NODE_ENV=test nyc ava", | ||
"test": "npm run build && npm run lint && npm run ava", | ||
"test-coverage": "npm run build && npm run lint && npm run nyc" | ||
"prepare": "husky install", | ||
"pretest": "npm run lint", | ||
"test": "npm run build && npm run lint-build && npm run nyc" | ||
}, | ||
"unpkg": "dist/axe.min.js", | ||
"xo": { | ||
"prettier": true, | ||
"space": true, | ||
"extends": [ | ||
"xo-lass" | ||
], | ||
"env": [ | ||
"node", | ||
"browser" | ||
], | ||
"ignore": [ | ||
"config.js" | ||
], | ||
"rules": { | ||
"node/prefer-global/process": "off", | ||
"unicorn/prefer-spread": "off" | ||
} | ||
} | ||
"unpkg": "dist/axe.min.js" | ||
} |
# Axe | ||
[](https://travis-ci.org/cabinjs/axe) | ||
[](https://codecov.io/gh/cabinjs/axe) | ||
[](https://github.com/cabinjs/axe/actions/workflows/ci.yml) | ||
[](https://github.com/sindresorhus/xo) | ||
@@ -47,8 +46,2 @@ [](https://github.com/prettier/prettier) | ||
[yarn][]: | ||
```sh | ||
yarn add axe | ||
``` | ||
### Browser | ||
@@ -169,3 +162,3 @@ | ||
```html | ||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6,Map,Map.prototype,Math.sign,Promise,Reflect,Symbol,Symbol.iterator,Symbol.prototype,Symbol.toPrimitive,Symbol.toStringTag,Uint32Array,window.crypto,Object.assign,Object.getOwnPropertySymbols,Array.from,Set,BigInt,WeakMap,WeakRef,WeakSet"></script> | ||
<script src="https://polyfill.io/v3/polyfill.min.js?features=WeakRef,BigInt"></script> | ||
<script src="https://unpkg.com/axe"></script> | ||
@@ -185,25 +178,7 @@ <script type="text/javascript"> | ||
```html | ||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6,Map,Map.prototype,Math.sign,Promise,Reflect,Symbol,Symbol.iterator,Symbol.prototype,Symbol.toPrimitive,Symbol.toStringTag,Uint32Array,window.crypto,Object.assign,Object.getOwnPropertySymbols,Array.from,Set,BigInt,WeakMap,WeakRef,WeakSet"></script> | ||
<script src="https://polyfill.io/v3/polyfill.min.js?features=WeakRef,BigInt"></script> | ||
``` | ||
* Map is not supported in IE 10 | ||
* Map.prototype() is not supported in IE 10 | ||
* Math.sign() is not supported in IE 10 | ||
* Promise is not supported in Opera Mobile 12.1, Opera Mini all, IE Mobile 10, IE 10, Blackberry Browser 7 | ||
* Reflect is not supported in IE 10 | ||
* Symbol.iterator() is not supported in IE 10 | ||
* Symbol.prototype() is not supported in IE 10 | ||
* Symbol.toPrimitive() is not supported in IE 10 | ||
* Symbol.toStringTag() is not supported in IE 10 | ||
* Uint32Array is not supported in IE Mobile 10, IE 10, Blackberry Browser 7 | ||
* window\.crypto() is not supported in IE 10 | ||
* Object.assign() is not supported in IE 10 | ||
* Object.getOwnPropertySymbols() is not supported in IE 10 | ||
* Array.from() is not supported in IE 10 | ||
* Set is not supported in IE 10 | ||
* Symbol is not supported in IE 10 | ||
* BigInt is not supported in IE 10 | ||
* WeakMap is not supported in IE 10 | ||
* WeakRef is not supported in Opera 81, IE 10 | ||
* WeakSet is not supported in IE 10 | ||
* WeakRef is not supported in Opera 85, iOS Safari 12.2-12.5 | ||
* BigInt is not supported in iOS Safari 12.2-12.5 | ||
@@ -476,4 +451,2 @@ #### Bundler | ||
[yarn]: https://yarnpkg.com/ | ||
[lad]: https://lad.js.org/ | ||
@@ -480,0 +453,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
30
-3.23%299595
-7.21%6464
-3.03%485
-5.27%4
33.33%+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated