From 8cb0c166ccc019146a7a94d13c12723f001d2551 Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Fri, 30 Oct 2020 13:59:15 -0400 Subject: [PATCH] @npmcli/arborist@1.0.6 --- node_modules/@npmcli/arborist/lib/diff.js | 31 +++++++++++++++------- node_modules/@npmcli/arborist/package.json | 2 +- package-lock.json | 14 +++++----- package.json | 2 +- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/node_modules/@npmcli/arborist/lib/diff.js b/node_modules/@npmcli/arborist/lib/diff.js index 2e70234b50c7f..1864a3ea10b67 100644 --- a/node_modules/@npmcli/arborist/lib/diff.js +++ b/node_modules/@npmcli/arborist/lib/diff.js @@ -6,6 +6,7 @@ // for a given branch of the tree being mutated. const {depth} = require('treeverse') +const {existsSync} = require('fs') const ssri = require('ssri') @@ -37,25 +38,35 @@ class Diff { } } -const getAction = ({actual, ideal}) => - !ideal ? 'REMOVE' +const getAction = ({actual, ideal}) => { + if (!ideal) + return 'REMOVE' + // bundled meta-deps are copied over to the ideal tree when we visit it, // so they'll appear to be missing here. There's no need to handle them // in the diff, though, because they'll be replaced at reify time anyway // Otherwise, add the missing node. - : !actual ? (ideal.inDepBundle ? null : 'ADD') + if (!actual) + return ideal.inDepBundle ? null : 'ADD' + // always ignore the root node - : ideal.isRoot && actual.isRoot || + if (ideal.isRoot && actual.isRoot) + return null + + const binsExist = ideal.binPaths.every((path) => existsSync(path)) + // top nodes, links, and git deps won't have integrity, but do have resolved - !ideal.integrity && !actual.integrity && - ideal.resolved === actual.resolved || + if (!ideal.integrity && !actual.integrity && ideal.resolved === actual.resolved && binsExist) + return null + // otherwise, verify that it's the same bits // note that if ideal has integrity, and resolved doesn't, we treat // that as a 'change', so that it gets re-fetched and locked down. - ideal.integrity && - actual.integrity && - ssri.parse(ideal.integrity).match(actual.integrity) ? null - : 'CHANGE' + if (!ideal.integrity || !actual.integrity || !ssri.parse(ideal.integrity).match(actual.integrity) || !binsExist) + return 'CHANGE' + + return null +} const allChildren = node => { if (!node) diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index ff6abb29e40b7..73c6ce58d2839 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "1.0.5", + "version": "1.0.6", "description": "Manage node_modules trees", "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", diff --git a/package-lock.json b/package-lock.json index 3c91375dd3e68..ff17b31a8c266 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,7 +78,7 @@ ], "license": "Artistic-2.0", "dependencies": { - "@npmcli/arborist": "^1.0.4", + "@npmcli/arborist": "^1.0.6", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.1", "@npmcli/run-script": "^1.7.4", @@ -386,9 +386,9 @@ } }, "node_modules/@npmcli/arborist": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-1.0.5.tgz", - "integrity": "sha512-VK3VqSxnk5muyMB5zIIg12EsmV0COBKpBE8wQ/s85O02nh4N1suUxuf9nbgFonsi+D8uN4DO6qtdQ4FtN6i6+A==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-1.0.6.tgz", + "integrity": "sha512-Hj5QxT1/BIU5HMb3sSOCV81trhc6sqT1FaCdXPM+YjZPLpQsO3UFKWAGuDknDcNyx1mVT0IA1nlmrjhGGXDDtQ==", "inBundle": true, "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", @@ -9063,9 +9063,9 @@ } }, "@npmcli/arborist": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-1.0.5.tgz", - "integrity": "sha512-VK3VqSxnk5muyMB5zIIg12EsmV0COBKpBE8wQ/s85O02nh4N1suUxuf9nbgFonsi+D8uN4DO6qtdQ4FtN6i6+A==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-1.0.6.tgz", + "integrity": "sha512-Hj5QxT1/BIU5HMb3sSOCV81trhc6sqT1FaCdXPM+YjZPLpQsO3UFKWAGuDknDcNyx1mVT0IA1nlmrjhGGXDDtQ==", "requires": { "@npmcli/installed-package-contents": "^1.0.5", "@npmcli/map-workspaces": "^1.0.1", diff --git a/package.json b/package.json index 3709d26dea0ac..b90885187e2a9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@npmcli/arborist": "^1.0.4", + "@npmcli/arborist": "^1.0.6", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.1", "@npmcli/run-script": "^1.7.4",