diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2016-11-04 01:51:09 +0300 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2016-11-04 05:18:07 +0300 |
commit | a52d0f0c9cf2de5caef77e12eabd7dca9e89b49c (patch) | |
tree | c17fdb8ca926a8332daedf442d3cbf08b7d3e139 /node_modules/glob | |
parent | 7f41295775f28b958a926f9cb371cb37b05771dd (diff) |
glob@7.1.1
- Handle files without associated perms on Windows.
- Fix failing case with `absolute` option.
Credit: @isaacs
Credit: @phated
Fixes: isaacs/node-glob#245
Fixes: isaacs/node-glob#249
Reviewed-By: @othiym23
Diffstat (limited to 'node_modules/glob')
-rw-r--r-- | node_modules/glob/common.js | 6 | ||||
-rw-r--r-- | node_modules/glob/glob.js | 18 | ||||
-rw-r--r-- | node_modules/glob/package.json | 43 | ||||
-rw-r--r-- | node_modules/glob/sync.js | 24 |
4 files changed, 53 insertions, 38 deletions
diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js index 78362b846..66651bb3a 100644 --- a/node_modules/glob/common.js +++ b/node_modules/glob/common.js @@ -103,7 +103,11 @@ function setopts (self, pattern, options) { if (process.platform === "win32") self.root = self.root.replace(/\\/g, "/") - self.cwdAbs = makeAbs(self, self.cwd) + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") self.nomount = !!options.nomount // disable comments and negation in Minimatch. diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js index 4078f468c..bfdd7a11b 100644 --- a/node_modules/glob/glob.js +++ b/node_modules/glob/glob.js @@ -465,7 +465,7 @@ Glob.prototype._emitMatch = function (index, e) { return } - var abs = this._makeAbs(e) + var abs = isAbsolute(e) ? e : this._makeAbs(e) if (this.mark) e = this._mark(e) @@ -508,15 +508,15 @@ Glob.prototype._readdirInGlobStar = function (abs, cb) { fs.lstat(abs, lstatcb) function lstatcb_ (er, lstat) { - if (er) + if (er && er.code === 'ENOENT') return cb() - var isSym = lstat.isSymbolicLink() + var isSym = lstat && lstat.isSymbolicLink() self.symlinks[abs] = isSym // If it's not a symlink or a dir, then it's definitely a regular file. // don't bother doing a readdir in that case. - if (!isSym && !lstat.isDirectory()) { + if (!isSym && lstat && !lstat.isDirectory()) { self.cache[abs] = 'FILE' cb() } else @@ -769,7 +769,7 @@ Glob.prototype._stat = function (f, cb) { } Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { this.statCache[abs] = false return cb() } @@ -777,13 +777,15 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { var needDir = f.slice(-1) === '/' this.statCache[abs] = stat - if (abs.slice(-1) === '/' && !stat.isDirectory()) + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) return cb(null, false, stat) - var c = stat.isDirectory() ? 'DIR' : 'FILE' + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' this.cache[abs] = this.cache[abs] || c - if (needDir && c !== 'DIR') + if (needDir && c === 'FILE') return cb() return cb(null, c, stat) diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json index 73fed0ed7..ed5b3ea5a 100644 --- a/node_modules/glob/package.json +++ b/node_modules/glob/package.json @@ -2,25 +2,25 @@ "_args": [ [ { - "raw": "glob@7.1.0", + "raw": "glob@^7.1.1", "scope": null, "escapedName": "glob", "name": "glob", - "rawSpec": "7.1.0", - "spec": "7.1.0", - "type": "version" + "rawSpec": "^7.1.1", + "spec": ">=7.1.1 <8.0.0", + "type": "range" }, - "/Users/rebecca/code/npm" + "/Users/ogd/Documents/projects/npm/npm" ] ], - "_from": "glob@7.1.0", - "_id": "glob@7.1.0", + "_from": "glob@>=7.1.1 <8.0.0", + "_id": "glob@7.1.1", "_inCache": true, "_location": "/glob", "_nodeVersion": "6.5.0", "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/glob-7.1.0.tgz_1474396131090_0.08145137410610914" + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/glob-7.1.1.tgz_1475876991562_0.924720095237717" }, "_npmUser": { "name": "isaacs", @@ -29,27 +29,28 @@ "_npmVersion": "3.10.7", "_phantomChildren": {}, "_requested": { - "raw": "glob@7.1.0", + "raw": "glob@^7.1.1", "scope": null, "escapedName": "glob", "name": "glob", - "rawSpec": "7.1.0", - "spec": "7.1.0", - "type": "version" + "rawSpec": "^7.1.1", + "spec": ">=7.1.1 <8.0.0", + "type": "range" }, "_requiredBy": [ "#USER", "/", "/node-gyp", "/rimraf", + "/standard/standard-engine/deglob", "/tap", "/tap/tap-mocha-reporter" ], - "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.0.tgz", - "_shasum": "36add856d746d0d99e4cc2797bba1ae2c67272fd", + "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "_shasum": "805211df04faaf1c63a3600306cdf5ade50b2ec8", "_shrinkwrap": null, - "_spec": "glob@7.1.0", - "_where": "/Users/rebecca/code/npm", + "_spec": "glob@^7.1.1", + "_where": "/Users/ogd/Documents/projects/npm/npm", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -75,8 +76,8 @@ }, "directories": {}, "dist": { - "shasum": "36add856d746d0d99e4cc2797bba1ae2c67272fd", - "tarball": "https://registry.npmjs.org/glob/-/glob-7.1.0.tgz" + "shasum": "805211df04faaf1c63a3600306cdf5ade50b2ec8", + "tarball": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz" }, "engines": { "node": "*" @@ -86,7 +87,7 @@ "sync.js", "common.js" ], - "gitHead": "f65f9eb7eda113528c5257b58fac4ca685ee6c4f", + "gitHead": "bc8d43b736a98a9e289fdfceee9266cff35e5742", "homepage": "https://github.com/isaacs/node-glob#readme", "license": "ISC", "main": "glob.js", @@ -112,5 +113,5 @@ "test": "tap test/*.js --cov", "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" }, - "version": "7.1.0" + "version": "7.1.1" } diff --git a/node_modules/glob/sync.js b/node_modules/glob/sync.js index f9834dcd7..c952134ba 100644 --- a/node_modules/glob/sync.js +++ b/node_modules/glob/sync.js @@ -250,16 +250,18 @@ GlobSync.prototype._readdirInGlobStar = function (abs) { try { lstat = fs.lstatSync(abs) } catch (er) { - // lstat failed, doesn't exist - return null + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } } - var isSym = lstat.isSymbolicLink() + var isSym = lstat && lstat.isSymbolicLink() this.symlinks[abs] = isSym // If it's not a symlink or a dir, then it's definitely a regular file. // don't bother doing a readdir in that case. - if (!isSym && !lstat.isDirectory()) + if (!isSym && lstat && !lstat.isDirectory()) this.cache[abs] = 'FILE' else entries = this._readdir(abs, false) @@ -444,10 +446,13 @@ GlobSync.prototype._stat = function (f) { try { lstat = fs.lstatSync(abs) } catch (er) { - return false + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } } - if (lstat.isSymbolicLink()) { + if (lstat && lstat.isSymbolicLink()) { try { stat = fs.statSync(abs) } catch (er) { @@ -460,10 +465,13 @@ GlobSync.prototype._stat = function (f) { this.statCache[abs] = stat - var c = stat.isDirectory() ? 'DIR' : 'FILE' + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c - if (needDir && c !== 'DIR') + if (needDir && c === 'FILE') return false return c |