diff options
author | Rebecca Turner <me@re-becca.org> | 2016-10-07 02:37:33 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2016-10-07 05:34:21 +0300 |
commit | 9402ead67e3be9b431ade637fbfac86204ee96fe (patch) | |
tree | b41c5e0bd9203d0ac77ad093527d525c32d700b3 /node_modules/glob | |
parent | 13f7c0a73212284b53a2d96882fc298afbf9609c (diff) |
glob@7.1.0
Add absolute option for match event.
Credit: @phated
PR-URL: https://github.com/isaacs/node-glob/pull/293
Diffstat (limited to 'node_modules/glob')
-rw-r--r-- | node_modules/glob/README.md | 3 | ||||
-rw-r--r-- | node_modules/glob/common.js | 1 | ||||
-rw-r--r-- | node_modules/glob/glob.js | 15 | ||||
-rw-r--r-- | node_modules/glob/node_modules/path-is-absolute/index.js | 10 | ||||
-rw-r--r-- | node_modules/glob/node_modules/path-is-absolute/package.json | 96 | ||||
-rw-r--r-- | node_modules/glob/node_modules/path-is-absolute/readme.md | 30 | ||||
-rw-r--r-- | node_modules/glob/package.json | 43 | ||||
-rw-r--r-- | node_modules/glob/sync.js | 16 |
8 files changed, 148 insertions, 66 deletions
diff --git a/node_modules/glob/README.md b/node_modules/glob/README.md index 9dd9384fa..baa1d1ba8 100644 --- a/node_modules/glob/README.md +++ b/node_modules/glob/README.md @@ -273,6 +273,9 @@ the filesystem. In the case of a symlink that cannot be resolved, the full absolute path to the matched entry is returned (though it will usually be a broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. ## Comparisons to other fnmatch/glob implementations diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js index 58dc41e66..78362b846 100644 --- a/node_modules/glob/common.js +++ b/node_modules/glob/common.js @@ -80,6 +80,7 @@ function setopts (self, pattern, options) { self.nocase = !!options.nocase self.stat = !!options.stat self.noprocess = !!options.noprocess + self.absolute = !!options.absolute self.maxLength = options.maxLength || Infinity self.cache = options.cache || Object.create(null) diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js index 9eca910bb..4078f468c 100644 --- a/node_modules/glob/glob.js +++ b/node_modules/glob/glob.js @@ -457,9 +457,6 @@ Glob.prototype._emitMatch = function (index, e) { if (this.aborted) return - if (this.matches[index][e]) - return - if (isIgnored(this, e)) return @@ -470,15 +467,21 @@ Glob.prototype._emitMatch = function (index, e) { var abs = this._makeAbs(e) + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + if (this.nodir) { var c = this.cache[abs] if (c === 'DIR' || Array.isArray(c)) return } - if (this.mark) - e = this._mark(e) - this.matches[index][e] = true var st = this.statCache[abs] diff --git a/node_modules/glob/node_modules/path-is-absolute/index.js b/node_modules/glob/node_modules/path-is-absolute/index.js index 19f103f90..22aa6c356 100644 --- a/node_modules/glob/node_modules/path-is-absolute/index.js +++ b/node_modules/glob/node_modules/path-is-absolute/index.js @@ -2,18 +2,18 @@ function posix(path) { return path.charAt(0) === '/'; -}; +} function win32(path) { - // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; var result = splitDeviceRe.exec(path); var device = result[1] || ''; - var isUnc = !!device && device.charAt(1) !== ':'; + var isUnc = Boolean(device && device.charAt(1) !== ':'); // UNC paths are always absolute - return !!result[2] || isUnc; -}; + return Boolean(result[2] || isUnc); +} module.exports = process.platform === 'win32' ? win32 : posix; module.exports.posix = posix; diff --git a/node_modules/glob/node_modules/path-is-absolute/package.json b/node_modules/glob/node_modules/path-is-absolute/package.json index bf60d74db..f37222903 100644 --- a/node_modules/glob/node_modules/path-is-absolute/package.json +++ b/node_modules/glob/node_modules/path-is-absolute/package.json @@ -1,26 +1,76 @@ { - "name": "path-is-absolute", - "version": "1.0.0", - "description": "Node.js 0.12 path.isAbsolute() ponyfill", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/path-is-absolute.git" + "_args": [ + [ + { + "raw": "path-is-absolute@^1.0.0", + "scope": null, + "escapedName": "path-is-absolute", + "name": "path-is-absolute", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/rebecca/code/npm/node_modules/glob" + ] + ], + "_from": "path-is-absolute@>=1.0.0 <2.0.0", + "_id": "path-is-absolute@1.0.1", + "_inCache": true, + "_location": "/glob/path-is-absolute", + "_nodeVersion": "6.6.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/path-is-absolute-1.0.1.tgz_1475210523565_0.9876507974695414" + }, + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" }, + "_npmVersion": "3.10.3", + "_phantomChildren": {}, + "_requested": { + "raw": "path-is-absolute@^1.0.0", + "scope": null, + "escapedName": "path-is-absolute", + "name": "path-is-absolute", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", + "_shrinkwrap": null, + "_spec": "path-is-absolute@^1.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/glob", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, + "bugs": { + "url": "https://github.com/sindresorhus/path-is-absolute/issues" + }, + "dependencies": {}, + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "devDependencies": { + "xo": "^0.16.0" + }, + "directories": {}, + "dist": { + "shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", + "tarball": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + }, "engines": { "node": ">=0.10.0" }, - "scripts": { - "test": "node test.js" - }, "files": [ "index.js" ], + "gitHead": "edc91d348b21dac2ab65ea2fbec2868e2eff5eb6", + "homepage": "https://github.com/sindresorhus/path-is-absolute#readme", "keywords": [ "path", "paths", @@ -40,14 +90,22 @@ "detect", "check" ], - "readme": "# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute)\n\n> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) ponyfill\n\n> Ponyfill: A polyfill that doesn't overwrite the native method\n\n\n## Install\n\n```\n$ npm install --save path-is-absolute\n```\n\n\n## Usage\n\n```js\nvar pathIsAbsolute = require('path-is-absolute');\n\n// Linux\npathIsAbsolute('/home/foo');\n//=> true\n\n// Windows\npathIsAbsolute('C:/Users/');\n//=> true\n\n// Any OS\npathIsAbsolute.posix('/home/foo');\n//=> true\n```\n\n\n## API\n\nSee the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path).\n\n### pathIsAbsolute(path)\n\n### pathIsAbsolute.posix(path)\n\nThe Posix specific version.\n\n### pathIsAbsolute.win32(path)\n\nThe Windows specific version.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", - "readmeFilename": "readme.md", - "bugs": { - "url": "https://github.com/sindresorhus/path-is-absolute/issues" + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "path-is-absolute", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/path-is-absolute.git" }, - "homepage": "https://github.com/sindresorhus/path-is-absolute#readme", - "_id": "path-is-absolute@1.0.0", - "_shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", - "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz", - "_from": "path-is-absolute@>=1.0.0 <2.0.0" + "scripts": { + "test": "xo && node test.js" + }, + "version": "1.0.1" } diff --git a/node_modules/glob/node_modules/path-is-absolute/readme.md b/node_modules/glob/node_modules/path-is-absolute/readme.md index cdf94f430..8dbdf5fcb 100644 --- a/node_modules/glob/node_modules/path-is-absolute/readme.md +++ b/node_modules/glob/node_modules/path-is-absolute/readme.md @@ -1,8 +1,6 @@ # path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) -> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) ponyfill - -> Ponyfill: A polyfill that doesn't overwrite the native method +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) ## Install @@ -15,19 +13,29 @@ $ npm install --save path-is-absolute ## Usage ```js -var pathIsAbsolute = require('path-is-absolute'); +const pathIsAbsolute = require('path-is-absolute'); -// Linux +// Running on Linux pathIsAbsolute('/home/foo'); //=> true +pathIsAbsolute('C:/Users/foo'); +//=> false -// Windows -pathIsAbsolute('C:/Users/'); +// Running on Windows +pathIsAbsolute('C:/Users/foo'); //=> true +pathIsAbsolute('/home/foo'); +//=> false -// Any OS +// Running on any OS pathIsAbsolute.posix('/home/foo'); //=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false ``` @@ -39,13 +47,13 @@ See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isa ### pathIsAbsolute.posix(path) -The Posix specific version. +POSIX specific version. ### pathIsAbsolute.win32(path) -The Windows specific version. +Windows specific version. ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json index 66ce2c924..73fed0ed7 100644 --- a/node_modules/glob/package.json +++ b/node_modules/glob/package.json @@ -2,25 +2,25 @@ "_args": [ [ { - "raw": "glob@7.0.6", + "raw": "glob@7.1.0", "scope": null, "escapedName": "glob", "name": "glob", - "rawSpec": "7.0.6", - "spec": "7.0.6", + "rawSpec": "7.1.0", + "spec": "7.1.0", "type": "version" }, - "/Users/zkat/Documents/code/npm" + "/Users/rebecca/code/npm" ] ], - "_from": "glob@7.0.6", - "_id": "glob@7.0.6", + "_from": "glob@7.1.0", + "_id": "glob@7.1.0", "_inCache": true, "_location": "/glob", - "_nodeVersion": "4.5.0", + "_nodeVersion": "6.5.0", "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/glob-7.0.6.tgz_1472074762911_0.47247025789693" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/glob-7.1.0.tgz_1474396131090_0.08145137410610914" }, "_npmUser": { "name": "isaacs", @@ -29,12 +29,12 @@ "_npmVersion": "3.10.7", "_phantomChildren": {}, "_requested": { - "raw": "glob@7.0.6", + "raw": "glob@7.1.0", "scope": null, "escapedName": "glob", "name": "glob", - "rawSpec": "7.0.6", - "spec": "7.0.6", + "rawSpec": "7.1.0", + "spec": "7.1.0", "type": "version" }, "_requiredBy": [ @@ -42,15 +42,14 @@ "/", "/node-gyp", "/rimraf", - "/standard/standard-engine/deglob", "/tap", "/tap/tap-mocha-reporter" ], - "_resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", - "_shasum": "211bafaf49e525b8cd93260d14ab136152b3f57a", + "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.0.tgz", + "_shasum": "36add856d746d0d99e4cc2797bba1ae2c67272fd", "_shrinkwrap": null, - "_spec": "glob@7.0.6", - "_where": "/Users/zkat/Documents/code/npm", + "_spec": "glob@7.1.0", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -71,13 +70,13 @@ "devDependencies": { "mkdirp": "0", "rimraf": "^2.2.8", - "tap": "^5.7.0", + "tap": "^7.1.2", "tick": "0.0.6" }, "directories": {}, "dist": { - "shasum": "211bafaf49e525b8cd93260d14ab136152b3f57a", - "tarball": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz" + "shasum": "36add856d746d0d99e4cc2797bba1ae2c67272fd", + "tarball": "https://registry.npmjs.org/glob/-/glob-7.1.0.tgz" }, "engines": { "node": "*" @@ -87,7 +86,7 @@ "sync.js", "common.js" ], - "gitHead": "98327d8def195b1ba200217952df8ea829426038", + "gitHead": "f65f9eb7eda113528c5257b58fac4ca685ee6c4f", "homepage": "https://github.com/isaacs/node-glob#readme", "license": "ISC", "main": "glob.js", @@ -113,5 +112,5 @@ "test": "tap test/*.js --cov", "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" }, - "version": "7.0.6" + "version": "7.1.0" } diff --git a/node_modules/glob/sync.js b/node_modules/glob/sync.js index bba2dc6a0..f9834dcd7 100644 --- a/node_modules/glob/sync.js +++ b/node_modules/glob/sync.js @@ -16,6 +16,7 @@ var alphasorti = common.alphasorti var setopts = common.setopts var ownProp = common.ownProp var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored function globSync (pattern, options) { if (typeof options === 'function' || arguments.length === 3) @@ -187,7 +188,7 @@ GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, if (e.charAt(0) === '/' && !this.nomount) { e = path.join(this.root, e) } - this.matches[index][e] = true + this._emitMatch(index, e) } // This was the last one, and no stats were needed return @@ -209,20 +210,29 @@ GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + var abs = this._makeAbs(e) + if (this.mark) e = this._mark(e) + if (this.absolute) { + e = abs + } + if (this.matches[index][e]) return if (this.nodir) { - var c = this.cache[this._makeAbs(e)] + var c = this.cache[abs] if (c === 'DIR' || Array.isArray(c)) return } this.matches[index][e] = true + if (this.stat) this._stat(e) } @@ -399,7 +409,7 @@ GlobSync.prototype._processSimple = function (prefix, index) { prefix = prefix.replace(/\\/g, '/') // Mark this as a match - this.matches[index][prefix] = true + this._emitMatch(index, prefix) } // Returns either 'DIR', 'FILE', or false |