diff options
author | Rebecca Turner <me@re-becca.org> | 2018-04-20 18:26:37 -0700 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2018-05-24 23:24:45 -0700 |
commit | 468ab4519e1b92473acefb22801497a1af6aebae (patch) | |
tree | bdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/lockfile | |
parent | ac8226115e2192a7a46ba07789fa5136f74223e1 (diff) | |
download | android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2 android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip |
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/lockfile')
-rw-r--r-- | deps/npm/node_modules/lockfile/.npmignore | 3 | ||||
-rw-r--r-- | deps/npm/node_modules/lockfile/.travis.yml | 15 | ||||
-rw-r--r-- | deps/npm/node_modules/lockfile/CHANGELOG.md | 8 | ||||
-rw-r--r-- | deps/npm/node_modules/lockfile/lockfile.js | 15 | ||||
-rw-r--r-- | deps/npm/node_modules/lockfile/package.json | 44 | ||||
-rw-r--r-- | deps/npm/node_modules/lockfile/sockets.md | 27 | ||||
-rw-r--r-- | deps/npm/node_modules/lockfile/speedtest.js | 63 | ||||
-rw-r--r-- | deps/npm/node_modules/lockfile/test/retry-time.js | 1 |
8 files changed, 142 insertions, 34 deletions
diff --git a/deps/npm/node_modules/lockfile/.npmignore b/deps/npm/node_modules/lockfile/.npmignore deleted file mode 100644 index 0ac606ffcb..0000000000 --- a/deps/npm/node_modules/lockfile/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.nyc_output/ -coverage/ -node_modules/ diff --git a/deps/npm/node_modules/lockfile/.travis.yml b/deps/npm/node_modules/lockfile/.travis.yml index 4af02b3d17..85318e47f4 100644 --- a/deps/npm/node_modules/lockfile/.travis.yml +++ b/deps/npm/node_modules/lockfile/.travis.yml @@ -1,8 +1,11 @@ language: node_js +sudo: false node_js: - - '0.8' - - '0.10' - - '0.12' - - 'iojs' -before_install: - - npm install -g npm@latest + - 8 + - 6 + - 4 +notifications: + email: false +cache: + directories: + - $HOME/.npm diff --git a/deps/npm/node_modules/lockfile/CHANGELOG.md b/deps/npm/node_modules/lockfile/CHANGELOG.md index 38f44af041..82cb746552 100644 --- a/deps/npm/node_modules/lockfile/CHANGELOG.md +++ b/deps/npm/node_modules/lockfile/CHANGELOG.md @@ -1,6 +1,14 @@ # Changes +## 1.0.4 + +* test parallel +* upgrade tap +* upgrade node versions in travis.yml +* Use signal-exit package to detect exit instead of process.on('exit') +* added some debugging lines + ## v1.0.3 * handle the case where callback is not passed by user diff --git a/deps/npm/node_modules/lockfile/lockfile.js b/deps/npm/node_modules/lockfile/lockfile.js index fd49717b8c..f037bec55e 100644 --- a/deps/npm/node_modules/lockfile/lockfile.js +++ b/deps/npm/node_modules/lockfile/lockfile.js @@ -30,7 +30,8 @@ function hasOwnProperty (obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop) } -process.on('exit', function () { +var onExit = require('signal-exit') +onExit(function () { debug('exit listener') // cleanup Object.keys(locks).forEach(exports.unlockSync) @@ -172,15 +173,21 @@ exports.lock = function (path, opts, cb) { }) } + debug('failed to acquire lock', er) + // something other than "currently locked" // maybe eperm or something. - if (er.code !== 'EEXIST') return cb(er) + if (er.code !== 'EEXIST') { + debug('not EEXIST error', er) + return cb(er) + } // someone's got this one. see if it's valid. if (!opts.stale) return notStale(er, path, opts, cb) return maybeStale(er, path, opts, false, cb) }) + debug('lock return') } @@ -235,8 +242,10 @@ function notStale (er, path, opts, cb) { debug('notStale', path, opts) // if we can't wait, then just call it a failure - if (typeof opts.wait !== 'number' || opts.wait <= 0) + if (typeof opts.wait !== 'number' || opts.wait <= 0) { + debug('notStale, wait is not a number') return cb(er) + } // poll for some ms for the lock to clear var now = Date.now() diff --git a/deps/npm/node_modules/lockfile/package.json b/deps/npm/node_modules/lockfile/package.json index bd05f4c9df..29e89ff0b0 100644 --- a/deps/npm/node_modules/lockfile/package.json +++ b/deps/npm/node_modules/lockfile/package.json @@ -1,42 +1,46 @@ { - "_from": "lockfile@~1.0.3", - "_id": "lockfile@1.0.3", - "_integrity": "sha1-Jjj8OaAzHpysGgS3F5mTHJxQ33k=", + "_args": [ + [ + "lockfile@1.0.4", + "/Users/rebecca/code/npm" + ] + ], + "_from": "lockfile@1.0.4", + "_id": "lockfile@1.0.4", + "_inBundle": false, + "_integrity": "sha512-cvbTwETRfsFh4nHsL1eGWapU1XFi5Ot9E85sWAwia7Y7EgB7vfqcZhTKZ+l7hCGxSPoushMv5GKhT5PdLv03WA==", "_location": "/lockfile", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lockfile@~1.0.3", + "raw": "lockfile@1.0.4", "name": "lockfile", "escapedName": "lockfile", - "rawSpec": "~1.0.3", + "rawSpec": "1.0.4", "saveSpec": null, - "fetchSpec": "~1.0.3" + "fetchSpec": "1.0.4" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.3.tgz", - "_shasum": "2638fc39a0331e9cac1a04b71799931c9c50df79", - "_shrinkwrap": null, - "_spec": "lockfile@~1.0.3", - "_where": "/Users/zkat/Documents/code/npm", + "_resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.4.tgz", + "_spec": "1.0.4", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", "url": "http://blog.izs.me/" }, - "bin": null, "bugs": { "url": "https://github.com/npm/lockfile/issues" }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, + "dependencies": { + "signal-exit": "^3.0.2" + }, "description": "A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.", "devDependencies": { - "tap": "^7.1.2", + "tap": "^11.1.3", "touch": "0" }, "directories": { @@ -53,8 +57,6 @@ "license": "ISC", "main": "lockfile.js", "name": "lockfile", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/npm/lockfile.git" @@ -62,7 +64,7 @@ "scripts": { "changelog": "bash gen-changelog.sh", "postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}", - "test": "tap test/*.js --cov" + "test": "tap test/*.js --cov -J" }, - "version": "1.0.3" + "version": "1.0.4" } diff --git a/deps/npm/node_modules/lockfile/sockets.md b/deps/npm/node_modules/lockfile/sockets.md new file mode 100644 index 0000000000..89b60eebce --- /dev/null +++ b/deps/npm/node_modules/lockfile/sockets.md @@ -0,0 +1,27 @@ +to ACQUIRE(lockname) +- create server, listen on lockname + - if enotsock, WATCH(lockname) + - if eaddrinuse, + - CONNECT(lockname) + - unref server + - lock has been acquired via server + ! on connection, place sockets in queue + +to RELEASE(lockname) +- if acquired via connection + - disconnect +- if acquired via server + - send "OK" to front-most connection + - when connection disconnects, RELEASE(lockname) +- if acquired via filename + - unlink file + +to CONNECT(lockname) +- net.connect(lockname) + - if enoent or socket termination, ACQUIRE(lockname) + - when server says "OK", + - lock has been acquired via connection + +to WATCH(lockname) +- fs.watch(lockname) +- on change, ACQUIRE(lockname) diff --git a/deps/npm/node_modules/lockfile/speedtest.js b/deps/npm/node_modules/lockfile/speedtest.js new file mode 100644 index 0000000000..4433dce1d9 --- /dev/null +++ b/deps/npm/node_modules/lockfile/speedtest.js @@ -0,0 +1,63 @@ +const path = require('path'); +const async = require('async'); +const lf = require('lockfile'); +const fs = require('fs'); + +const n = +process.argv[3] || 300; +const a = Array.apply(null, {length: n}).map(function(_, i) { + return i +}) +const file = path.resolve(__dirname, 'speed-test.lock'); + +try{ + fs.unlinkSync(file); +} +catch(e){} + + +/// NOTE: this should run in about 30ms on a SSD Ubuntu 16.04, that is fast, because we are locking/unlocking 300 locks +/// *HOWEVER* if we change async.eachSeries to async.each, lockfile will barf immediately, and I can't get lockfile +/// to not barf, using any of the options {} available to lockfile#lock. + + +const parallel = process.argv[2] === 'parallel'; + +var fn, msg; + +if(parallel){ + msg = 'parallel'; + fn = async.each; +} +else{ + msg = 'series'; + fn = async.eachSeries; +} + + +const start = Date.now(); +console.log(' => locking/unlocking ' + a.length + ' times, in ' + msg); + +fn(a, function (val, cb) { + + console.log('try %d', val) + + lf.lock(file, { retries: n * 3 }, function (err) { + if (err) { + cb(err); + } + else { + console.log('complete %d', val) + lf.unlock(file, cb); + } + }); + +}, function complete(err) { + + if (err) { + throw err; + } + + console.log(' => Time required for lockfile => ', Date.now() - start, 'ms'); + process.exit(0); + +}); diff --git a/deps/npm/node_modules/lockfile/test/retry-time.js b/deps/npm/node_modules/lockfile/test/retry-time.js index 7d5eaa8499..7632901afa 100644 --- a/deps/npm/node_modules/lockfile/test/retry-time.js +++ b/deps/npm/node_modules/lockfile/test/retry-time.js @@ -46,7 +46,6 @@ pollPeriods.forEach(function (pp) { }, function (er) { if (ended) return var time = Date.now() - start - console.error('t=%d', time) t.ok(time >= EXPECTTIME, 'should take at least ' + EXPECTTIME) t.ok(time < TOOLONG, 'should take less than ' + TOOLONG) clearTimeout(timer) |