summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/find-npm-prefix
diff options
context:
space:
mode:
authorFallenRiteMonk <fallenritemonk@gmail.com>2018-04-05 11:52:34 -0400
committerMyles Borins <mylesborins@google.com>2018-04-05 16:01:07 -0400
commit25a816dcda7b1db0929501acfe13f2fe5119759b (patch)
treed3df4377a11dfb643b5976d2048d9bb4ee527903 /deps/npm/node_modules/find-npm-prefix
parentb29c36b80746733994257b7380245102bc3c4cd6 (diff)
downloadandroid-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.tar.gz
android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.tar.bz2
android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.zip
deps: upgrade npm to 5.8.0
PR-URL: https://github.com/nodejs/node/pull/19560 Fixes: https://github.com/nodejs/node/issues/19271 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/find-npm-prefix')
-rw-r--r--deps/npm/node_modules/find-npm-prefix/find-prefix.js50
-rw-r--r--deps/npm/node_modules/find-npm-prefix/package.json22
2 files changed, 37 insertions, 35 deletions
diff --git a/deps/npm/node_modules/find-npm-prefix/find-prefix.js b/deps/npm/node_modules/find-npm-prefix/find-prefix.js
index 089572ec11..d5e271322b 100644
--- a/deps/npm/node_modules/find-npm-prefix/find-prefix.js
+++ b/deps/npm/node_modules/find-npm-prefix/find-prefix.js
@@ -5,11 +5,9 @@ module.exports = findPrefix
const fs = require('fs')
const path = require('path')
-const Bluebird = require('bluebird')
-const readdir = Bluebird.promisify(fs.readdir)
function findPrefix (dir) {
- return Bluebird.try(() => {
+ return new Promise((resolve, reject) => {
dir = path.resolve(dir)
// this is a weird special case where an infinite recurse of
@@ -20,9 +18,11 @@ function findPrefix (dir) {
dir = path.dirname(dir)
walkedUp = true
}
- if (walkedUp) return dir
-
- return findPrefix_(dir)
+ if (walkedUp) {
+ resolve(dir)
+ } else {
+ resolve(findPrefix_(dir))
+ }
})
}
@@ -32,23 +32,25 @@ function findPrefix_ (dir, original) {
const parent = path.dirname(dir)
// this is a platform independent way of checking if we're in the root
// directory
- if (parent === dir) return original
-
- return readdir(dir).then(files => {
- if (files.indexOf('node_modules') !== -1 ||
- files.indexOf('package.json') !== -1) {
- return dir
- }
-
- return findPrefix_(parent, original)
- }, er => {
- // an error right away is a bad sign.
- // unless the prefix was simply a non
- // existent directory.
- if (er && dir === original && er.code !== 'ENOENT') {
- throw er
- } else {
- return original
- }
+ if (parent === dir) return Promise.resolve(original)
+
+ return new Promise((resolve, reject) => {
+ fs.readdir(dir, (err, files) => {
+ if (err) {
+ // an error right away is a bad sign.
+ // unless the prefix was simply a non
+ // existent directory.
+ if (err && dir === original && err.code !== 'ENOENT') {
+ reject(err)
+ } else {
+ resolve(original)
+ }
+ } else if (files.indexOf('node_modules') !== -1 ||
+ files.indexOf('package.json') !== -1) {
+ resolve(dir)
+ } else {
+ resolve(findPrefix_(parent, original))
+ }
+ })
})
}
diff --git a/deps/npm/node_modules/find-npm-prefix/package.json b/deps/npm/node_modules/find-npm-prefix/package.json
index 4007b90c3c..628eee218b 100644
--- a/deps/npm/node_modules/find-npm-prefix/package.json
+++ b/deps/npm/node_modules/find-npm-prefix/package.json
@@ -1,27 +1,27 @@
{
- "_from": "find-npm-prefix@latest",
- "_id": "find-npm-prefix@1.0.1",
+ "_from": "find-npm-prefix@1.0.2",
+ "_id": "find-npm-prefix@1.0.2",
"_inBundle": false,
- "_integrity": "sha512-I9R7ZnsjlKRvXBJjA1PE4wAkSc24YChoomWdEPTZgeB4DHxf87OutNGV5McFj6WwPghH97nZRejH58XvY6ga6Q==",
+ "_integrity": "sha512-KEftzJ+H90x6pcKtdXZEPsQse8/y/UnvzRKrOSQFprnrGaFuJ62fVkP34Iu2IYuMvyauCyoLTNkJZgrrGA2wkA==",
"_location": "/find-npm-prefix",
"_phantomChildren": {},
"_requested": {
- "type": "tag",
+ "type": "version",
"registry": true,
- "raw": "find-npm-prefix@latest",
+ "raw": "find-npm-prefix@1.0.2",
"name": "find-npm-prefix",
"escapedName": "find-npm-prefix",
- "rawSpec": "latest",
+ "rawSpec": "1.0.2",
"saveSpec": null,
- "fetchSpec": "latest"
+ "fetchSpec": "1.0.2"
},
"_requiredBy": [
"#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/find-npm-prefix/-/find-npm-prefix-1.0.1.tgz",
- "_shasum": "af0faa74e19294b3c8634bae0e91017bb5adfac2",
- "_spec": "find-npm-prefix@latest",
+ "_resolved": "https://registry.npmjs.org/find-npm-prefix/-/find-npm-prefix-1.0.2.tgz",
+ "_shasum": "8d8ce2c78b3b4b9e66c8acc6a37c231eb841cfdf",
+ "_spec": "find-npm-prefix@1.0.2",
"_where": "/Users/rebecca/code/npm",
"author": {
"name": "Rebecca Turner",
@@ -55,5 +55,5 @@
"scripts": {
"test": "standard && tap --100 test"
},
- "version": "1.0.1"
+ "version": "1.0.2"
}