@percy/sdk-utils
Advanced tools
Comparing version 1.0.0-beta.71 to 1.0.0-beta.72
(function() { | ||
(function (exports, require$$0$1, require$$0$2) { | ||
(function (exports, require$$0$1) { | ||
'use strict'; | ||
@@ -12,3 +12,2 @@ | ||
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1); | ||
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2); | ||
@@ -38,6 +37,7 @@ function getAugmentedNamespace(n) { | ||
const ANSI_COLORS = { | ||
'31m': 'red', | ||
'33m': 'yellow', | ||
'91m': 'red', | ||
'32m': 'green', | ||
'93m': 'yellow', | ||
'34m': 'blue', | ||
'35m': 'magenta', | ||
'95m': 'magenta', | ||
'90m': 'grey' | ||
@@ -119,4 +119,4 @@ }; // colorize each line of a string using an ansi escape sequence | ||
loglevel(level) { | ||
if (!level) return this.level; | ||
this.level = level; | ||
if (level) this.level = level; | ||
return this.level; | ||
} // Change namespaces by generating an array of namespace regular expressions from a | ||
@@ -154,5 +154,9 @@ // comma separated debug string | ||
}), { | ||
deprecated: this.deprecated.bind(this, name), | ||
shouldLog: this.shouldLog.bind(this, name), | ||
progress: this.progress.bind(this, name), | ||
deprecated: this.deprecated.bind(this, name), | ||
shouldLog: this.shouldLog.bind(this, name) | ||
format: this.format.bind(this, name), | ||
loglevel: this.loglevel.bind(this), | ||
stdout: this.constructor.stdout, | ||
stderr: this.constructor.stderr | ||
}); | ||
@@ -167,6 +171,14 @@ } // Query for a set of logs by filtering the in-memory store | ||
format(message, debug, level, elapsed) { | ||
format(debug, level, message, elapsed) { | ||
let label = 'percy'; | ||
let suffix = ''; | ||
if (arguments.length === 1) { | ||
// format(message) | ||
[debug, message] = [null, debug]; | ||
} else if (arguments.length === 2) { | ||
// format(debug, message) | ||
[level, message] = [null, level]; | ||
} | ||
if (this.level === 'debug') { | ||
@@ -205,3 +217,3 @@ // include debug info in the label | ||
if (stdout.isTTY || !this._progress) { | ||
message && (message = this.format(message, debug)); | ||
message && (message = this.format(debug, message)); | ||
if (stdout.isTTY) stdout.cursorTo(0);else message && (message = message + '\n'); | ||
@@ -275,3 +287,3 @@ if (message) stdout.write(message); | ||
if (isError && this.level !== 'debug') message = error.toString(); | ||
this.write(level, this.format(message, debug, error ? 'error' : level, elapsed)); | ||
this.write(level, this.format(debug, error ? 'error' : level, message, elapsed)); | ||
this.lastlog = timestamp; | ||
@@ -400,6 +412,7 @@ } | ||
__proto__: null, | ||
PercyLogger: PercyLogger, | ||
'default': PercyLogger | ||
}); | ||
class BrowserLogger extends PercyLogger { | ||
class PercyBrowserLogger extends PercyLogger { | ||
write(level, message) { | ||
@@ -423,3 +436,4 @@ let out = ['warn', 'error'].includes(level) ? level : 'log'; | ||
__proto__: null, | ||
'default': BrowserLogger | ||
PercyBrowserLogger: PercyBrowserLogger, | ||
'default': PercyBrowserLogger | ||
}); | ||
@@ -452,9 +466,5 @@ | ||
}, | ||
loglevel(level) { | ||
let flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (flags.debug) level = 'debug';else if (flags.verbose) level = 'debug';else if (flags.quiet) level = 'warn';else if (flags.silent) level = 'silent'; | ||
return new Logger().loglevel(level); | ||
loglevel: function () { | ||
return new Logger().loglevel(...arguments); | ||
} | ||
}); | ||
@@ -596,3 +606,3 @@ Object.defineProperties(logger, { | ||
async function connectRemoteLogger() { | ||
await src.remote(() => { | ||
await src.remote(async () => { | ||
let url = info.address.replace('http', 'ws'); | ||
@@ -603,6 +613,9 @@ | ||
} else { | ||
let socket = new (require$$0__default$1["default"])(url); // allow node to exit with an active connection | ||
/* eslint-disable-next-line import/no-extraneous-dependencies */ | ||
let { | ||
default: WebSocket | ||
} = await import('ws'); | ||
let ws = new WebSocket(url); // allow node to exit with an active connection | ||
socket.once('open', () => socket._socket.unref()); | ||
return socket; | ||
return ws.once('open', () => ws._socket.unref()); | ||
} | ||
@@ -686,3 +699,3 @@ }); | ||
})(this.PercySDKUtils = this.PercySDKUtils || {}, null, null); | ||
})(this.PercySDKUtils = this.PercySDKUtils || {}, null); | ||
}).call(window); | ||
@@ -689,0 +702,0 @@ |
@@ -6,3 +6,4 @@ "use strict"; | ||
}); | ||
exports.default = fetchPercyDOM; | ||
exports.default = void 0; | ||
exports.fetchPercyDOM = fetchPercyDOM; | ||
@@ -23,2 +24,5 @@ var _percyInfo = _interopRequireDefault(require("./percy-info")); | ||
return _percyInfo.default.domScript; | ||
} | ||
} | ||
var _default = fetchPercyDOM; | ||
exports.default = _default; |
@@ -6,3 +6,4 @@ "use strict"; | ||
}); | ||
exports.default = isPercyEnabled; | ||
exports.default = void 0; | ||
exports.isPercyEnabled = isPercyEnabled; | ||
@@ -17,5 +18,9 @@ var _logger = _interopRequireDefault(require("@percy/logger")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
// Create a socket to connect to a remote logger | ||
async function connectRemoteLogger() { | ||
await _logger.default.remote(() => { | ||
await _logger.default.remote(async () => { | ||
let url = _percyInfo.default.address.replace('http', 'ws'); | ||
@@ -26,6 +31,9 @@ | ||
} else { | ||
let socket = new (require('ws'))(url); // allow node to exit with an active connection | ||
/* eslint-disable-next-line import/no-extraneous-dependencies */ | ||
let { | ||
default: WebSocket | ||
} = await Promise.resolve().then(() => _interopRequireWildcard(require('ws'))); | ||
let ws = new WebSocket(url); // allow node to exit with an active connection | ||
socket.once('open', () => socket._socket.unref()); | ||
return socket; | ||
return ws.once('open', () => ws._socket.unref()); | ||
} | ||
@@ -66,2 +74,5 @@ }); | ||
return _percyInfo.default.enabled; | ||
} | ||
} | ||
var _default = isPercyEnabled; | ||
exports.default = _default; |
@@ -6,3 +6,4 @@ "use strict"; | ||
}); | ||
exports.default = postSnapshot; | ||
exports.default = void 0; | ||
exports.postSnapshot = postSnapshot; | ||
@@ -26,2 +27,5 @@ var _percyInfo = _interopRequireDefault(require("./percy-info")); | ||
}); | ||
} | ||
} | ||
var _default = postSnapshot; | ||
exports.default = _default; |
@@ -6,3 +6,4 @@ "use strict"; | ||
}); | ||
exports.default = request; | ||
exports.default = void 0; | ||
exports.request = request; | ||
@@ -73,2 +74,5 @@ var _percyInfo = _interopRequireDefault(require("./percy-info")); | ||
}; | ||
} | ||
} | ||
var _default = request; | ||
exports.default = _default; |
{ | ||
"name": "@percy/sdk-utils", | ||
"version": "1.0.0-beta.71", | ||
"version": "1.0.0-beta.72", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/percy/cli", | ||
"directory": "packages/sdk-utils" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "dist/index.js", | ||
@@ -22,5 +30,2 @@ "browser": "dist/bundle.js", | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"karma": { | ||
@@ -50,10 +55,5 @@ "run_start": "node test/server start &", | ||
"dependencies": { | ||
"@percy/logger": "1.0.0-beta.71" | ||
"@percy/logger": "1.0.0-beta.72" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/percy/cli", | ||
"directory": "packages/sdk-utils" | ||
}, | ||
"gitHead": "364d1df717fb19a26ccb024458df6e78a9c11f99" | ||
"gitHead": "6219287e18a0cacb609d0c2696a5785abc9009b9" | ||
} |
@@ -42,6 +42,7 @@ (function() { | ||
const ANSI_COLORS = { | ||
'31m': 'red', | ||
'33m': 'yellow', | ||
'91m': 'red', | ||
'32m': 'green', | ||
'93m': 'yellow', | ||
'34m': 'blue', | ||
'35m': 'magenta', | ||
'95m': 'magenta', | ||
'90m': 'grey' | ||
@@ -192,3 +193,3 @@ }; // colorize each line of a string using an ansi escape sequence | ||
logger$1.loglevel('debug'); | ||
write(logger$1.format('--- DUMPING LOGS ---', 'testing', 'warn')); | ||
write(logger$1.format('testing', 'warn', '--- DUMPING LOGS ---')); | ||
logs.reduce((lastlog, _ref) => { | ||
@@ -201,3 +202,3 @@ let { | ||
} = _ref; | ||
write(logger$1.format(message, debug, level, timestamp - lastlog)); | ||
write(logger$1.format(debug, level, message, timestamp - lastlog)); | ||
return timestamp; | ||
@@ -204,0 +205,0 @@ }, logs[0].timestamp); |
@@ -126,2 +126,3 @@ // create a testing context for mocking the local percy server and a local testing site | ||
if (ctx) ctx.call('close'); | ||
for (let ws of wss.clients) ws.terminate(); | ||
wss.close(() => log('info', 'Closed SDK testing server')); | ||
@@ -132,3 +133,3 @@ }; | ||
ws.on('message', data => { | ||
if (data === 'CLOSE') return close(); | ||
if (data.toString() === 'CLOSE') return close(); | ||
let { id, event, args = [] } = JSON.parse(data); | ||
@@ -135,0 +136,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54669
1330
+ Added@percy/logger@1.0.0-beta.72(transitive)
- Removed@percy/logger@1.0.0-beta.71(transitive)
Updated@percy/logger@1.0.0-beta.72