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>2012-03-01 20:29:58 +0400
committerisaacs <i@izs.me>2012-03-01 20:29:58 +0400
commit4bb4e9d0ca3c57e765561c6bb8a38b1b62dc0adf (patch)
treec4d7a93b9c34ddfb433bbe6c201432715b6c8cfe /node_modules
parenta27de64071231f74bcd27eb7b69f3492c7e830c9 (diff)
Update which to 1.0.4
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/which/package.json25
-rw-r--r--node_modules/which/which.js29
2 files changed, 47 insertions, 7 deletions
diff --git a/node_modules/which/package.json b/node_modules/which/package.json
index ea26853b8..a48f18249 100644
--- a/node_modules/which/package.json
+++ b/node_modules/which/package.json
@@ -1,17 +1,34 @@
{
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me"
+ },
"name": "which",
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
- "version": "1.0.3",
+ "version": "1.0.4",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-which.git"
},
"main": "which.js",
- "bin": "./bin/which",
+ "bin": {
+ "which": "./bin/which"
+ },
"engines": {
"node": "*"
},
"dependencies": {},
- "devDependencies": {}
+ "devDependencies": {},
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "_id": "which@1.0.4",
+ "optionalDependencies": {},
+ "_engineSupported": true,
+ "_npmVersion": "1.1.2",
+ "_nodeVersion": "v0.7.6-pre",
+ "_defaultsLoaded": true,
+ "_from": "which@1"
}
diff --git a/node_modules/which/which.js b/node_modules/which/which.js
index 634e3af6e..fe97308c5 100644
--- a/node_modules/which/which.js
+++ b/node_modules/which/which.js
@@ -27,13 +27,16 @@ if (process.platform == "win32") {
}
}
+
+
function which (cmd, cb) {
- if (cmd.charAt(0) === "/") return cb(null, cmd)
+ if (isAbsolute(cmd)) return cmd
var pathEnv = (process.env.PATH || "").split(COLON)
, pathExt = [""]
if (process.platform === "win32") {
pathEnv.push(process.cwd())
pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
+ if (cmd.indexOf(".") !== -1) pathExt.unshift("")
}
//console.error("pathEnv", pathEnv)
;(function F (i, l) {
@@ -57,14 +60,14 @@ function which (cmd, cb) {
})(0, pathEnv.length)
}
-
function whichSync (cmd) {
- if (cmd.charAt(0) === "/") return cmd
+ if (isAbsolute(cmd)) return cmd
var pathEnv = (process.env.PATH || "").split(COLON)
, pathExt = [""]
if (process.platform === "win32") {
pathEnv.push(process.cwd())
pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
+ if (cmd.indexOf(".") !== -1) pathExt.unshift("")
}
for (var i = 0, l = pathEnv.length; i < l; i ++) {
var p = path.join(pathEnv[i], cmd)
@@ -79,3 +82,23 @@ function whichSync (cmd) {
}
throw new Error("not found: "+cmd)
}
+
+var isAbsolute = process.platform === "win32" ? absWin : absUnix
+
+function absWin (p) {
+ if (absUnix(p)) return true
+ // pull off the device/UNC bit from a windows path.
+ // from node's lib/path.js
+ var splitDeviceRe =
+ /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/
+ , result = splitDeviceRe.exec(p)
+ , device = result[1] || ''
+ , isUnc = device && device.charAt(1) !== ':'
+ , isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
+
+ return isAbsolute
+}
+
+function absUnix (p) {
+ return p.charAt(0) === "/" || p === ""
+}