read-package-json-fast
Advanced tools
Comparing version 1.2.1 to 2.0.0
16
index.js
@@ -16,3 +16,3 @@ const {promisify} = require('util') | ||
fixBundled(data) | ||
foldinOptionalDeps(data) | ||
pruneRepeatedOptionals(data) | ||
fixScripts(data) | ||
@@ -32,10 +32,16 @@ fixFunding(data) | ||
const foldinOptionalDeps = data => { | ||
// it was once common practice to list deps both in optionalDependencies | ||
// and in dependencies, to support npm versions that did not know abbout | ||
// optionalDependencies. This is no longer a relevant need, so duplicating | ||
// the deps in two places is unnecessary and excessive. | ||
const pruneRepeatedOptionals = data => { | ||
const od = data.optionalDependencies | ||
const dd = data.dependencies || {} | ||
if (od && typeof od === 'object') { | ||
data.dependencies = data.dependencies || {} | ||
for (const [name, spec] of Object.entries(od)) { | ||
data.dependencies[name] = spec | ||
for (const name of Object.keys(od)) { | ||
delete dd[name] | ||
} | ||
} | ||
if (Object.keys(dd).length === 0) | ||
delete data.dependencies | ||
return data | ||
@@ -42,0 +48,0 @@ } |
{ | ||
"name": "read-package-json-fast", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "Like read-package-json, but faster", | ||
@@ -5,0 +5,0 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", |
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
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
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
6820
77
1