diff options
author | npm team <ops+robot@npmjs.com> | 2021-08-19 20:47:33 +0300 |
---|---|---|
committer | Luigi Pinca <luigipinca@gmail.com> | 2021-08-20 15:53:49 +0300 |
commit | 248f4c376444d0202f1d08f039c59485d6aea2e9 (patch) | |
tree | 270bcf6dd5734fa43ea1603bfc4a066b6f8f7926 /deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js | |
parent | 279162cf98b22ec5d0afc182ea22c7a782ccd083 (diff) |
deps: upgrade npm to 7.21.0
PR-URL: https://github.com/nodejs/node/pull/39813
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js')
-rw-r--r-- | deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js b/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js index cf6b800c44e..9601ad7af31 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js @@ -73,8 +73,10 @@ class CanPlaceDep { if (!edge) throw new Error('no edge provided to CanPlaceDep') - this._nodeSnapshot = JSON.stringify(dep) - this._treeSnapshot = JSON.stringify(target.root) + this._treeSnapshot = JSON.stringify([...target.root.inventory.entries()] + .map(([loc, {packageName, version, resolved}]) => { + return [loc, packageName, version, resolved] + }).sort(([a], [b]) => a.localeCompare(b, 'en'))) }) // the result of whether we can place it or not @@ -110,15 +112,10 @@ class CanPlaceDep { this.canPlaceSelf = this.canPlace debug(() => { - const nodeSnapshot = JSON.stringify(dep) - const treeSnapshot = JSON.stringify(target.root) - /* istanbul ignore if */ - if (this._nodeSnapshot !== nodeSnapshot) { - throw Object.assign(new Error('dep changed in CanPlaceDep'), { - expect: this._nodeSnapshot, - actual: nodeSnapshot, - }) - } + const treeSnapshot = JSON.stringify([...target.root.inventory.entries()] + .map(([loc, {packageName, version, resolved}]) => { + return [loc, packageName, version, resolved] + }).sort(([a], [b]) => a.localeCompare(b, 'en'))) /* istanbul ignore if */ if (this._treeSnapshot !== treeSnapshot) { throw Object.assign(new Error('tree changed in CanPlaceDep'), { |