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

@percy/core

Package Overview
Dependencies
Maintainers
1
Versions
241
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.28.1-alpha.1 to 1.28.1-alpha.2

4

dist/config.js

@@ -252,2 +252,6 @@ // Common config options used in Percy commands

},
retry: {
type: 'boolean',
default: false
},
launchOptions: {

@@ -254,0 +258,0 @@ type: 'object',

70

dist/discovery.js
import logger from '@percy/logger';
import Queue from './queue.js';
import { normalizeURL, hostnameMatches, createResource, createRootResource, createPercyCSSResource, createLogResource, yieldAll } from './utils.js';
import { normalizeURL, hostnameMatches, createResource, createRootResource, createPercyCSSResource, createLogResource, yieldAll, withRetries } from './utils.js';

@@ -282,3 +282,4 @@ // Logs verbose debug logs detailing various snapshot options.

let {
concurrency
concurrency,
retry
} = percy.config.discovery;

@@ -321,35 +322,42 @@ let queue = new Queue('discovery');

percy.log.debug(`Asset discovery Browser Page enable JS: ${assetDiscoveryPageEnableJS}`);
// create a new browser page
let page = yield percy.browser.page({
enableJavaScript: assetDiscoveryPageEnableJS,
networkIdleTimeout: snapshot.discovery.networkIdleTimeout,
requestHeaders: snapshot.discovery.requestHeaders,
authorization: snapshot.discovery.authorization,
userAgent: snapshot.discovery.userAgent,
captureMockedServiceWorker: snapshot.discovery.captureMockedServiceWorker,
meta: snapshot.meta,
// enable network inteception
intercept: {
enableJavaScript: snapshot.enableJavaScript,
disableCache: snapshot.discovery.disableCache,
allowedHostnames: snapshot.discovery.allowedHostnames,
disallowedHostnames: snapshot.discovery.disallowedHostnames,
getResource: u => snapshot.resources.get(u) || cache.get(u),
saveResource: r => {
snapshot.resources.set(r.url, r);
if (!r.root) {
cache.set(r.url, r);
await withRetries(async function* () {
// create a new browser page
let page = yield percy.browser.page({
enableJavaScript: assetDiscoveryPageEnableJS,
networkIdleTimeout: snapshot.discovery.networkIdleTimeout,
requestHeaders: snapshot.discovery.requestHeaders,
authorization: snapshot.discovery.authorization,
userAgent: snapshot.discovery.userAgent,
captureMockedServiceWorker: snapshot.discovery.captureMockedServiceWorker,
meta: snapshot.meta,
// enable network inteception
intercept: {
enableJavaScript: snapshot.enableJavaScript,
disableCache: snapshot.discovery.disableCache,
allowedHostnames: snapshot.discovery.allowedHostnames,
disallowedHostnames: snapshot.discovery.disallowedHostnames,
getResource: u => snapshot.resources.get(u) || cache.get(u),
saveResource: r => {
snapshot.resources.set(r.url, r);
if (!r.root) {
cache.set(r.url, r);
}
}
}
});
try {
yield* captureSnapshotResources(page, snapshot, {
captureWidths: !snapshot.domSnapshot && percy.deferUploads,
capture: callback
});
} finally {
// always close the page when done
await page.close();
}
}, {
count: retry ? 3 : 1,
onRetry: () => {
percy.log.debug(`Retrying snapshot: ${snapshot.name}`, snapshot.meta);
}
});
try {
yield* captureSnapshotResources(page, snapshot, {
captureWidths: !snapshot.domSnapshot && percy.deferUploads,
capture: callback
});
} finally {
// always close the page when done
await page.close();
}
}).handle('error', ({

@@ -356,0 +364,0 @@ name,

@@ -331,2 +331,21 @@ import EventEmitter from 'events';

}
export async function withRetries(fn, {
count,
onRetry
}) {
count || (count = 1); // default a single try
let run = 0;
while (true) {
run += 1;
try {
return await generatePromise(fn);
} catch (e) {
if (run < count) {
await (onRetry === null || onRetry === void 0 ? void 0 : onRetry());
continue;
}
throw e;
}
}
}

@@ -333,0 +352,0 @@ // DefaultMap, which returns a default value for an uninitialized key

{
"name": "@percy/core",
"version": "1.28.1-alpha.1",
"version": "1.28.1-alpha.2",
"license": "MIT",

@@ -46,7 +46,7 @@ "repository": {

"dependencies": {
"@percy/client": "1.28.1-alpha.1",
"@percy/config": "1.28.1-alpha.1",
"@percy/dom": "1.28.1-alpha.1",
"@percy/logger": "1.28.1-alpha.1",
"@percy/webdriver-utils": "1.28.1-alpha.1",
"@percy/client": "1.28.1-alpha.2",
"@percy/config": "1.28.1-alpha.2",
"@percy/dom": "1.28.1-alpha.2",
"@percy/logger": "1.28.1-alpha.2",
"@percy/webdriver-utils": "1.28.1-alpha.2",
"content-disposition": "^0.5.4",

@@ -62,3 +62,3 @@ "cross-spawn": "^7.0.3",

},
"gitHead": "a8ac47269d65a7cf88658c8899c61bef1808c2d0"
"gitHead": "a3f2e709d0a6445e15a1128686578b1659243a95"
}
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