From af5315e296b29efe4091aabb3e1deb3b553f7299 Mon Sep 17 00:00:00 2001 From: isaacs Date: Sun, 23 Feb 2020 17:49:16 -0800 Subject: [PATCH] perf: don't reload edges for non-dep node.package updates Considering that maybe that Node.package setter is more of a footgun than it's worth. It's nice to know that the deps will always be kept up to date, but throwing away and reloading edges just because you pulled in something tangential feels like it's bad-clever. --- lib/arborist/reify.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/arborist/reify.js b/lib/arborist/reify.js index 1940c160e..bb0a11baf 100644 --- a/lib/arborist/reify.js +++ b/lib/arborist/reify.js @@ -361,7 +361,9 @@ module.exports = cls => class Reifier extends Ideal(cls) { const {meta} = this.idealTree return meta.loadedFromDisk && meta.originalLockfileVersion < 2 && rpj(node.path + '/package.json').then(pkg => { - node.package = pkg + node.package.os = pkg.os + node.package.cpu = pkg.cpu + node.package.engines = pkg.engines return this[_checkEngineAndPlatform](node) }) } @@ -647,8 +649,8 @@ module.exports = cls => class Reifier extends Ideal(cls) { return return rpj(node.path + '/package.json').then(pkg => { - node.package = pkg if (pkg.scripts) { + node.package.scripts = pkg.scripts const val = [node, pkg] if (pkg.scripts.preinstall) preinstall.push(val)