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

@percy/core

Package Overview
Dependencies
Maintainers
6
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/core - npm Package Compare versions

Comparing version 1.0.0-beta.14 to 1.0.0-beta.15

10

dist/percy.js

@@ -170,3 +170,3 @@ "use strict";

await this.discoverer.close();
(_this$server2 = this.server) === null || _this$server2 === void 0 ? void 0 : _this$server2.close(); // throw an easier-to understand error when the port is taken
await ((_this$server2 = this.server) === null || _this$server2 === void 0 ? void 0 : _this$server2.close()); // throw an easier-to understand error when the port is taken

@@ -207,9 +207,9 @@ if (error.code === 'EADDRINUSE') {

await this.idle(); // close the server and browser
await this.idle();
(_this$server3 = this.server) === null || _this$server3 === void 0 ? void 0 : _this$server3.close();
await this.discoverer.close();
_classPrivateFieldSet(this, _running, false); // close the discoverer and server
_classPrivateFieldSet(this, _running, false); // log build info
await this.discoverer.close();
await ((_this$server3 = this.server) === null || _this$server3 === void 0 ? void 0 : _this$server3.close()); // finalize the build

@@ -216,0 +216,0 @@ await this.client.finalizeBuild();

@@ -53,3 +53,5 @@ "use strict";

};
}; // create a simple server to route request responses
context.routes = routes;
context.server = _http.default.createServer((request, response) => {

@@ -67,6 +69,15 @@ request.on('data', chunk => {

});
});
}); // track connections
context.close = () => context.server.close();
context.sockets = new Set();
context.server.on('connection', s => {
context.sockets.add(s.on('close', () => context.sockets.delete(s)));
}); // immediately kill connections on close
context.close = () => new Promise(resolve => {
context.sockets.forEach(s => s.destroy());
context.server.close(resolve);
}); // starts the server
context.listen = port => new Promise((resolve, reject) => {

@@ -76,4 +87,5 @@ context.server.on('listening', () => resolve(context));

context.server.listen(port);
});
}); // add routes programatically
context.reply = (url, handler) => {

@@ -108,6 +120,6 @@ routes[url] = handler;

}]),
// stops the instance
'/percy/stop': () => percy.stop().then(() => [200, 'application/json', {
// stops the instance async (connections will be closed)
'/percy/stop': () => percy.stop() && [200, 'application/json', {
success: true
}]),
}],
// other routes 404

@@ -114,0 +126,0 @@ default: () => [404, 'application/json', {

{
"name": "@percy/core",
"version": "1.0.0-beta.14",
"version": "1.0.0-beta.15",
"license": "MIT",

@@ -28,5 +28,5 @@ "main": "dist/index.js",

"dependencies": {
"@percy/client": "^1.0.0-beta.14",
"@percy/dom": "^1.0.0-beta.14",
"@percy/logger": "^1.0.0-beta.14",
"@percy/client": "^1.0.0-beta.15",
"@percy/dom": "^1.0.0-beta.15",
"@percy/logger": "^1.0.0-beta.15",
"node-fetch": "^2.6.1",

@@ -40,3 +40,3 @@ "progress": "^2.0.3",

},
"gitHead": "be425adadd5ad0f8862e9449ec8d9380961b313d"
"gitHead": "f11694fd14cb6918988534e15d32bc83a479707a"
}

@@ -5,8 +5,15 @@ // aliased to src for coverage during tests without needing to compile this file

module.exports = function createTestServer(routes, port = 8000) {
let onError = ({ message }) => [500, 'text/plain', message];
let middleware = ({ url, body }) => server.requests.push(body ? [url, body] : [url]);
let server = createServer({ ...routes, middleware, catch: onError });
server.requests = [];
let context = createServer(routes);
return server.listen(port);
// handle route errors
context.routes.catch = ({ message }) => [500, 'text/plain', message];
// track requests
context.requests = [];
context.routes.middleware = ({ url, body }) => {
context.requests.push(body ? [url, body] : [url]);
};
// automatically listen
return context.listen(port);
};

@@ -1,7 +0,4 @@

// Minimum TypeScript Version: 3.8
/// <reference lib="dom"/>
import * as Puppeteer from 'puppeteer-core/lib/cjs/puppeteer/common/Page';
// Stubbed so other types can be consumed without needing global dom types
declare global { interface Element {} }
type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'silent';

@@ -8,0 +5,0 @@ interface Pojo { [x: string]: any; }

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