diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-02-05 20:06:54 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2021-02-08 23:24:47 +0300 |
commit | 0f7a3a87c12e30bdd2cdab596ca6511de787c969 (patch) | |
tree | 2206fb13e9555f052c858a099532333be95e9ab8 /node_modules/read-package-json-fast | |
parent | 12812c6db304d9e243de046db873fd3987c2386f (diff) |
read-package-json-fast@2.0.1
Diffstat (limited to 'node_modules/read-package-json-fast')
-rw-r--r-- | node_modules/read-package-json-fast/index.js | 16 | ||||
-rw-r--r-- | node_modules/read-package-json-fast/package.json | 5 |
2 files changed, 15 insertions, 6 deletions
diff --git a/node_modules/read-package-json-fast/index.js b/node_modules/read-package-json-fast/index.js index bfef5d6ab..cf373029d 100644 --- a/node_modules/read-package-json-fast/index.js +++ b/node_modules/read-package-json-fast/index.js @@ -13,7 +13,7 @@ const normalizePackageBin = require('npm-normalize-package-bin') const normalize = data => { add_id(data) fixBundled(data) - foldinOptionalDeps(data) + pruneRepeatedOptionals(data) fixScripts(data) fixFunding(data) normalizePackageBin(data) @@ -28,14 +28,20 @@ const add_id = data => { return 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 } diff --git a/node_modules/read-package-json-fast/package.json b/node_modules/read-package-json-fast/package.json index a59a3b2e8..aa5f5d870 100644 --- a/node_modules/read-package-json-fast/package.json +++ b/node_modules/read-package-json-fast/package.json @@ -1,6 +1,6 @@ { "name": "read-package-json-fast", - "version": "1.2.1", + "version": "2.0.1", "description": "Like read-package-json, but faster", "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", "license": "ISC", @@ -11,6 +11,9 @@ "postversion": "npm publish", "postpublish": "git push origin --follow-tags" }, + "engines": { + "node": ">=10" + }, "tap": { "check-coverage": true }, |