New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lhci/utils

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lhci/utils - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

4

package.json
{
"name": "@lhci/utils",
"version": "0.3.1",
"version": "0.3.2",
"license": "Apache-2.0",

@@ -16,3 +16,3 @@ "repository": {

},
"gitHead": "081a583056530eb95020d793681aa353169228bb"
"gitHead": "1c2544cf5c5fa7e3dabe06672b4fa108ac2197c0"
}

@@ -343,3 +343,3 @@ /**

assertionKey => {
const [auditId, ...rest] = assertionKey.split('.');
const [auditId, ...rest] = assertionKey.split(/\.|:/g).filter(Boolean);
const auditInstances = lhrs.map(lhr => lhr.audits[auditId]).filter(Boolean);

@@ -346,0 +346,0 @@ const failedAudit = auditInstances.find(audit => audit.score !== 1);

@@ -39,7 +39,7 @@ /**

for (const {resourceType, budget: maxNumericValue} of budget.resourceCounts || []) {
assertions[`resource-summary.${resourceType}.count`] = ['error', {maxNumericValue}];
assertions[`resource-summary:${resourceType}:count`] = ['error', {maxNumericValue}];
}
for (const {resourceType, budget: maxNumericValue} of budget.resourceSizes || []) {
assertions[`resource-summary.${resourceType}.size`] = ['error', {maxNumericValue}];
assertions[`resource-summary:${resourceType}:size`] = ['error', {maxNumericValue}];
}

@@ -46,0 +46,0 @@

@@ -36,2 +36,3 @@ /**

if (envVars.TRAVIS_COMMIT) return envVars.TRAVIS_COMMIT;
if (envVars.CIRCLE_SHA1) return envVars.CIRCLE_SHA1;

@@ -74,2 +75,5 @@ const result = childProcess.spawnSync('git', ['rev-list', '--no-merges', '-n1', 'HEAD'], {

// Use CircleCI vars if available.
if (envVars.CIRCLE_BRANCH) return envVars.CIRCLE_BRANCH;
const result = childProcess.spawnSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {

@@ -100,3 +104,5 @@ encoding: 'utf8',

function getExternalBuildUrl() {
return envVars.TRAVIS_BUILD_WEB_URL || '';
if (envVars.TRAVIS_BUILD_WEB_URL) return envVars.TRAVIS_BUILD_WEB_URL;
if (envVars.CIRCLE_BUILD_URL) return envVars.CIRCLE_BUILD_URL;
return '';
}

@@ -198,2 +204,6 @@

if (envVars.GITHUB_REPOSITORY) return envVars.GITHUB_REPOSITORY;
// Support CircleCI
if (envVars.CIRCLE_PROJECT_USERNAME && envVars.CIRCLE_PROJECT_REPONAME) {
return `${envVars.CIRCLE_PROJECT_USERNAME}/${envVars.CIRCLE_PROJECT_REPONAME}`;
}
}

@@ -200,0 +210,0 @@

@@ -19,2 +19,20 @@ /**

/**
* Yargs will treat any key with a `.` in the name as a specifier for an object subpath.
* This isn't the behavior we want when using the `config` file, just the CLI arguments, so we rename.
* Anything that has `.` to `:` and avoid using any keys with `.` in the name throughout LHCI.
* This fixes a bug where assertions used `.` in the name but now optionally use `:` as well.
* @see https://github.com/GoogleChrome/lighthouse-ci/issues/64
* @param {any} object
*/
function recursivelyReplaceDotInKeyName(object) {
if (typeof object !== 'object' || !object) return;
for (const [key, value] of Object.entries(object)) {
recursivelyReplaceDotInKeyName(value);
if (!key.includes('.')) continue;
delete object[key];
object[key.replace(/\./g, ':')] = value;
}
}
/**
* @param {string} pathToRcFile

@@ -32,4 +50,7 @@ * @return {LHCI.YargsOptions}

function loadRcFile(pathToRcFile) {
// Load the JSON and convert all `.` in key names to `:`
const contents = fs.readFileSync(pathToRcFile, 'utf8');
return JSON.parse(contents);
const rc = JSON.parse(contents);
recursivelyReplaceDotInKeyName(rc);
return rc;
}

@@ -36,0 +57,0 @@

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