diff options
author | isaacs <i@izs.me> | 2020-03-20 07:01:30 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-05-08 04:12:57 +0300 |
commit | f39e6d3dcdd58cfbfb14c66be070d0bbb77056ec (patch) | |
tree | 9894a2c9cfd2ae698e1459942c50984673e8e55c | |
parent | 3d36ba9d4850020af97a3f629f36bab45f8942a0 (diff) |
@npmcli/arborist@0.0.0-pre.13
-rw-r--r-- | node_modules/@npmcli/arborist/LICENSE | 23 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js | 4 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/lib/arborist/reify.js | 21 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/lib/shrinkwrap.js | 13 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/package.json | 12 | ||||
-rw-r--r-- | package-lock.json | 6 | ||||
-rw-r--r-- | package.json | 2 |
7 files changed, 51 insertions, 30 deletions
diff --git a/node_modules/@npmcli/arborist/LICENSE b/node_modules/@npmcli/arborist/LICENSE index 19129e315..13ff5b9ea 100644 --- a/node_modules/@npmcli/arborist/LICENSE +++ b/node_modules/@npmcli/arborist/LICENSE @@ -1,15 +1,22 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +Copyright npm, Inc. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +--- + +Files and metadata contained in `test/fixtures/registry-mocks/content` are +downloaded from the public npm registry. These are the property of their +respective owners. The use and distribution of said artifacts are covered by +their associated licenses. diff --git a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index 94647727b..08a6e0585 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -110,6 +110,10 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl this[_manifests] = new Map() } + get explicitRequests () { + return new Set(this[_explicitRequests]) + } + // public method buildIdealTree (options = {}) { if (this.idealTree) diff --git a/node_modules/@npmcli/arborist/lib/arborist/reify.js b/node_modules/@npmcli/arborist/lib/arborist/reify.js index bb0a11baf..fe82f83d1 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -35,7 +35,6 @@ const promiseCallLimit = require('promise-call-limit') const Ideal = require('./build-ideal-tree.js') const optionalSet = require('../optional-set.js') -const _diff = Symbol('diff') const _retiredPaths = Symbol('retiredPaths') const _retiredUnchanged = Symbol('retiredUnchanged') const _sparseTreeDirs = Symbol('sparseTreeDirs') @@ -109,7 +108,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { this[_scriptShell] = scriptShell this[_savePrefix] = savePrefix - this[_diff] = null + this.diff = null this[_retiredPaths] = {} this[_retiredUnchanged] = {} this[_sparseTreeDirs] = new Set() @@ -169,11 +168,11 @@ module.exports = cls => class Reifier extends Ideal(cls) { // find all the nodes that need to change between the actual // and ideal trees. - this[_diff] = Diff.calculate({ + this.diff = Diff.calculate({ actual: this.actualTree, ideal: this.idealTree, }) - for (const node of this[_diff].removed) { + for (const node of this.diff.removed) { this[_addNodeToTrashList](node) } } @@ -199,7 +198,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { // changed or removed, so that we can rollback if necessary. [_retireShallowNodes] () { const moves = this[_retiredPaths] = {} - for (const diff of this[_diff].children) { + for (const diff of this.diff.children) { if (diff.action === 'CHANGE' || diff.action === 'REMOVE') { // we'll have to clean these up at the end, so add them to the list this[_addNodeToTrashList](diff.actual, true) @@ -259,7 +258,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { [_createSparseTree] () { // if we call this fn again, we look for the previous list // so that we can avoid making the same directory multiple times - const dirs = this[_diff].leaves + const dirs = this.diff.leaves .filter(diff => { return (diff.action === 'ADD' || diff.action === 'CHANGE') && !this[_sparseTreeDirs].has(diff.ideal.path) @@ -289,7 +288,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { // we need to unpack them, read that shrinkwrap file, and then update // the tree by calling loadVirtual with the node as the root. [_loadShrinkwrapsAndUpdateTrees] (seen = new Set()) { - const shrinkwraps = this[_diff].leaves + const shrinkwraps = this.diff.leaves .filter(d => (d.action === 'CHANGE' || d.action === 'ADD') && d.ideal.hasShrinkwrap && !seen.has(d.ideal) && !this[_trashList].has(d.ideal.path)) @@ -498,7 +497,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { const bundlesByDepth = new Map() let maxBundleDepth = -1 dfwalk({ - tree: this[_diff], + tree: this.diff, visit: diff => { const node = diff.ideal if (node && !node.isRoot && node.package.bundleDependencies && @@ -524,7 +523,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { [_unpackNewModules] () { const unpacks = [] dfwalk({ - tree: this[_diff], + tree: this.diff, filter: diff => diff.ideal, visit: diff => { const node = diff.ideal @@ -555,7 +554,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { // shallowest nodes that we moved aside in the first place. const moves = this[_retiredPaths] this[_retiredUnchanged] = {} - return promiseAllRejectLate(this[_diff].children.map(diff => { + return promiseAllRejectLate(this.diff.children.map(diff => { const realFolder = (diff.actual || diff.ideal).path const retireFolder = moves[realFolder] this[_retiredUnchanged][retireFolder] = [] @@ -620,7 +619,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { // deps before attempting to build it itself const installedNodes = [] dfwalk({ - tree: this[_diff], + tree: this.diff, leave: diff => installedNodes.push(diff.ideal), // process adds before changes, ignore removals getChildren: diff => diff && diff.children, diff --git a/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/node_modules/@npmcli/arborist/lib/shrinkwrap.js index c24ebdc73..959fc4dd9 100644 --- a/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -27,6 +27,7 @@ const lockfileVersion = 2 const YarnLock = require('./yarn-lock.js') const {promisify} = require('util') +const rimraf = promisify(require('rimraf')) const fs = require('fs') const readFile = promisify(fs.readFile) const writeFile = promisify(fs.writeFile) @@ -654,7 +655,17 @@ class Shrinkwrap { const json = stringify(this.commit(), swKeyOrder, this.indent) return Promise.all([ - writeFile(this.filename, json), + writeFile(this.filename, json).catch(er => { + if (this.hiddenLockfile) { + // well, we did our best. + // if we reify, and there's nothing there, then it might be lacking + // a node_modules folder, but then the lockfile is not important. + // Remove the file, so that in case there WERE deps, but we just + // failed to update the file for some reason, it's not out of sync. + return rimraf(this.filename) + } + throw er + }), this.yarnLock && this.yarnLock.entries.size && writeFile(this.path + '/yarn.lock', this.yarnLock.toString()) ]) diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index 8f011a674..5b77ec793 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,8 +1,8 @@ { "_from": "@npmcli/arborist@latest", - "_id": "@npmcli/arborist@0.0.0-pre.11", + "_id": "@npmcli/arborist@0.0.0-pre.13", "_inBundle": false, - "_integrity": "sha512-d75SHZi+fybiPH3juQ9VhZEexhVsom3vGl0pN0cbLHAHd/N5tSqgIKJ/YXjN96G24pMLI9wfpkFAIrnPkfv/6w==", + "_integrity": "sha512-sJjOIIP718HqWJuTU4VPIxj5E2RV88C0SmQF3DwtSuYggcuocFTdo/quDdhZGeRzFxxpqPl7+XvZsBfWC1Qzyg==", "_location": "/@npmcli/arborist", "_phantomChildren": { "glob": "7.1.4", @@ -27,8 +27,8 @@ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.11.tgz", - "_shasum": "116d6f8862d72774c63e303be883cdb459ad072a", + "_resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.13.tgz", + "_shasum": "5e3d1a5811ab781a02d482b5c18c1e4909e9ea9a", "_spec": "@npmcli/arborist@latest", "_where": "/Users/isaacs/dev/npm/cli", "author": { @@ -78,8 +78,8 @@ "url": "git+https://github.com/npm/arborist.git" }, "scripts": { - "postpublish": "git push origin --follow-tags", "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", "preversion": "npm test", "snap": "tap", "test": "tap", @@ -91,5 +91,5 @@ "esm": false, "timeout": "60" }, - "version": "0.0.0-pre.11" + "version": "0.0.0-pre.13" } diff --git a/package-lock.json b/package-lock.json index c8103cec1..875c46f67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -173,9 +173,9 @@ "dev": true }, "@npmcli/arborist": { - "version": "0.0.0-pre.11", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.11.tgz", - "integrity": "sha512-d75SHZi+fybiPH3juQ9VhZEexhVsom3vGl0pN0cbLHAHd/N5tSqgIKJ/YXjN96G24pMLI9wfpkFAIrnPkfv/6w==", + "version": "0.0.0-pre.13", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.13.tgz", + "integrity": "sha512-sJjOIIP718HqWJuTU4VPIxj5E2RV88C0SmQF3DwtSuYggcuocFTdo/quDdhZGeRzFxxpqPl7+XvZsBfWC1Qzyg==", "requires": { "@npmcli/installed-package-contents": "^1.0.5", "@npmcli/run-script": "^1.2.1", diff --git a/package.json b/package.json index 96009d5a8..ff19eaa46 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "npx": "./bin/npx-cli.js" }, "dependencies": { - "@npmcli/arborist": "0.0.0-pre.11", + "@npmcli/arborist": "0.0.0-pre.13", "@npmcli/run-script": "^1.3.0", "JSONStream": "^1.3.5", "abbrev": "~1.1.1", |