Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-06-06 10:22:27 +0400
committerisaacs <i@izs.me>2014-06-06 10:22:27 +0400
commit57ac974e9bc88bc546a1a6b39810c28ad2423319 (patch)
tree56ede59195673a21d108b498cac2e668289a081b /node_modules/glob
parentc535eddf307110eb60eee4f6add706a29b165a68 (diff)
Update glob and things depending on glob
Diffstat (limited to 'node_modules/glob')
-rw-r--r--node_modules/glob/.travis.yml3
-rw-r--r--node_modules/glob/glob.js14
-rw-r--r--node_modules/glob/package.json33
-rw-r--r--node_modules/glob/test/bash-results.json3
-rw-r--r--node_modules/glob/test/empty-set.js20
-rw-r--r--node_modules/glob/test/error-callback.js20
-rw-r--r--node_modules/glob/test/nocase-nomagic.js19
-rw-r--r--node_modules/glob/test/stat.js2
8 files changed, 98 insertions, 16 deletions
diff --git a/node_modules/glob/.travis.yml b/node_modules/glob/.travis.yml
index baa0031d5..fca8ef019 100644
--- a/node_modules/glob/.travis.yml
+++ b/node_modules/glob/.travis.yml
@@ -1,3 +1,4 @@
language: node_js
node_js:
- - 0.8
+ - 0.10
+ - 0.11
diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js
index f646c4483..b55ac8c09 100644
--- a/node_modules/glob/glob.js
+++ b/node_modules/glob/glob.js
@@ -44,6 +44,7 @@ var fs = require("fs")
, path = require("path")
, isDir = {}
, assert = require("assert").ok
+, once = require("once")
function glob (pattern, options, cb) {
if (typeof options === "function") cb = options, options = {}
@@ -91,6 +92,7 @@ function Glob (pattern, options, cb) {
}
if (typeof cb === "function") {
+ cb = once(cb)
this.on("error", cb)
this.on("end", function (matches) {
cb(null, matches)
@@ -149,6 +151,10 @@ function Glob (pattern, options, cb) {
this.stat = !!options.stat
this.debug = !!options.debug || !!options.globDebug
+
+ if (/\bglob\b/.test(process.env.NODE_DEBUG || ''))
+ this.debug = true
+
if (this.debug)
this.log = console.error
@@ -176,6 +182,10 @@ function Glob (pattern, options, cb) {
// Keep them as a list so we can fill in when nonull is set.
this.matches = new Array(n)
+ if (this.minimatch.set.length === 0) {
+ return process.nextTick(this._finish.bind(this))
+ }
+
this.minimatch.set.forEach(iterator.bind(this))
function iterator (pattern, i, set) {
this._process(pattern, 0, i, function (er) {
@@ -429,9 +439,9 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
if (prefix === null) read = "."
else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
if (!prefix || !isAbsolute(prefix)) {
- prefix = path.join("/", prefix)
+ prefix = "/" + prefix
}
- read = prefix = path.resolve(prefix)
+ read = prefix
// if (process.platform === "win32")
// read = prefix = prefix.replace(/^[a-zA-Z]:|\\/g, "/")
diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json
index 795af8cbe..2e0b69603 100644
--- a/node_modules/glob/package.json
+++ b/node_modules/glob/package.json
@@ -6,7 +6,7 @@
},
"name": "glob",
"description": "a little globber",
- "version": "3.2.10",
+ "version": "4.0.2",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
@@ -17,7 +17,8 @@
},
"dependencies": {
"inherits": "2",
- "minimatch": "^0.3.0"
+ "minimatch": "^0.3.0",
+ "once": "^1.3.0"
},
"devDependencies": {
"tap": "~0.4.0",
@@ -29,14 +30,30 @@
"test-regen": "TEST_REGEN=1 node test/00-setup.js"
},
"license": "BSD",
- "readme": "# Glob\n\nMatch files using the patterns the shell uses, like stars and stuff.\n\nThis is a glob implementation in JavaScript. It uses the `minimatch`\nlibrary to do its matching.\n\n## Attention: node-glob users!\n\nThe API has changed dramatically between 2.x and 3.x. This library is\nnow 100% JavaScript, and the integer flags have been replaced with an\noptions object.\n\nAlso, there's an event emitter class, proper tests, and all the other\nthings you've come to expect from node modules.\n\nAnd best of all, no compilation!\n\n## Usage\n\n```javascript\nvar glob = require(\"glob\")\n\n// options is optional\nglob(\"**/*.js\", options, function (er, files) {\n // files is an array of filenames.\n // If the `nonull` option is set, and nothing\n // was found, then files is [\"**/*.js\"]\n // er is an error object or null.\n})\n```\n\n## Features\n\nPlease see the [minimatch\ndocumentation](https://github.com/isaacs/minimatch) for more details.\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n* [minimatch documentation](https://github.com/isaacs/minimatch)\n\n## glob(pattern, [options], cb)\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* `cb` {Function}\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nPerform an asynchronous glob search.\n\n## glob.sync(pattern, [options])\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* return: {Array<String>} filenames found matching the pattern\n\nPerform a synchronous glob search.\n\n## Class: glob.Glob\n\nCreate a Glob object by instanting the `glob.Glob` class.\n\n```javascript\nvar Glob = require(\"glob\").Glob\nvar mg = new Glob(pattern, options, cb)\n```\n\nIt's an EventEmitter, and starts walking the filesystem to find matches\nimmediately.\n\n### new glob.Glob(pattern, [options], [cb])\n\n* `pattern` {String} pattern to search for\n* `options` {Object}\n* `cb` {Function} Called when an error occurs, or matches are found\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nNote that if the `sync` flag is set in the options, then matches will\nbe immediately available on the `g.found` member.\n\n### Properties\n\n* `minimatch` The minimatch object that the glob uses.\n* `options` The options object passed in.\n* `error` The error encountered. When an error is encountered, the\n glob object is in an undefined state, and should be discarded.\n* `aborted` Boolean which is set to true when calling `abort()`. There\n is no way at this time to continue a glob search after aborting, but\n you can re-use the statCache to avoid having to duplicate syscalls.\n* `statCache` Collection of all the stat results the glob search\n performed.\n* `cache` Convenience object. Each field has the following possible\n values:\n * `false` - Path does not exist\n * `true` - Path exists\n * `1` - Path exists, and is not a directory\n * `2` - Path exists, and is a directory\n * `[file, entries, ...]` - Path exists, is a directory, and the\n array value is the results of `fs.readdir`\n\n### Events\n\n* `end` When the matching is finished, this is emitted with all the\n matches found. If the `nonull` option is set, and no match was found,\n then the `matches` list contains the original pattern. The matches\n are sorted, unless the `nosort` flag is set.\n* `match` Every time a match is found, this is emitted with the matched.\n* `error` Emitted when an unexpected error is encountered, or whenever\n any fs error occurs if `options.strict` is set.\n* `abort` When `abort()` is called, this event is raised.\n\n### Methods\n\n* `abort` Stop the search.\n\n### Options\n\nAll the options that can be passed to Minimatch can also be passed to\nGlob to change pattern matching behavior. Also, some have been added,\nor have glob-specific ramifications.\n\nAll options are false by default, unless otherwise noted.\n\nAll options are added to the glob object, as well.\n\n* `cwd` The current working directory in which to search. Defaults\n to `process.cwd()`.\n* `root` The place where patterns starting with `/` will be mounted\n onto. Defaults to `path.resolve(options.cwd, \"/\")` (`/` on Unix\n systems, and `C:\\` or some such on Windows.)\n* `dot` Include `.dot` files in normal matches and `globstar` matches.\n Note that an explicit dot in a portion of the pattern will always\n match dot files.\n* `nomount` By default, a pattern starting with a forward-slash will be\n \"mounted\" onto the root setting, so that a valid filesystem path is\n returned. Set this flag to disable that behavior.\n* `mark` Add a `/` character to directory matches. Note that this\n requires additional stat calls.\n* `nosort` Don't sort the results.\n* `stat` Set to true to stat *all* results. This reduces performance\n somewhat, and is completely unnecessary, unless `readdir` is presumed\n to be an untrustworthy indicator of file existence. It will cause\n ELOOP to be triggered one level sooner in the case of cyclical\n symbolic links.\n* `silent` When an unusual error is encountered\n when attempting to read a directory, a warning will be printed to\n stderr. Set the `silent` option to true to suppress these warnings.\n* `strict` When an unusual error is encountered\n when attempting to read a directory, the process will just continue on\n in search of other matches. Set the `strict` option to raise an error\n in these cases.\n* `cache` See `cache` property above. Pass in a previously generated\n cache object to save some fs calls.\n* `statCache` A cache of results of filesystem information, to prevent\n unnecessary stat calls. While it should not normally be necessary to\n set this, you may pass the statCache from one glob() call to the\n options object of another, if you know that the filesystem will not\n change between calls. (See \"Race Conditions\" below.)\n* `sync` Perform a synchronous glob search.\n* `nounique` In some cases, brace-expanded patterns can result in the\n same file showing up multiple times in the result set. By default,\n this implementation prevents duplicates in the result set.\n Set this flag to disable that behavior.\n* `nonull` Set to never return an empty set, instead returning a set\n containing the pattern itself. This is the default in glob(3).\n* `nocase` Perform a case-insensitive match. Note that case-insensitive\n filesystems will sometimes result in glob returning results that are\n case-insensitively matched anyway, since readdir and stat will not\n raise an error.\n* `debug` Set to enable debug logging in minimatch and glob.\n* `globDebug` Set to enable debug logging in glob, but not minimatch.\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between node-glob and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen glob returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`glob.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n## Windows\n\n**Please only use forward-slashes in glob expressions.**\n\nThough windows uses either `/` or `\\` as its path separator, only `/`\ncharacters are used by this glob implementation. You must use\nforward-slashes **only** in glob expressions. Back-slashes will always\nbe interpreted as escape characters, not path separators.\n\nResults from absolute patterns such as `/foo/*` are mounted onto the\nroot setting using `path.join`. On windows, this will by default result\nin `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## Race Conditions\n\nGlob searching, by its very nature, is susceptible to race conditions,\nsince it relies on directory walking and such.\n\nAs a result, it is possible that a file that exists when glob looks for\nit may have been deleted or modified by the time it returns the result.\n\nAs part of its internal implementation, this program caches all stat\nand readdir calls that it makes, in order to cut down on system\noverhead. However, this also makes it even more susceptible to races,\nespecially if the cache or statCache objects are reused between glob\ncalls.\n\nUsers are thus advised not to use a glob result as a guarantee of\nfilesystem state in the face of rapid changes. For the vast majority\nof operations, this is never a problem.\n",
- "readmeFilename": "README.md",
- "gitHead": "4e00805b5529af626bf0512d6810c27a96ca2a12",
+ "gitHead": "4e85a5bcb2f28f82fa9836b6b2baba8af8e31e96",
"bugs": {
"url": "https://github.com/isaacs/node-glob/issues"
},
"homepage": "https://github.com/isaacs/node-glob",
- "_id": "glob@3.2.10",
- "_shasum": "e229a4d843fdabca3dd8cdc96c456e29c6e79f13",
- "_from": "glob@latest"
+ "_id": "glob@4.0.2",
+ "_shasum": "d57dbdf54984dd7635c8247d1f2ebde2e81f4ee1",
+ "_from": "glob@latest",
+ "_npmVersion": "1.4.13",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "d57dbdf54984dd7635c8247d1f2ebde2e81f4ee1",
+ "tarball": "http://registry.npmjs.org/glob/-/glob-4.0.2.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/glob/-/glob-4.0.2.tgz",
+ "readme": "ERROR: No README data found!"
}
diff --git a/node_modules/glob/test/bash-results.json b/node_modules/glob/test/bash-results.json
index 8051c7238..726d332e7 100644
--- a/node_modules/glob/test/bash-results.json
+++ b/node_modules/glob/test/bash-results.json
@@ -286,6 +286,7 @@
"./node_modules/inherits",
"./node_modules/minimatch",
"./node_modules/mkdirp",
+ "./node_modules/once",
"./node_modules/rimraf",
"./node_modules/tap",
"./test/00-setup.js",
@@ -293,6 +294,8 @@
"./test/bash-comparison.js",
"./test/bash-results.json",
"./test/cwd-test.js",
+ "./test/empty-set.js",
+ "./test/error-callback.js",
"./test/globstar-match.js",
"./test/mark.js",
"./test/new-glob-optional-options.js",
diff --git a/node_modules/glob/test/empty-set.js b/node_modules/glob/test/empty-set.js
new file mode 100644
index 000000000..3b627b0ab
--- /dev/null
+++ b/node_modules/glob/test/empty-set.js
@@ -0,0 +1,20 @@
+var test = require('tap').test
+var glob = require("../glob.js")
+
+// Patterns that cannot match anything
+var patterns = [
+ '# comment',
+ ' ',
+ '\n',
+ 'just doesnt happen to match anything so this is a control'
+]
+
+patterns.forEach(function (p) {
+ test(JSON.stringify(p), function (t) {
+ glob(p, function (e, f) {
+ t.equal(e, null, 'no error')
+ t.same(f, [], 'no returned values')
+ t.end()
+ })
+ })
+})
diff --git a/node_modules/glob/test/error-callback.js b/node_modules/glob/test/error-callback.js
new file mode 100644
index 000000000..0b64aadf3
--- /dev/null
+++ b/node_modules/glob/test/error-callback.js
@@ -0,0 +1,20 @@
+var fs = require('fs')
+var test = require('tap').test
+var glob = require('../')
+
+test('mock fs', function(t) {
+ fs.readdir = function(path, cb) {
+ process.nextTick(function() {
+ cb(new Error('mock fs.readdir error'))
+ })
+ }
+ t.pass('mocked')
+ t.end()
+})
+
+test('error callback', function(t) {
+ glob('*', function(err, res) {
+ t.ok(err, 'expecting mock error')
+ t.end()
+ })
+})
diff --git a/node_modules/glob/test/nocase-nomagic.js b/node_modules/glob/test/nocase-nomagic.js
index 2503f2310..162aaa1a6 100644
--- a/node_modules/glob/test/nocase-nomagic.js
+++ b/node_modules/glob/test/nocase-nomagic.js
@@ -11,10 +11,10 @@ test('mock fs', function(t) {
function fakeStat(path) {
var ret
switch (path.toLowerCase()) {
- case '/tmp': case '/tmp/':
+ case '/tmp': case '/tmp/': case 'c:\\tmp': case 'c:\\tmp\\':
ret = { isDirectory: function() { return true } }
break
- case '/tmp/a':
+ case '/tmp/a': case 'c:\\tmp\\a':
ret = { isDirectory: function() { return false } }
break
}
@@ -39,10 +39,10 @@ test('mock fs', function(t) {
function fakeReaddir(path) {
var ret
switch (path.toLowerCase()) {
- case '/tmp': case '/tmp/':
+ case '/tmp': case '/tmp/': case 'c:\\tmp': case 'c:\\tmp\\':
ret = [ 'a', 'A' ]
break
- case '/':
+ case '/': case 'c:\\':
ret = ['tmp', 'tMp', 'tMP', 'TMP']
}
return ret
@@ -76,6 +76,11 @@ test('nocase, nomagic', function(t) {
'/tMp/a',
'/tmp/A',
'/tmp/a' ]
+ if(process.platform.match(/^win/)) {
+ want = want.map(function(p) {
+ return 'C:' + p
+ })
+ }
glob('/tmp/a', { nocase: true }, function(er, res) {
if (er)
throw er
@@ -100,6 +105,12 @@ test('nocase, with some magic', function(t) {
'/tMp/a',
'/tmp/A',
'/tmp/a' ]
+ if(process.platform.match(/^win/)) {
+ want = want.map(function(p) {
+ return 'C:' + p
+ })
+ }
+
glob('/tmp/*', { nocase: true }, function(er, res) {
if (er)
throw er
diff --git a/node_modules/glob/test/stat.js b/node_modules/glob/test/stat.js
index 62917114b..f555b39b1 100644
--- a/node_modules/glob/test/stat.js
+++ b/node_modules/glob/test/stat.js
@@ -20,7 +20,7 @@ test('stat all the things', function(t) {
t.same(eof, matches)
var cache = Object.keys(this.statCache)
t.same(cache.map(function (f) {
- return path.relative(__dirname, f)
+ return path.relative(__dirname, f).replace(/\\/g, '/')
}).sort(), matches)
cache.forEach(function(c) {