You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2017/05/25 20:38:44 UTC

[24/25] cordova-browser git commit: remove bundled dep on and move shelljs to reasonable version

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/cp.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/cp.js b/node_modules/shelljs/src/cp.js
index 04c4e57..ef19f96 100644
--- a/node_modules/shelljs/src/cp.js
+++ b/node_modules/shelljs/src/cp.js
@@ -3,79 +3,42 @@ var path = require('path');
 var common = require('./common');
 var os = require('os');
 
-common.register('cp', _cp, {
-  cmdOptions: {
-    'f': '!no_force',
-    'n': 'no_force',
-    'u': 'update',
-    'R': 'recursive',
-    'r': 'recursive',
-    'L': 'followsymlink',
-    'P': 'noFollowsymlink',
-  },
-  wrapOutput: false,
-});
-
 // Buffered file copy, synchronous
 // (Using readFileSync() + writeFileSync() could easily cause a memory overflow
 //  with large files)
-function copyFileSync(srcFile, destFile, options) {
-  if (!fs.existsSync(srcFile)) {
+function copyFileSync(srcFile, destFile) {
+  if (!fs.existsSync(srcFile))
     common.error('copyFileSync: no such file or directory: ' + srcFile);
-  }
 
-  // Check the mtimes of the files if the '-u' flag is provided
+  var BUF_LENGTH = 64*1024,
+      buf = new Buffer(BUF_LENGTH),
+      bytesRead = BUF_LENGTH,
+      pos = 0,
+      fdr = null,
+      fdw = null;
+
   try {
-    if (options.update && fs.statSync(srcFile).mtime < fs.statSync(destFile).mtime) {
-      return;
-    }
-  } catch (e) {
-    // If we're here, destFile probably doesn't exist, so just do a normal copy
+    fdr = fs.openSync(srcFile, 'r');
+  } catch(e) {
+    common.error('copyFileSync: could not read src file ('+srcFile+')');
   }
 
-  if (fs.lstatSync(srcFile).isSymbolicLink() && !options.followsymlink) {
-    try {
-      fs.lstatSync(destFile);
-      common.unlinkSync(destFile); // re-link it
-    } catch (e) {
-      // it doesn't exist, so no work needs to be done
-    }
-
-    var symlinkFull = fs.readlinkSync(srcFile);
-    fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null);
-  } else {
-    var BUF_LENGTH = 64 * 1024;
-    var buf = new Buffer(BUF_LENGTH);
-    var bytesRead = BUF_LENGTH;
-    var pos = 0;
-    var fdr = null;
-    var fdw = null;
-
-    try {
-      fdr = fs.openSync(srcFile, 'r');
-    } catch (e) {
-      /* istanbul ignore next */
-      common.error('copyFileSync: could not read src file (' + srcFile + ')');
-    }
-
-    try {
-      fdw = fs.openSync(destFile, 'w');
-    } catch (e) {
-      /* istanbul ignore next */
-      common.error('copyFileSync: could not write to dest file (code=' + e.code + '):' + destFile);
-    }
+  try {
+    fdw = fs.openSync(destFile, 'w');
+  } catch(e) {
+    common.error('copyFileSync: could not write to dest file (code='+e.code+'):'+destFile);
+  }
 
-    while (bytesRead === BUF_LENGTH) {
-      bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
-      fs.writeSync(fdw, buf, 0, bytesRead);
-      pos += bytesRead;
-    }
+  while (bytesRead === BUF_LENGTH) {
+    bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
+    fs.writeSync(fdw, buf, 0, bytesRead);
+    pos += bytesRead;
+  }
 
-    fs.closeSync(fdr);
-    fs.closeSync(fdw);
+  fs.closeSync(fdr);
+  fs.closeSync(fdw);
 
-    fs.chmodSync(destFile, fs.statSync(srcFile).mode);
-  }
+  fs.chmodSync(destFile, fs.statSync(srcFile).mode);
 }
 
 // Recursively copies 'sourceDir' into 'destDir'
@@ -86,193 +49,156 @@ function copyFileSync(srcFile, destFile, options) {
 //
 // Licensed under the MIT License
 // http://www.opensource.org/licenses/mit-license.php
-function cpdirSyncRecursive(sourceDir, destDir, currentDepth, opts) {
+function cpdirSyncRecursive(sourceDir, destDir, opts) {
   if (!opts) opts = {};
 
-  // Ensure there is not a run away recursive copy
-  if (currentDepth >= common.config.maxdepth) return;
-  currentDepth++;
-
-  // Create the directory where all our junk is moving to; read the mode of the
-  // source directory and mirror it
+  /* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */
+  var checkDir = fs.statSync(sourceDir);
   try {
-    var checkDir = fs.statSync(sourceDir);
     fs.mkdirSync(destDir, checkDir.mode);
   } catch (e) {
-    // if the directory already exists, that's okay
+    //if the directory already exists, that's okay
     if (e.code !== 'EEXIST') throw e;
   }
 
   var files = fs.readdirSync(sourceDir);
 
   for (var i = 0; i < files.length; i++) {
-    var srcFile = sourceDir + '/' + files[i];
-    var destFile = destDir + '/' + files[i];
+    var srcFile = sourceDir + "/" + files[i];
+    var destFile = destDir + "/" + files[i];
     var srcFileStat = fs.lstatSync(srcFile);
 
-    var symlinkFull;
-    if (opts.followsymlink) {
-      if (cpcheckcycle(sourceDir, srcFile)) {
-        // Cycle link found.
-        console.error('Cycle link found.');
-        symlinkFull = fs.readlinkSync(srcFile);
-        fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null);
-        continue;
-      }
-    }
     if (srcFileStat.isDirectory()) {
       /* recursion this thing right on back. */
-      cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
-    } else if (srcFileStat.isSymbolicLink() && !opts.followsymlink) {
-      symlinkFull = fs.readlinkSync(srcFile);
-      try {
-        fs.lstatSync(destFile);
-        common.unlinkSync(destFile); // re-link it
-      } catch (e) {
-        // it doesn't exist, so no work needs to be done
-      }
-      fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null);
-    } else if (srcFileStat.isSymbolicLink() && opts.followsymlink) {
-      srcFileStat = fs.statSync(srcFile);
-      if (srcFileStat.isDirectory()) {
-        cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
-      } else {
-        copyFileSync(srcFile, destFile, opts);
-      }
+      cpdirSyncRecursive(srcFile, destFile, opts);
+    } else if (srcFileStat.isSymbolicLink()) {
+      var symlinkFull = fs.readlinkSync(srcFile);
+      fs.symlinkSync(symlinkFull, destFile, os.platform() === "win32" ? "junction" : null);
     } else {
       /* At this point, we've hit a file actually worth copying... so copy it on over. */
-      if (fs.existsSync(destFile) && opts.no_force) {
+      if (fs.existsSync(destFile) && !opts.force) {
         common.log('skipping existing file: ' + files[i]);
       } else {
-        copyFileSync(srcFile, destFile, opts);
+        copyFileSync(srcFile, destFile);
       }
     }
+
   } // for files
 } // cpdirSyncRecursive
 
-function cpcheckcycle(sourceDir, srcFile) {
-  var srcFileStat = fs.lstatSync(srcFile);
-  if (srcFileStat.isSymbolicLink()) {
-    // Do cycle check. For example:
-    //   $ mkdir -p 1/2/3/4
-    //   $ cd  1/2/3/4
-    //   $ ln -s ../../3 link
-    //   $ cd ../../../..
-    //   $ cp -RL 1 copy
-    var cyclecheck = fs.statSync(srcFile);
-    if (cyclecheck.isDirectory()) {
-      var sourcerealpath = fs.realpathSync(sourceDir);
-      var symlinkrealpath = fs.realpathSync(srcFile);
-      var re = new RegExp(symlinkrealpath);
-      if (re.test(sourcerealpath)) {
-        return true;
-      }
-    }
-  }
-  return false;
-}
 
 //@
-//@ ### cp([options,] source [, source ...], dest)
-//@ ### cp([options,] source_array, dest)
+//@ ### cp([options ,] source [,source ...], dest)
+//@ ### cp([options ,] source_array, dest)
 //@ Available options:
 //@
-//@ + `-f`: force (default behavior)
-//@ + `-n`: no-clobber
-//@ + `-u`: only copy if source is newer than dest
-//@ + `-r`, `-R`: recursive
-//@ + `-L`: follow symlinks
-//@ + `-P`: don't follow symlinks
+//@ + `-f`: force
+//@ + `-r, -R`: recursive
 //@
 //@ Examples:
 //@
 //@ ```javascript
 //@ cp('file1', 'dir1');
-//@ cp('-R', 'path/to/dir/', '~/newCopy/');
 //@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
 //@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
 //@ ```
 //@
-//@ Copies files.
+//@ Copies files. The wildcard `*` is accepted.
 function _cp(options, sources, dest) {
-  // If we're missing -R, it actually implies -L (unless -P is explicit)
-  if (options.followsymlink) {
-    options.noFollowsymlink = false;
-  }
-  if (!options.recursive && !options.noFollowsymlink) {
-    options.followsymlink = true;
-  }
+  options = common.parseOptions(options, {
+    'f': 'force',
+    'R': 'recursive',
+    'r': 'recursive'
+  });
 
   // Get sources, dest
   if (arguments.length < 3) {
     common.error('missing <source> and/or <dest>');
-  } else {
+  } else if (arguments.length > 3) {
     sources = [].slice.call(arguments, 1, arguments.length - 1);
     dest = arguments[arguments.length - 1];
+  } else if (typeof sources === 'string') {
+    sources = [sources];
+  } else if ('length' in sources) {
+    sources = sources; // no-op for array
+  } else {
+    common.error('invalid arguments');
   }
 
-  var destExists = fs.existsSync(dest);
-  var destStat = destExists && fs.statSync(dest);
+  var exists = fs.existsSync(dest),
+      stats = exists && fs.statSync(dest);
 
   // Dest is not existing dir, but multiple sources given
-  if ((!destExists || !destStat.isDirectory()) && sources.length > 1) {
+  if ((!exists || !stats.isDirectory()) && sources.length > 1)
     common.error('dest is not a directory (too many sources)');
-  }
 
-  // Dest is an existing file, but -n is given
-  if (destExists && destStat.isFile() && options.no_force) {
-    return new common.ShellString('', '', 0);
+  // Dest is an existing file, but no -f given
+  if (exists && stats.isFile() && !options.force)
+    common.error('dest file already exists: ' + dest);
+
+  if (options.recursive) {
+    // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*"
+    // (see Github issue #15)
+    sources.forEach(function(src, i) {
+      if (src[src.length - 1] === '/')
+        sources[i] += '*';
+    });
+
+    // Create dest
+    try {
+      fs.mkdirSync(dest, parseInt('0777', 8));
+    } catch (e) {
+      // like Unix's cp, keep going even if we can't create dest dir
+    }
   }
 
-  sources.forEach(function (src) {
+  sources = common.expand(sources);
+
+  sources.forEach(function(src) {
     if (!fs.existsSync(src)) {
-      common.error('no such file or directory: ' + src, { continue: true });
+      common.error('no such file or directory: '+src, true);
       return; // skip file
     }
-    var srcStat = fs.statSync(src);
-    if (!options.noFollowsymlink && srcStat.isDirectory()) {
+
+    // If here, src exists
+    if (fs.statSync(src).isDirectory()) {
       if (!options.recursive) {
         // Non-Recursive
-        common.error("omitting directory '" + src + "'", { continue: true });
+        common.log(src + ' is a directory (not copied)');
       } else {
         // Recursive
         // 'cp /a/source dest' should create 'source' in 'dest'
-        var newDest = (destStat && destStat.isDirectory()) ?
-            path.join(dest, path.basename(src)) :
-            dest;
-
+        var newDest = path.join(dest, path.basename(src)),
+            checkDir = fs.statSync(src);
         try {
-          fs.statSync(path.dirname(dest));
-          cpdirSyncRecursive(src, newDest, 0, { no_force: options.no_force, followsymlink: options.followsymlink });
+          fs.mkdirSync(newDest, checkDir.mode);
         } catch (e) {
-          /* istanbul ignore next */
-          common.error("cannot create directory '" + dest + "': No such file or directory");
+          //if the directory already exists, that's okay
+          if (e.code !== 'EEXIST') {
+            common.error('dest file no such file or directory: ' + newDest, true);
+            throw e;
+          }
         }
-      }
-    } else {
-      // If here, src is a file
 
-      // When copying to '/path/dir':
-      //    thisDest = '/path/dir/file1'
-      var thisDest = dest;
-      if (destStat && destStat.isDirectory()) {
-        thisDest = path.normalize(dest + '/' + path.basename(src));
+        cpdirSyncRecursive(src, newDest, {force: options.force});
       }
+      return; // done with dir
+    }
 
-      if (fs.existsSync(thisDest) && options.no_force) {
-        return; // skip file
-      }
+    // If here, src is a file
 
-      if (path.relative(src, thisDest) === '') {
-        // a file cannot be copied to itself, but we want to continue copying other files
-        common.error("'" + thisDest + "' and '" + src + "' are the same file", { continue: true });
-        return;
-      }
+    // When copying to '/path/dir':
+    //    thisDest = '/path/dir/file1'
+    var thisDest = dest;
+    if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
+      thisDest = path.normalize(dest + '/' + path.basename(src));
 
-      copyFileSync(src, thisDest, options);
+    if (fs.existsSync(thisDest) && !options.force) {
+      common.error('dest file already exists: ' + thisDest, true);
+      return; // skip file
     }
-  }); // forEach(src)
 
-  return new common.ShellString('', common.state.error, common.state.errorCode);
+    copyFileSync(src, thisDest);
+  }); // forEach(src)
 }
 module.exports = _cp;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/dirs.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/dirs.js b/node_modules/shelljs/src/dirs.js
index 3806c14..58fae8b 100644
--- a/node_modules/shelljs/src/dirs.js
+++ b/node_modules/shelljs/src/dirs.js
@@ -2,16 +2,6 @@ var common = require('./common');
 var _cd = require('./cd');
 var path = require('path');
 
-common.register('dirs', _dirs, {
-  wrapOutput: false,
-});
-common.register('pushd', _pushd, {
-  wrapOutput: false,
-});
-common.register('popd', _popd, {
-  wrapOutput: false,
-});
-
 // Pushd/popd/dirs internals
 var _dirStack = [];
 
@@ -23,8 +13,9 @@ function _parseStackIndex(index) {
   if (_isStackIndex(index)) {
     if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd
       return (/^-/).test(index) ? Number(index) - 1 : Number(index);
+    } else {
+      common.error(index + ': directory stack index out of range');
     }
-    common.error(index + ': directory stack index out of range');
   } else {
     common.error(index + ': invalid number');
   }
@@ -63,7 +54,7 @@ function _pushd(options, dir) {
   }
 
   options = common.parseOptions(options, {
-    'n': 'no-cd',
+    'n' : 'no-cd'
   });
 
   var dirs = _actualDirStack();
@@ -129,7 +120,7 @@ function _popd(options, index) {
   }
 
   options = common.parseOptions(options, {
-    'n': 'no-cd',
+    'n' : 'no-cd'
   });
 
   if (!_dirStack.length) {
@@ -172,10 +163,10 @@ function _dirs(options, index) {
   }
 
   options = common.parseOptions(options, {
-    'c': 'clear',
+    'c' : 'clear'
   });
 
-  if (options.clear) {
+  if (options['clear']) {
     _dirStack = [];
     return _dirStack;
   }

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/echo.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/echo.js b/node_modules/shelljs/src/echo.js
index 2b0e7d9..760ea84 100644
--- a/node_modules/shelljs/src/echo.js
+++ b/node_modules/shelljs/src/echo.js
@@ -1,14 +1,7 @@
 var common = require('./common');
 
-common.register('echo', _echo, {
-  allowGlobbing: false,
-});
-
-//@
-//@ ### echo([options,] string [, string ...])
-//@ Available options:
 //@
-//@ + `-e`: interpret backslash escapes (default)
+//@ ### echo(string [,string ...])
 //@
 //@ Examples:
 //@
@@ -19,16 +12,9 @@ common.register('echo', _echo, {
 //@
 //@ Prints string to stdout, and returns string with additional utility methods
 //@ like `.to()`.
-function _echo(opts, messages) {
-  // allow strings starting with '-', see issue #20
-  messages = [].slice.call(arguments, opts ? 0 : 1);
-
-  if (messages[0] === '-e') {
-    // ignore -e
-    messages.shift();
-  }
-
-  console.log.apply(console, messages);
-  return messages.join(' ');
+function _echo() {
+  var messages = [].slice.call(arguments, 0);
+  console.log.apply(this, messages);
+  return common.ShellString(messages.join(' '));
 }
 module.exports = _echo;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/error.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/error.js b/node_modules/shelljs/src/error.js
index 507c86d..cca3efb 100644
--- a/node_modules/shelljs/src/error.js
+++ b/node_modules/shelljs/src/error.js
@@ -2,13 +2,9 @@ var common = require('./common');
 
 //@
 //@ ### error()
-//@ Tests if error occurred in the last command. Returns a truthy value if an
-//@ error returned and a falsy value otherwise.
-//@
-//@ **Note**: do not rely on the
-//@ return value to be an error message. If you need the last error message, use
-//@ the `.stderr` attribute from the last command's return value instead.
+//@ Tests if error occurred in the last command. Returns `null` if no error occurred,
+//@ otherwise returns string explaining the error
 function error() {
   return common.state.error;
-}
+};
 module.exports = error;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/exec.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/exec.js b/node_modules/shelljs/src/exec.js
index 5d360e8..d259a9f 100644
--- a/node_modules/shelljs/src/exec.js
+++ b/node_modules/shelljs/src/exec.js
@@ -5,157 +5,101 @@ var path = require('path');
 var fs = require('fs');
 var child = require('child_process');
 
-var DEFAULT_MAXBUFFER_SIZE = 20 * 1024 * 1024;
-
-common.register('exec', _exec, {
-  unix: false,
-  canReceivePipe: true,
-  wrapOutput: false,
-});
-
 // Hack to run child_process.exec() synchronously (sync avoids callback hell)
 // Uses a custom wait loop that checks for a flag file, created when the child process is done.
 // (Can't do a wait loop that checks for internal Node variables/messages as
 // Node is single-threaded; callbacks and other internal state changes are done in the
 // event loop).
-function execSync(cmd, opts, pipe) {
-  if (!common.config.execPath) {
-    common.error('Unable to find a path to the node binary. Please manually set config.execPath');
-  }
-
+function execSync(cmd, opts) {
   var tempDir = _tempDir();
-  var stdoutFile = path.resolve(tempDir + '/' + common.randomFileName());
-  var stderrFile = path.resolve(tempDir + '/' + common.randomFileName());
-  var codeFile = path.resolve(tempDir + '/' + common.randomFileName());
-  var scriptFile = path.resolve(tempDir + '/' + common.randomFileName());
-  var sleepFile = path.resolve(tempDir + '/' + common.randomFileName());
+  var stdoutFile = path.resolve(tempDir+'/'+common.randomFileName()),
+      codeFile = path.resolve(tempDir+'/'+common.randomFileName()),
+      scriptFile = path.resolve(tempDir+'/'+common.randomFileName()),
+      sleepFile = path.resolve(tempDir+'/'+common.randomFileName());
 
-  opts = common.extend({
-    silent: common.config.silent,
-    cwd: _pwd().toString(),
-    env: process.env,
-    maxBuffer: DEFAULT_MAXBUFFER_SIZE,
+  var options = common.extend({
+    silent: common.config.silent
   }, opts);
 
   var previousStdoutContent = '';
-  var previousStderrContent = '';
-  // Echoes stdout and stderr changes from running process, if not silent
-  function updateStream(streamFile) {
-    if (opts.silent || !fs.existsSync(streamFile)) {
+  // Echoes stdout changes from running process, if not silent
+  function updateStdout() {
+    if (options.silent || !fs.existsSync(stdoutFile))
       return;
-    }
 
-    var previousStreamContent;
-    var procStream;
-    if (streamFile === stdoutFile) {
-      previousStreamContent = previousStdoutContent;
-      procStream = process.stdout;
-    } else { // assume stderr
-      previousStreamContent = previousStderrContent;
-      procStream = process.stderr;
-    }
-
-    var streamContent = fs.readFileSync(streamFile, 'utf8');
+    var stdoutContent = fs.readFileSync(stdoutFile, 'utf8');
     // No changes since last time?
-    if (streamContent.length <= previousStreamContent.length) {
+    if (stdoutContent.length <= previousStdoutContent.length)
       return;
-    }
 
-    procStream.write(streamContent.substr(previousStreamContent.length));
-    previousStreamContent = streamContent;
+    process.stdout.write(stdoutContent.substr(previousStdoutContent.length));
+    previousStdoutContent = stdoutContent;
+  }
+
+  function escape(str) {
+    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
   }
 
   if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile);
   if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);
-  if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile);
   if (fs.existsSync(codeFile)) common.unlinkSync(codeFile);
 
-  var execCommand = JSON.stringify(common.config.execPath) + ' ' + JSON.stringify(scriptFile);
-  var script;
-
-  opts.cwd = path.resolve(opts.cwd);
-  var optString = JSON.stringify(opts);
+  var execCommand = '"'+process.execPath+'" '+scriptFile;
+  var execOptions = {
+    env: process.env,
+    cwd: _pwd(),
+    maxBuffer: 20*1024*1024
+  };
 
   if (typeof child.execSync === 'function') {
-    script = [
+    var script = [
       "var child = require('child_process')",
       "  , fs = require('fs');",
-      'var childProcess = child.exec(' + JSON.stringify(cmd) + ', ' + optString + ', function(err) {',
-      '  var fname = ' + JSON.stringify(codeFile) + ';',
-      '  if (!err) {',
-      '    fs.writeFileSync(fname, "0");',
-      '  } else if (err.code === undefined) {',
-      '    fs.writeFileSync(fname, "1");',
-      '  } else {',
-      '    fs.writeFileSync(fname, err.code.toString());',
-      '  }',
-      '});',
-      'var stdoutStream = fs.createWriteStream(' + JSON.stringify(stdoutFile) + ');',
-      'var stderrStream = fs.createWriteStream(' + JSON.stringify(stderrFile) + ');',
-      'childProcess.stdout.pipe(stdoutStream, {end: false});',
-      'childProcess.stderr.pipe(stderrStream, {end: false});',
-      'childProcess.stdout.pipe(process.stdout);',
-      'childProcess.stderr.pipe(process.stderr);',
-    ].join('\n') +
-      (pipe ? '\nchildProcess.stdin.end(' + JSON.stringify(pipe) + ');\n' : '\n') +
-      [
-        'var stdoutEnded = false, stderrEnded = false;',
-        'function tryClosingStdout(){ if(stdoutEnded){ stdoutStream.end(); } }',
-        'function tryClosingStderr(){ if(stderrEnded){ stderrStream.end(); } }',
-        "childProcess.stdout.on('end', function(){ stdoutEnded = true; tryClosingStdout(); });",
-        "childProcess.stderr.on('end', function(){ stderrEnded = true; tryClosingStderr(); });",
-      ].join('\n');
+      "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {",
+      "  fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');",
+      "});",
+      "var stdoutStream = fs.createWriteStream('"+escape(stdoutFile)+"');",
+      "childProcess.stdout.pipe(stdoutStream, {end: false});",
+      "childProcess.stderr.pipe(stdoutStream, {end: false});",
+      "childProcess.stdout.pipe(process.stdout);",
+      "childProcess.stderr.pipe(process.stderr);",
+      "var stdoutEnded = false, stderrEnded = false;",
+      "function tryClosing(){ if(stdoutEnded && stderrEnded){ stdoutStream.end(); } }",
+      "childProcess.stdout.on('end', function(){ stdoutEnded = true; tryClosing(); });",
+      "childProcess.stderr.on('end', function(){ stderrEnded = true; tryClosing(); });"
+    ].join('\n');
 
     fs.writeFileSync(scriptFile, script);
 
-    if (opts.silent) {
-      opts.stdio = 'ignore';
+    if (options.silent) {
+      execOptions.stdio = 'ignore';
     } else {
-      opts.stdio = [0, 1, 2];
+      execOptions.stdio = [0, 1, 2];
     }
 
     // Welcome to the future
-    try {
-      child.execSync(execCommand, opts);
-    } catch (e) {
-      // Clean up immediately if we have an exception
-      try { common.unlinkSync(scriptFile); } catch (e2) {}
-      try { common.unlinkSync(stdoutFile); } catch (e2) {}
-      try { common.unlinkSync(stderrFile); } catch (e2) {}
-      try { common.unlinkSync(codeFile); } catch (e2) {}
-      throw e;
-    }
+    child.execSync(execCommand, execOptions);
   } else {
-    cmd += ' > ' + stdoutFile + ' 2> ' + stderrFile; // works on both win/unix
+    cmd += ' > '+stdoutFile+' 2>&1'; // works on both win/unix
 
-    script = [
+    var script = [
       "var child = require('child_process')",
       "  , fs = require('fs');",
-      'var childProcess = child.exec(' + JSON.stringify(cmd) + ', ' + optString + ', function(err) {',
-      '  var fname = ' + JSON.stringify(codeFile) + ';',
-      '  if (!err) {',
-      '    fs.writeFileSync(fname, "0");',
-      '  } else if (err.code === undefined) {',
-      '    fs.writeFileSync(fname, "1");',
-      '  } else {',
-      '    fs.writeFileSync(fname, err.code.toString());',
-      '  }',
-      '});',
-    ].join('\n') +
-      (pipe ? '\nchildProcess.stdin.end(' + JSON.stringify(pipe) + ');\n' : '\n');
+      "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {",
+      "  fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');",
+      "});"
+    ].join('\n');
 
     fs.writeFileSync(scriptFile, script);
 
-    child.exec(execCommand, opts);
+    child.exec(execCommand, execOptions);
 
     // The wait loop
     // sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage
     // (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing
     // CPU usage, though apparently not so much on Windows)
-    while (!fs.existsSync(codeFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); }
-    while (!fs.existsSync(stdoutFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); }
-    while (!fs.existsSync(stderrFile)) { updateStream(stderrFile); fs.writeFileSync(sleepFile, 'a'); }
-    try { common.unlinkSync(sleepFile); } catch (e) {}
+    while (!fs.existsSync(codeFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
+    while (!fs.existsSync(stdoutFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
   }
 
   // At this point codeFile exists, but it's not necessarily flushed yet.
@@ -166,56 +110,48 @@ function execSync(cmd, opts, pipe) {
   }
 
   var stdout = fs.readFileSync(stdoutFile, 'utf8');
-  var stderr = fs.readFileSync(stderrFile, 'utf8');
 
   // No biggie if we can't erase the files now -- they're in a temp dir anyway
-  try { common.unlinkSync(scriptFile); } catch (e) {}
-  try { common.unlinkSync(stdoutFile); } catch (e) {}
-  try { common.unlinkSync(stderrFile); } catch (e) {}
-  try { common.unlinkSync(codeFile); } catch (e) {}
-
-  if (code !== 0) {
-    common.error('', code, { continue: true });
+  try { common.unlinkSync(scriptFile); } catch(e) {}
+  try { common.unlinkSync(stdoutFile); } catch(e) {}
+  try { common.unlinkSync(codeFile); } catch(e) {}
+  try { common.unlinkSync(sleepFile); } catch(e) {}
+
+  // some shell return codes are defined as errors, per http://tldp.org/LDP/abs/html/exitcodes.html
+  if (code === 1 || code === 2 || code >= 126)  {
+      common.error('', true); // unix/shell doesn't really give an error message after non-zero exit codes
   }
-  var obj = common.ShellString(stdout, stderr, code);
+  // True if successful, false if not
+  var obj = {
+    code: code,
+    output: stdout
+  };
   return obj;
 } // execSync()
 
 // Wrapper around exec() to enable echoing output to console in real time
-function execAsync(cmd, opts, pipe, callback) {
-  var stdout = '';
-  var stderr = '';
+function execAsync(cmd, opts, callback) {
+  var output = '';
 
-  opts = common.extend({
-    silent: common.config.silent,
-    cwd: _pwd().toString(),
-    env: process.env,
-    maxBuffer: DEFAULT_MAXBUFFER_SIZE,
+  var options = common.extend({
+    silent: common.config.silent
   }, opts);
 
-  var c = child.exec(cmd, opts, function (err) {
-    if (callback) {
-      if (!err) {
-        callback(0, stdout, stderr);
-      } else if (err.code === undefined) {
-        // See issue #536
-        callback(1, stdout, stderr);
-      } else {
-        callback(err.code, stdout, stderr);
-      }
-    }
+  var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) {
+    if (callback)
+      callback(err ? err.code : 0, output);
   });
 
-  if (pipe) c.stdin.end(pipe);
-
-  c.stdout.on('data', function (data) {
-    stdout += data;
-    if (!opts.silent) process.stdout.write(data);
+  c.stdout.on('data', function(data) {
+    output += data;
+    if (!options.silent)
+      process.stdout.write(data);
   });
 
-  c.stderr.on('data', function (data) {
-    stderr += data;
-    if (!opts.silent) process.stderr.write(data);
+  c.stderr.on('data', function(data) {
+    output += data;
+    if (!options.silent)
+      process.stdout.write(data);
   });
 
   return c;
@@ -225,46 +161,36 @@ function execAsync(cmd, opts, pipe, callback) {
 //@ ### exec(command [, options] [, callback])
 //@ Available options (all `false` by default):
 //@
-//@ + `async`: Asynchronous execution. If a callback is provided, it will be set to
-//@   `true`, regardless of the passed value.
+//@ + `async`: Asynchronous execution. Defaults to true if a callback is provided.
 //@ + `silent`: Do not echo program output to console.
-//@ + and any option available to Node.js's
-//@   [child_process.exec()](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
 //@
 //@ Examples:
 //@
 //@ ```javascript
-//@ var version = exec('node --version', {silent:true}).stdout;
+//@ var version = exec('node --version', {silent:true}).output;
 //@
 //@ var child = exec('some_long_running_process', {async:true});
 //@ child.stdout.on('data', function(data) {
 //@   /* ... do something with data ... */
 //@ });
 //@
-//@ exec('some_long_running_process', function(code, stdout, stderr) {
+//@ exec('some_long_running_process', function(code, output) {
 //@   console.log('Exit code:', code);
-//@   console.log('Program output:', stdout);
-//@   console.log('Program stderr:', stderr);
+//@   console.log('Program output:', output);
 //@ });
 //@ ```
 //@
-//@ Executes the given `command` _synchronously_, unless otherwise specified.  When in synchronous
-//@ mode, this returns a ShellString (compatible with ShellJS v0.6.x, which returns an object
-//@ of the form `{ code:..., stdout:... , stderr:... }`). Otherwise, this returns the child process
-//@ object, and the `callback` gets the arguments `(code, stdout, stderr)`.
-//@
-//@ Not seeing the behavior you want? `exec()` runs everything through `sh`
-//@ by default (or `cmd.exe` on Windows), which differs from `bash`. If you
-//@ need bash-specific behavior, try out the `{shell: 'path/to/bash'}` option.
+//@ Executes the given `command` _synchronously_, unless otherwise specified.
+//@ When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
+//@ `output` (stdout + stderr)  and its exit `code`. Otherwise returns the child process object, and
+//@ the `callback` gets the arguments `(code, output)`.
 //@
 //@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as
 //@ the current synchronous implementation uses a lot of CPU. This should be getting
 //@ fixed soon.
 function _exec(command, options, callback) {
-  options = options || {};
-  if (!command) common.error('must specify command');
-
-  var pipe = common.readFromPipe();
+  if (!command)
+    common.error('must specify command');
 
   // Callback is defined instead of options.
   if (typeof options === 'function') {
@@ -279,17 +205,12 @@ function _exec(command, options, callback) {
 
   options = common.extend({
     silent: common.config.silent,
-    async: false,
+    async: false
   }, options);
 
-  try {
-    if (options.async) {
-      return execAsync(command, options, pipe, callback);
-    } else {
-      return execSync(command, options, pipe);
-    }
-  } catch (e) {
-    common.error('internal error');
-  }
+  if (options.async)
+    return execAsync(command, options, callback);
+  else
+    return execSync(command, options);
 }
 module.exports = _exec;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/find.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/find.js b/node_modules/shelljs/src/find.js
index 625aa29..d9eeec2 100644
--- a/node_modules/shelljs/src/find.js
+++ b/node_modules/shelljs/src/find.js
@@ -1,12 +1,9 @@
 var fs = require('fs');
-var path = require('path');
 var common = require('./common');
 var _ls = require('./ls');
 
-common.register('find', _find, {});
-
 //@
-//@ ### find(path [, path ...])
+//@ ### find(path [,path ...])
 //@ ### find(path_array)
 //@ Examples:
 //@
@@ -21,37 +18,30 @@ common.register('find', _find, {});
 //@ The main difference from `ls('-R', path)` is that the resulting file names
 //@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
 function _find(options, paths) {
-  if (!paths) {
+  if (!paths)
     common.error('no path specified');
-  } else if (typeof paths === 'string') {
+  else if (typeof paths === 'object')
+    paths = paths; // assume array
+  else if (typeof paths === 'string')
     paths = [].slice.call(arguments, 1);
-  }
 
   var list = [];
 
   function pushFile(file) {
-    if (common.platform === 'win') {
+    if (common.platform === 'win')
       file = file.replace(/\\/g, '/');
-    }
     list.push(file);
   }
 
   // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs
   // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory
 
-  paths.forEach(function (file) {
-    var stat;
-    try {
-      stat = fs.statSync(file);
-    } catch (e) {
-      common.error('no such file or directory: ' + file);
-    }
-
+  paths.forEach(function(file) {
     pushFile(file);
 
-    if (stat.isDirectory()) {
-      _ls({ recursive: true, all: true }, file).forEach(function (subfile) {
-        pushFile(path.join(file, subfile));
+    if (fs.statSync(file).isDirectory()) {
+      _ls('-RA', file+'/*').forEach(function(subfile) {
+        pushFile(subfile);
       });
     }
   });

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/grep.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/grep.js b/node_modules/shelljs/src/grep.js
index 30842bc..00c7d6a 100644
--- a/node_modules/shelljs/src/grep.js
+++ b/node_modules/shelljs/src/grep.js
@@ -1,22 +1,12 @@
 var common = require('./common');
 var fs = require('fs');
 
-common.register('grep', _grep, {
-  globStart: 2, // don't glob-expand the regex
-  canReceivePipe: true,
-  cmdOptions: {
-    'v': 'inverse',
-    'l': 'nameOnly',
-  },
-});
-
 //@
-//@ ### grep([options,] regex_filter, file [, file ...])
-//@ ### grep([options,] regex_filter, file_array)
+//@ ### grep([options ,] regex_filter, file [, file ...])
+//@ ### grep([options ,] regex_filter, file_array)
 //@ Available options:
 //@
 //@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
-//@ + `-l`: Print only filenames of matching files
 //@
 //@ Examples:
 //@
@@ -26,42 +16,37 @@ common.register('grep', _grep, {
 //@ ```
 //@
 //@ Reads input string from given files and returns a string containing all lines of the
-//@ file that match the given `regex_filter`.
+//@ file that match the given `regex_filter`. Wildcard `*` accepted.
 function _grep(options, regex, files) {
-  // Check if this is coming from a pipe
-  var pipe = common.readFromPipe();
+  options = common.parseOptions(options, {
+    'v': 'inverse'
+  });
 
-  if (!files && !pipe) common.error('no paths given', 2);
+  if (!files)
+    common.error('no paths given');
 
-  files = [].slice.call(arguments, 2);
+  if (typeof files === 'string')
+    files = [].slice.call(arguments, 2);
+  // if it's array leave it as it is
 
-  if (pipe) {
-    files.unshift('-');
-  }
+  files = common.expand(files);
 
-  var grep = [];
-  files.forEach(function (file) {
-    if (!fs.existsSync(file) && file !== '-') {
-      common.error('no such file or directory: ' + file, 2, { continue: true });
+  var grep = '';
+  files.forEach(function(file) {
+    if (!fs.existsSync(file)) {
+      common.error('no such file or directory: ' + file, true);
       return;
     }
 
-    var contents = file === '-' ? pipe : fs.readFileSync(file, 'utf8');
-    var lines = contents.split(/\r*\n/);
-    if (options.nameOnly) {
-      if (contents.match(regex)) {
-        grep.push(file);
-      }
-    } else {
-      lines.forEach(function (line) {
-        var matched = line.match(regex);
-        if ((options.inverse && !matched) || (!options.inverse && matched)) {
-          grep.push(line);
-        }
-      });
-    }
+    var contents = fs.readFileSync(file, 'utf8'),
+        lines = contents.split(/\r*\n/);
+    lines.forEach(function(line) {
+      var matched = line.match(regex);
+      if ((options.inverse && !matched) || (!options.inverse && matched))
+        grep += line + '\n';
+    });
   });
 
-  return grep.join('\n') + '\n';
+  return common.ShellString(grep);
 }
 module.exports = _grep;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/ln.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/ln.js b/node_modules/shelljs/src/ln.js
index 7393d9f..a7b9701 100644
--- a/node_modules/shelljs/src/ln.js
+++ b/node_modules/shelljs/src/ln.js
@@ -1,20 +1,15 @@
 var fs = require('fs');
 var path = require('path');
 var common = require('./common');
-
-common.register('ln', _ln, {
-  cmdOptions: {
-    's': 'symlink',
-    'f': 'force',
-  },
-});
+var os = require('os');
 
 //@
-//@ ### ln([options,] source, dest)
+//@ ### ln(options, source, dest)
+//@ ### ln(source, dest)
 //@ Available options:
 //@
-//@ + `-s`: symlink
-//@ + `-f`: force
+//@ + `s`: symlink
+//@ + `f`: force
 //@
 //@ Examples:
 //@
@@ -25,48 +20,34 @@ common.register('ln', _ln, {
 //@
 //@ Links source to dest. Use -f to force the link, should dest already exist.
 function _ln(options, source, dest) {
+  options = common.parseOptions(options, {
+    's': 'symlink',
+    'f': 'force'
+  });
+
   if (!source || !dest) {
     common.error('Missing <source> and/or <dest>');
   }
 
-  source = String(source);
-  var sourcePath = path.normalize(source).replace(RegExp(path.sep + '$'), '');
-  var isAbsolute = (path.resolve(source) === sourcePath);
+  source = path.resolve(process.cwd(), String(source));
   dest = path.resolve(process.cwd(), String(dest));
 
+  if (!fs.existsSync(source)) {
+    common.error('Source file does not exist', true);
+  }
+
   if (fs.existsSync(dest)) {
     if (!options.force) {
-      common.error('Destination file exists', { continue: true });
+      common.error('Destination file exists', true);
     }
 
     fs.unlinkSync(dest);
   }
 
   if (options.symlink) {
-    var isWindows = common.platform === 'win';
-    var linkType = isWindows ? 'file' : null;
-    var resolvedSourcePath = isAbsolute ? sourcePath : path.resolve(process.cwd(), path.dirname(dest), source);
-    if (!fs.existsSync(resolvedSourcePath)) {
-      common.error('Source file does not exist', { continue: true });
-    } else if (isWindows && fs.statSync(resolvedSourcePath).isDirectory()) {
-      linkType = 'junction';
-    }
-
-    try {
-      fs.symlinkSync(linkType === 'junction' ? resolvedSourcePath : source, dest, linkType);
-    } catch (err) {
-      common.error(err.message);
-    }
+    fs.symlinkSync(source, dest, os.platform() === "win32" ? "junction" : null);
   } else {
-    if (!fs.existsSync(source)) {
-      common.error('Source file does not exist', { continue: true });
-    }
-    try {
-      fs.linkSync(source, dest);
-    } catch (err) {
-      common.error(err.message);
-    }
+    fs.linkSync(source, dest, os.platform() === "win32" ? "junction" : null);
   }
-  return '';
 }
 module.exports = _ln;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/ls.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/ls.js b/node_modules/shelljs/src/ls.js
index bb1b6a7..3345db4 100644
--- a/node_modules/shelljs/src/ls.js
+++ b/node_modules/shelljs/src/ls.js
@@ -1,34 +1,16 @@
 var path = require('path');
 var fs = require('fs');
 var common = require('./common');
-var glob = require('glob');
-
-var globPatternRecursive = path.sep + '**';
-
-common.register('ls', _ls, {
-  cmdOptions: {
-    'R': 'recursive',
-    'A': 'all',
-    'L': 'link',
-    'a': 'all_deprecated',
-    'd': 'directory',
-    'l': 'long',
-  },
-});
+var _cd = require('./cd');
+var _pwd = require('./pwd');
 
 //@
-//@ ### ls([options,] [path, ...])
-//@ ### ls([options,] path_array)
+//@ ### ls([options ,] path [,path ...])
+//@ ### ls([options ,] path_array)
 //@ Available options:
 //@
 //@ + `-R`: recursive
 //@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
-//@ + `-L`: follow symlinks
-//@ + `-d`: list directories themselves, not their contents
-//@ + `-l`: list objects representing each file, each with fields containing `ls
-//@         -l` output fields. See
-//@         [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)
-//@         for more info
 //@
 //@ Examples:
 //@
@@ -36,11 +18,16 @@ common.register('ls', _ls, {
 //@ ls('projs/*.js');
 //@ ls('-R', '/users/me', '/tmp');
 //@ ls('-R', ['/users/me', '/tmp']); // same as above
-//@ ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}
 //@ ```
 //@
 //@ Returns array of files in the given path, or in current directory if no path provided.
 function _ls(options, paths) {
+  options = common.parseOptions(options, {
+    'R': 'recursive',
+    'A': 'all',
+    'a': 'all_deprecated'
+  });
+
   if (options.all_deprecated) {
     // We won't support the -a option as it's hard to image why it's useful
     // (it includes '.' and '..' in addition to '.*' files)
@@ -49,78 +36,91 @@ function _ls(options, paths) {
     options.all = true;
   }
 
-  if (!paths) {
+  if (!paths)
     paths = ['.'];
-  } else {
+  else if (typeof paths === 'object')
+    paths = paths; // assume array
+  else if (typeof paths === 'string')
     paths = [].slice.call(arguments, 1);
-  }
 
   var list = [];
 
-  function pushFile(abs, relName, stat) {
-    if (process.platform === 'win32') {
-      relName = relName.replace(/\\/g, '/');
-    }
-    if (options.long) {
-      stat = stat || (options.link ? fs.statSync(abs) : fs.lstatSync(abs));
-      list.push(addLsAttributes(relName, stat));
-    } else {
-      // list.push(path.relative(rel || '.', file));
-      list.push(relName);
+  // Conditionally pushes file to list - returns true if pushed, false otherwise
+  // (e.g. prevents hidden files to be included unless explicitly told so)
+  function pushFile(file, query) {
+    // hidden file?
+    if (path.basename(file)[0] === '.') {
+      // not explicitly asking for hidden files?
+      if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1))
+        return false;
     }
+
+    if (common.platform === 'win')
+      file = file.replace(/\\/g, '/');
+
+    list.push(file);
+    return true;
   }
 
-  paths.forEach(function (p) {
-    var stat;
+  paths.forEach(function(p) {
+    if (fs.existsSync(p)) {
+      var stats = fs.statSync(p);
+      // Simple file?
+      if (stats.isFile()) {
+        pushFile(p, p);
+        return; // continue
+      }
 
-    try {
-      stat = options.link ? fs.statSync(p) : fs.lstatSync(p);
-    } catch (e) {
-      common.error('no such file or directory: ' + p, 2, { continue: true });
-      return;
-    }
+      // Simple dir?
+      if (stats.isDirectory()) {
+        // Iterate over p contents
+        fs.readdirSync(p).forEach(function(file) {
+          if (!pushFile(file, p))
+            return;
 
-    // If the stat succeeded
-    if (stat.isDirectory() && !options.directory) {
-      if (options.recursive) {
-        // use glob, because it's simple
-        glob.sync(p + globPatternRecursive, { dot: options.all, follow: options.link })
-          .forEach(function (item) {
-            // Glob pattern returns the directory itself and needs to be filtered out.
-            if (path.relative(p, item)) {
-              pushFile(item, path.relative(p, item));
-            }
-          });
-      } else if (options.all) {
-        // use fs.readdirSync, because it's fast
-        fs.readdirSync(p).forEach(function (item) {
-          pushFile(path.join(p, item), item);
-        });
-      } else {
-        // use fs.readdirSync and then filter out secret files
-        fs.readdirSync(p).forEach(function (item) {
-          if (item[0] !== '.') {
-            pushFile(path.join(p, item), item);
+          // Recursive?
+          if (options.recursive) {
+            var oldDir = _pwd();
+            _cd('', p);
+            if (fs.statSync(file).isDirectory())
+              list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*'));
+            _cd('', oldDir);
           }
         });
+        return; // continue
       }
-    } else {
-      pushFile(p, p, stat);
     }
+
+    // p does not exist - possible wildcard present
+
+    var basename = path.basename(p);
+    var dirname = path.dirname(p);
+    // Wildcard present on an existing dir? (e.g. '/tmp/*.js')
+    if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) {
+      // Escape special regular expression chars
+      var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1');
+      // Translates wildcard into regex
+      regexp = '^' + regexp.replace(/\*/g, '.*') + '$';
+      // Iterate over directory contents
+      fs.readdirSync(dirname).forEach(function(file) {
+        if (file.match(new RegExp(regexp))) {
+          if (!pushFile(path.normalize(dirname+'/'+file), basename))
+            return;
+
+          // Recursive?
+          if (options.recursive) {
+            var pp = dirname + '/' + file;
+            if (fs.lstatSync(pp).isDirectory())
+              list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*'));
+          } // recursive
+        } // if file matches
+      }); // forEach
+      return;
+    }
+
+    common.error('no such file or directory: ' + p, true);
   });
 
-  // Add methods, to make this more compatible with ShellStrings
   return list;
 }
-
-function addLsAttributes(pathName, stats) {
-  // Note: this object will contain more information than .toString() returns
-  stats.name = pathName;
-  stats.toString = function () {
-    // Return a string resembling unix's `ls -l` format
-    return [this.mode, this.nlink, this.uid, this.gid, this.size, this.mtime, this.name].join(' ');
-  };
-  return stats;
-}
-
 module.exports = _ls;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/mkdir.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/mkdir.js b/node_modules/shelljs/src/mkdir.js
index 115f75c..5a7088f 100644
--- a/node_modules/shelljs/src/mkdir.js
+++ b/node_modules/shelljs/src/mkdir.js
@@ -2,23 +2,10 @@ var common = require('./common');
 var fs = require('fs');
 var path = require('path');
 
-common.register('mkdir', _mkdir, {
-  cmdOptions: {
-    'p': 'fullpath',
-  },
-});
-
 // Recursively creates 'dir'
 function mkdirSyncRecursive(dir) {
   var baseDir = path.dirname(dir);
 
-  // Prevents some potential problems arising from malformed UNCs or
-  // insufficient permissions.
-  /* istanbul ignore next */
-  if (baseDir === dir) {
-    common.error('dirname() failed: [' + dir + ']');
-  }
-
   // Base dir exists, no recursion necessary
   if (fs.existsSync(baseDir)) {
     fs.mkdirSync(dir, parseInt('0777', 8));
@@ -33,11 +20,11 @@ function mkdirSyncRecursive(dir) {
 }
 
 //@
-//@ ### mkdir([options,] dir [, dir ...])
-//@ ### mkdir([options,] dir_array)
+//@ ### mkdir([options ,] dir [, dir ...])
+//@ ### mkdir([options ,] dir_array)
 //@ Available options:
 //@
-//@ + `-p`: full path (will create intermediate dirs if necessary)
+//@ + `p`: full path (will create intermediate dirs if necessary)
 //@
 //@ Examples:
 //@
@@ -48,46 +35,34 @@ function mkdirSyncRecursive(dir) {
 //@
 //@ Creates directories.
 function _mkdir(options, dirs) {
-  if (!dirs) common.error('no paths given');
+  options = common.parseOptions(options, {
+    'p': 'fullpath'
+  });
+  if (!dirs)
+    common.error('no paths given');
 
-  if (typeof dirs === 'string') {
+  if (typeof dirs === 'string')
     dirs = [].slice.call(arguments, 1);
-  }
   // if it's array leave it as it is
 
-  dirs.forEach(function (dir) {
-    try {
-      fs.lstatSync(dir);
-      if (!options.fullpath) {
-        common.error('path already exists: ' + dir, { continue: true });
-      }
+  dirs.forEach(function(dir) {
+    if (fs.existsSync(dir)) {
+      if (!options.fullpath)
+          common.error('path already exists: ' + dir, true);
       return; // skip dir
-    } catch (e) {
-      // do nothing
     }
 
     // Base dir does not exist, and no -p option given
     var baseDir = path.dirname(dir);
     if (!fs.existsSync(baseDir) && !options.fullpath) {
-      common.error('no such file or directory: ' + baseDir, { continue: true });
+      common.error('no such file or directory: ' + baseDir, true);
       return; // skip dir
     }
 
-    try {
-      if (options.fullpath) {
-        mkdirSyncRecursive(path.resolve(dir));
-      } else {
-        fs.mkdirSync(dir, parseInt('0777', 8));
-      }
-    } catch (e) {
-      if (e.code === 'EACCES') {
-        common.error('cannot create directory ' + dir + ': Permission denied');
-      } else {
-        /* istanbul ignore next */
-        throw e;
-      }
-    }
+    if (options.fullpath)
+      mkdirSyncRecursive(dir);
+    else
+      fs.mkdirSync(dir, parseInt('0777', 8));
   });
-  return '';
 } // mkdir
 module.exports = _mkdir;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/mv.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/mv.js b/node_modules/shelljs/src/mv.js
index 7fc7cf0..11f9607 100644
--- a/node_modules/shelljs/src/mv.js
+++ b/node_modules/shelljs/src/mv.js
@@ -1,34 +1,28 @@
 var fs = require('fs');
 var path = require('path');
 var common = require('./common');
-var cp = require('./cp');
-var rm = require('./rm');
-
-common.register('mv', _mv, {
-  cmdOptions: {
-    'f': '!no_force',
-    'n': 'no_force',
-  },
-});
 
 //@
-//@ ### mv([options ,] source [, source ...], dest')
-//@ ### mv([options ,] source_array, dest')
+//@ ### mv(source [, source ...], dest')
+//@ ### mv(source_array, dest')
 //@ Available options:
 //@
-//@ + `-f`: force (default behavior)
-//@ + `-n`: no-clobber
+//@ + `f`: force
 //@
 //@ Examples:
 //@
 //@ ```javascript
-//@ mv('-n', 'file', 'dir/');
+//@ mv('-f', 'file', 'dir/');
 //@ mv('file1', 'file2', 'dir/');
 //@ mv(['file1', 'file2'], 'dir/'); // same as above
 //@ ```
 //@
-//@ Moves files.
+//@ Moves files. The wildcard `*` is accepted.
 function _mv(options, sources, dest) {
+  options = common.parseOptions(options, {
+    'f': 'force'
+  });
+
   // Get sources, dest
   if (arguments.length < 3) {
     common.error('missing <source> and/or <dest>');
@@ -37,27 +31,28 @@ function _mv(options, sources, dest) {
     dest = arguments[arguments.length - 1];
   } else if (typeof sources === 'string') {
     sources = [sources];
+  } else if ('length' in sources) {
+    sources = sources; // no-op for array
   } else {
-    // TODO(nate): figure out if we actually need this line
     common.error('invalid arguments');
   }
 
-  var exists = fs.existsSync(dest);
-  var stats = exists && fs.statSync(dest);
+  sources = common.expand(sources);
+
+  var exists = fs.existsSync(dest),
+      stats = exists && fs.statSync(dest);
 
   // Dest is not existing dir, but multiple sources given
-  if ((!exists || !stats.isDirectory()) && sources.length > 1) {
+  if ((!exists || !stats.isDirectory()) && sources.length > 1)
     common.error('dest is not a directory (too many sources)');
-  }
 
   // Dest is an existing file, but no -f given
-  if (exists && stats.isFile() && options.no_force) {
+  if (exists && stats.isFile() && !options.force)
     common.error('dest file already exists: ' + dest);
-  }
 
-  sources.forEach(function (src) {
+  sources.forEach(function(src) {
     if (!fs.existsSync(src)) {
-      common.error('no such file or directory: ' + src, { continue: true });
+      common.error('no such file or directory: '+src, true);
       return; // skip file
     }
 
@@ -66,34 +61,20 @@ function _mv(options, sources, dest) {
     // When copying to '/path/dir':
     //    thisDest = '/path/dir/file1'
     var thisDest = dest;
-    if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) {
+    if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
       thisDest = path.normalize(dest + '/' + path.basename(src));
-    }
 
-    if (fs.existsSync(thisDest) && options.no_force) {
-      common.error('dest file already exists: ' + thisDest, { continue: true });
+    if (fs.existsSync(thisDest) && !options.force) {
+      common.error('dest file already exists: ' + thisDest, true);
       return; // skip file
     }
 
     if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
-      common.error('cannot move to self: ' + src, { continue: true });
+      common.error('cannot move to self: '+src, true);
       return; // skip file
     }
 
-    try {
-      fs.renameSync(src, thisDest);
-    } catch (e) {
-      /* istanbul ignore next */
-      if (e.code === 'EXDEV') {
-        // If we're trying to `mv` to an external partition, we'll actually need
-        // to perform a copy and then clean up the original file. If either the
-        // copy or the rm fails with an exception, we should allow this
-        // exception to pass up to the top level.
-        cp('-r', src, thisDest);
-        rm('-rf', src);
-      }
-    }
+    fs.renameSync(src, thisDest);
   }); // forEach(src)
-  return '';
 } // mv
 module.exports = _mv;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/popd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/popd.js b/node_modules/shelljs/src/popd.js
index d9eac3f..11ea24f 100644
--- a/node_modules/shelljs/src/popd.js
+++ b/node_modules/shelljs/src/popd.js
@@ -1 +1 @@
-// see dirs.js
+// see dirs.js
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/pushd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/pushd.js b/node_modules/shelljs/src/pushd.js
index d9eac3f..11ea24f 100644
--- a/node_modules/shelljs/src/pushd.js
+++ b/node_modules/shelljs/src/pushd.js
@@ -1 +1 @@
-// see dirs.js
+// see dirs.js
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/pwd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/pwd.js b/node_modules/shelljs/src/pwd.js
index 3861851..41727bb 100644
--- a/node_modules/shelljs/src/pwd.js
+++ b/node_modules/shelljs/src/pwd.js
@@ -1,15 +1,11 @@
 var path = require('path');
 var common = require('./common');
 
-common.register('pwd', _pwd, {
-  allowGlobbing: false,
-});
-
 //@
 //@ ### pwd()
 //@ Returns the current directory.
-function _pwd() {
+function _pwd(options) {
   var pwd = path.resolve(process.cwd());
-  return pwd;
+  return common.ShellString(pwd);
 }
 module.exports = _pwd;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/rm.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/rm.js b/node_modules/shelljs/src/rm.js
index 5953681..bd608cb 100644
--- a/node_modules/shelljs/src/rm.js
+++ b/node_modules/shelljs/src/rm.js
@@ -1,14 +1,6 @@
 var common = require('./common');
 var fs = require('fs');
 
-common.register('rm', _rm, {
-  cmdOptions: {
-    'f': 'force',
-    'r': 'recursive',
-    'R': 'recursive',
-  },
-});
-
 // Recursively removes 'dir'
 // Adapted from https://github.com/ryanmcgrath/wrench-js
 //
@@ -23,24 +15,32 @@ function rmdirSyncRecursive(dir, force) {
   files = fs.readdirSync(dir);
 
   // Loop through and delete everything in the sub-tree after checking it
-  for (var i = 0; i < files.length; i++) {
-    var file = dir + '/' + files[i];
-    var currFile = fs.lstatSync(file);
+  for(var i = 0; i < files.length; i++) {
+    var file = dir + "/" + files[i],
+        currFile = fs.lstatSync(file);
 
-    if (currFile.isDirectory()) { // Recursive function back to the beginning
+    if(currFile.isDirectory()) { // Recursive function back to the beginning
       rmdirSyncRecursive(file, force);
-    } else { // Assume it's a file - perhaps a try/catch belongs here?
+    }
+
+    else if(currFile.isSymbolicLink()) { // Unlink symlinks
       if (force || isWriteable(file)) {
         try {
           common.unlinkSync(file);
         } catch (e) {
-          /* istanbul ignore next */
-          common.error('could not remove file (code ' + e.code + '): ' + file, {
-            continue: true,
-          });
+          common.error('could not remove file (code '+e.code+'): ' + file, true);
         }
       }
     }
+
+    else // Assume it's a file - perhaps a try/catch belongs here?
+      if (force || isWriteable(file)) {
+        try {
+          common.unlinkSync(file);
+        } catch (e) {
+          common.error('could not remove file (code '+e.code+'): ' + file, true);
+        }
+      }
   }
 
   // Now that we know everything in the sub-tree has been deleted, we can delete the main directory.
@@ -50,19 +50,16 @@ function rmdirSyncRecursive(dir, force) {
   try {
     // Retry on windows, sometimes it takes a little time before all the files in the directory are gone
     var start = Date.now();
-
-    // TODO: replace this with a finite loop
-    for (;;) {
+    while (true) {
       try {
         result = fs.rmdirSync(dir);
-        if (fs.existsSync(dir)) throw { code: 'EAGAIN' };
+        if (fs.existsSync(dir)) throw { code: "EAGAIN" }
         break;
-      } catch (er) {
-        /* istanbul ignore next */
+      } catch(er) {
         // In addition to error codes, also check if the directory still exists and loop again if true
-        if (process.platform === 'win32' && (er.code === 'ENOTEMPTY' || er.code === 'EBUSY' || er.code === 'EPERM' || er.code === 'EAGAIN')) {
+        if (process.platform === "win32" && (er.code === "ENOTEMPTY" || er.code === "EBUSY" || er.code === "EPERM" || er.code === "EAGAIN")) {
           if (Date.now() - start > 1000) throw er;
-        } else if (er.code === 'ENOENT') {
+        } else if (er.code === "ENOENT") {
           // Directory did not exist, deletion was successful
           break;
         } else {
@@ -70,8 +67,8 @@ function rmdirSyncRecursive(dir, force) {
         }
       }
     }
-  } catch (e) {
-    common.error('could not remove directory (code ' + e.code + '): ' + dir, { continue: true });
+  } catch(e) {
+    common.error('could not remove directory (code '+e.code+'): ' + dir, true);
   }
 
   return result;
@@ -84,7 +81,7 @@ function isWriteable(file) {
   try {
     var __fd = fs.openSync(file, 'a');
     fs.closeSync(__fd);
-  } catch (e) {
+  } catch(e) {
     writePermission = false;
   }
 
@@ -92,8 +89,8 @@ function isWriteable(file) {
 }
 
 //@
-//@ ### rm([options,] file [, file ...])
-//@ ### rm([options,] file_array)
+//@ ### rm([options ,] file [, file ...])
+//@ ### rm([options ,] file_array)
 //@ Available options:
 //@
 //@ + `-f`: force
@@ -107,44 +104,60 @@ function isWriteable(file) {
 //@ rm(['some_file.txt', 'another_file.txt']); // same as above
 //@ ```
 //@
-//@ Removes files.
+//@ Removes files. The wildcard `*` is accepted.
 function _rm(options, files) {
-  if (!files) common.error('no paths given');
+  options = common.parseOptions(options, {
+    'f': 'force',
+    'r': 'recursive',
+    'R': 'recursive'
+  });
+  if (!files)
+    common.error('no paths given');
+
+  if (typeof files === 'string')
+    files = [].slice.call(arguments, 1);
+  // if it's array leave it as it is
 
-  // Convert to array
-  files = [].slice.call(arguments, 1);
+  files = common.expand(files);
 
-  files.forEach(function (file) {
-    var stats;
-    try {
-      stats = fs.lstatSync(file); // test for existence
-    } catch (e) {
+  files.forEach(function(file) {
+    if (!fs.existsSync(file)) {
       // Path does not exist, no force flag given
-      if (!options.force) {
-        common.error('no such file or directory: ' + file, { continue: true });
-      }
+      if (!options.force)
+        common.error('no such file or directory: '+file, true);
+
       return; // skip file
     }
 
     // If here, path exists
-    if (stats.isFile()) {
-      if (options.force || isWriteable(file)) {
-        // -f was passed, or file is writable, so it can be removed
+
+    var stats = fs.lstatSync(file);
+    if (stats.isFile() || stats.isSymbolicLink()) {
+
+      // Do not check for file writing permissions
+      if (options.force) {
         common.unlinkSync(file);
-      } else {
-        common.error('permission denied: ' + file, { continue: true });
-      }
-    } else if (stats.isDirectory()) {
-      if (options.recursive) {
-        // -r was passed, so directory can be removed
-        rmdirSyncRecursive(file, options.force);
-      } else {
-        common.error('path is a directory', { continue: true });
+        return;
       }
-    } else if (stats.isSymbolicLink() || stats.isFIFO()) {
-      common.unlinkSync(file);
+
+      if (isWriteable(file))
+        common.unlinkSync(file);
+      else
+        common.error('permission denied: '+file, true);
+
+      return;
+    } // simple file
+
+    // Path is an existing directory, but no -r flag given
+    if (stats.isDirectory() && !options.recursive) {
+      common.error('path is a directory', true);
+      return; // skip path
+    }
+
+    // Recursively remove existing directory
+    if (stats.isDirectory() && options.recursive) {
+      rmdirSyncRecursive(file, options.force);
     }
   }); // forEach(file)
-  return '';
 } // rm
 module.exports = _rm;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/sed.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/sed.js b/node_modules/shelljs/src/sed.js
index dfdc0a7..65f7cb4 100644
--- a/node_modules/shelljs/src/sed.js
+++ b/node_modules/shelljs/src/sed.js
@@ -1,17 +1,8 @@
 var common = require('./common');
 var fs = require('fs');
 
-common.register('sed', _sed, {
-  globStart: 3, // don't glob-expand regexes
-  canReceivePipe: true,
-  cmdOptions: {
-    'i': 'inplace',
-  },
-});
-
 //@
-//@ ### sed([options,] search_regex, replacement, file [, file ...])
-//@ ### sed([options,] search_regex, replacement, file_array)
+//@ ### sed([options ,] search_regex, replacement, file)
 //@ Available options:
 //@
 //@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
@@ -23,64 +14,30 @@ common.register('sed', _sed, {
 //@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
 //@ ```
 //@
-//@ Reads an input string from `files` and performs a JavaScript `replace()` on the input
+//@ Reads an input string from `file` and performs a JavaScript `replace()` on the input
 //@ using the given search regex and replacement string or function. Returns the new string after replacement.
-//@
-//@ Note:
-//@
-//@ Like unix `sed`, ShellJS `sed` supports capture groups. Capture groups are specified
-//@ using the `$n` syntax:
-//@
-//@ ```javascript
-//@ sed(/(\w+)\s(\w+)/, '$2, $1', 'file.txt');
-//@ ```
-function _sed(options, regex, replacement, files) {
-  // Check if this is coming from a pipe
-  var pipe = common.readFromPipe();
-
-  if (typeof replacement !== 'string' && typeof replacement !== 'function') {
-    if (typeof replacement === 'number') {
-      replacement = replacement.toString(); // fallback
-    } else {
-      common.error('invalid replacement string');
-    }
-  }
-
-  // Convert all search strings to RegExp
-  if (typeof regex === 'string') {
-    regex = RegExp(regex);
-  }
-
-  if (!files && !pipe) {
-    common.error('no files given');
-  }
-
-  files = [].slice.call(arguments, 3);
-
-  if (pipe) {
-    files.unshift('-');
-  }
+function _sed(options, regex, replacement, file) {
+  options = common.parseOptions(options, {
+    'i': 'inplace'
+  });
 
-  var sed = [];
-  files.forEach(function (file) {
-    if (!fs.existsSync(file) && file !== '-') {
-      common.error('no such file or directory: ' + file, 2, { continue: true });
-      return;
-    }
+  if (typeof replacement === 'string' || typeof replacement === 'function')
+    replacement = replacement; // no-op
+  else if (typeof replacement === 'number')
+    replacement = replacement.toString(); // fallback
+  else
+    common.error('invalid replacement string');
 
-    var contents = file === '-' ? pipe : fs.readFileSync(file, 'utf8');
-    var lines = contents.split(/\r*\n/);
-    var result = lines.map(function (line) {
-      return line.replace(regex, replacement);
-    }).join('\n');
+  if (!file)
+    common.error('no file given');
 
-    sed.push(result);
+  if (!fs.existsSync(file))
+    common.error('no such file or directory: ' + file);
 
-    if (options.inplace) {
-      fs.writeFileSync(file, result, 'utf8');
-    }
-  });
+  var result = fs.readFileSync(file, 'utf8').replace(regex, replacement);
+  if (options.inplace)
+    fs.writeFileSync(file, result, 'utf8');
 
-  return sed.join('\n');
+  return common.ShellString(result);
 }
 module.exports = _sed;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/set.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/set.js b/node_modules/shelljs/src/set.js
deleted file mode 100644
index 238e23e..0000000
--- a/node_modules/shelljs/src/set.js
+++ /dev/null
@@ -1,55 +0,0 @@
-var common = require('./common');
-
-common.register('set', _set, {
-  allowGlobbing: false,
-  wrapOutput: false,
-});
-
-//@
-//@ ### set(options)
-//@ Available options:
-//@
-//@ + `+/-e`: exit upon error (`config.fatal`)
-//@ + `+/-v`: verbose: show all commands (`config.verbose`)
-//@ + `+/-f`: disable filename expansion (globbing)
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ set('-e'); // exit upon first error
-//@ set('+e'); // this undoes a "set('-e')"
-//@ ```
-//@
-//@ Sets global configuration variables
-function _set(options) {
-  if (!options) {
-    var args = [].slice.call(arguments, 0);
-    if (args.length < 2) common.error('must provide an argument');
-    options = args[1];
-  }
-  var negate = (options[0] === '+');
-  if (negate) {
-    options = '-' + options.slice(1); // parseOptions needs a '-' prefix
-  }
-  options = common.parseOptions(options, {
-    'e': 'fatal',
-    'v': 'verbose',
-    'f': 'noglob',
-  });
-
-  if (negate) {
-    Object.keys(options).forEach(function (key) {
-      options[key] = !options[key];
-    });
-  }
-
-  Object.keys(options).forEach(function (key) {
-    // Only change the global config if `negate` is false and the option is true
-    // or if `negate` is true and the option is false (aka negate !== option)
-    if (negate !== options[key]) {
-      common.config[key] = options[key];
-    }
-  });
-  return;
-}
-module.exports = _set;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/tempdir.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/tempdir.js b/node_modules/shelljs/src/tempdir.js
index a2d15be..45953c2 100644
--- a/node_modules/shelljs/src/tempdir.js
+++ b/node_modules/shelljs/src/tempdir.js
@@ -2,24 +2,20 @@ var common = require('./common');
 var os = require('os');
 var fs = require('fs');
 
-common.register('tempdir', _tempDir, {
-  allowGlobbing: false,
-  wrapOutput: false,
-});
-
 // Returns false if 'dir' is not a writeable directory, 'dir' otherwise
 function writeableDir(dir) {
-  if (!dir || !fs.existsSync(dir)) return false;
+  if (!dir || !fs.existsSync(dir))
+    return false;
 
-  if (!fs.statSync(dir).isDirectory()) return false;
+  if (!fs.statSync(dir).isDirectory())
+    return false;
 
-  var testFile = dir + '/' + common.randomFileName();
+  var testFile = dir+'/'+common.randomFileName();
   try {
     fs.writeFileSync(testFile, ' ');
     common.unlinkSync(testFile);
     return dir;
   } catch (e) {
-    /* istanbul ignore next */
     return false;
   }
 }
@@ -38,14 +34,14 @@ function writeableDir(dir) {
 //@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
 function _tempDir() {
   var state = common.state;
-  if (state.tempDir) return state.tempDir; // from cache
-
-  state.tempDir = writeableDir(os.tmpdir && os.tmpdir()) || // node 0.10+
-                  writeableDir(os.tmpDir && os.tmpDir()) || // node 0.8+
-                  writeableDir(process.env.TMPDIR) ||
-                  writeableDir(process.env.TEMP) ||
-                  writeableDir(process.env.TMP) ||
-                  writeableDir(process.env.Wimp$ScrapDir) || // RiscOS
+  if (state.tempDir)
+    return state.tempDir; // from cache
+
+  state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+
+                  writeableDir(process.env['TMPDIR']) ||
+                  writeableDir(process.env['TEMP']) ||
+                  writeableDir(process.env['TMP']) ||
+                  writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS
                   writeableDir('C:\\TEMP') || // Windows
                   writeableDir('C:\\TMP') || // Windows
                   writeableDir('\\TEMP') || // Windows

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/test.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/test.js b/node_modules/shelljs/src/test.js
index d3d9c07..8a4ac7d 100644
--- a/node_modules/shelljs/src/test.js
+++ b/node_modules/shelljs/src/test.js
@@ -1,22 +1,6 @@
 var common = require('./common');
 var fs = require('fs');
 
-common.register('test', _test, {
-  cmdOptions: {
-    'b': 'block',
-    'c': 'character',
-    'd': 'directory',
-    'e': 'exists',
-    'f': 'file',
-    'L': 'link',
-    'p': 'pipe',
-    'S': 'socket',
-  },
-  wrapOutput: false,
-  allowGlobbing: false,
-});
-
-
 //@
 //@ ### test(expression)
 //@ Available expression primaries:
@@ -26,7 +10,7 @@ common.register('test', _test, {
 //@ + `'-d', 'path'`: true if path is a directory
 //@ + `'-e', 'path'`: true if path exists
 //@ + `'-f', 'path'`: true if path is a regular file
-//@ + `'-L', 'path'`: true if path is a symbolic link
+//@ + `'-L', 'path'`: true if path is a symboilc link
 //@ + `'-p', 'path'`: true if path is a pipe (FIFO)
 //@ + `'-S', 'path'`: true if path is a socket
 //@
@@ -39,46 +23,63 @@ common.register('test', _test, {
 //@
 //@ Evaluates expression using the available primaries and returns corresponding value.
 function _test(options, path) {
-  if (!path) common.error('no path given');
+  if (!path)
+    common.error('no path given');
+
+  // hack - only works with unary primaries
+  options = common.parseOptions(options, {
+    'b': 'block',
+    'c': 'character',
+    'd': 'directory',
+    'e': 'exists',
+    'f': 'file',
+    'L': 'link',
+    'p': 'pipe',
+    'S': 'socket'
+  });
 
   var canInterpret = false;
-  Object.keys(options).forEach(function (key) {
+  for (var key in options)
     if (options[key] === true) {
       canInterpret = true;
+      break;
     }
-  });
 
-  if (!canInterpret) common.error('could not interpret expression');
+  if (!canInterpret)
+    common.error('could not interpret expression');
 
   if (options.link) {
     try {
       return fs.lstatSync(path).isSymbolicLink();
-    } catch (e) {
+    } catch(e) {
       return false;
     }
   }
 
-  if (!fs.existsSync(path)) return false;
+  if (!fs.existsSync(path))
+    return false;
 
-  if (options.exists) return true;
+  if (options.exists)
+    return true;
 
   var stats = fs.statSync(path);
 
-  if (options.block) return stats.isBlockDevice();
-
-  if (options.character) return stats.isCharacterDevice();
+  if (options.block)
+    return stats.isBlockDevice();
 
-  if (options.directory) return stats.isDirectory();
+  if (options.character)
+    return stats.isCharacterDevice();
 
-  if (options.file) return stats.isFile();
+  if (options.directory)
+    return stats.isDirectory();
 
-  /* istanbul ignore next */
-  if (options.pipe) return stats.isFIFO();
+  if (options.file)
+    return stats.isFile();
 
-  /* istanbul ignore next */
-  if (options.socket) return stats.isSocket();
+  if (options.pipe)
+    return stats.isFIFO();
 
-  /* istanbul ignore next */
-  return false; // fallback
+  if (options.socket)
+    return stats.isSocket();
 } // test
 module.exports = _test;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/to.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/to.js b/node_modules/shelljs/src/to.js
index d3d9e37..f029999 100644
--- a/node_modules/shelljs/src/to.js
+++ b/node_modules/shelljs/src/to.js
@@ -2,13 +2,8 @@ var common = require('./common');
 var fs = require('fs');
 var path = require('path');
 
-common.register('to', _to, {
-  pipeOnly: true,
-  wrapOutput: false,
-});
-
 //@
-//@ ### ShellString.prototype.to(file)
+//@ ### 'string'.to(file)
 //@
 //@ Examples:
 //@
@@ -16,22 +11,19 @@ common.register('to', _to, {
 //@ cat('input.txt').to('output.txt');
 //@ ```
 //@
-//@ Analogous to the redirection operator `>` in Unix, but works with
-//@ ShellStrings (such as those returned by `cat`, `grep`, etc). _Like Unix
-//@ redirections, `to()` will overwrite any existing file!_
+//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
+//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
 function _to(options, file) {
-  if (!file) common.error('wrong arguments');
+  if (!file)
+    common.error('wrong arguments');
 
-  if (!fs.existsSync(path.dirname(file))) {
-    common.error('no such file or directory: ' + path.dirname(file));
-  }
+  if (!fs.existsSync( path.dirname(file) ))
+      common.error('no such file or directory: ' + path.dirname(file));
 
   try {
-    fs.writeFileSync(file, this.stdout || this.toString(), 'utf8');
-    return this;
-  } catch (e) {
-    /* istanbul ignore next */
-    common.error('could not write to file (code ' + e.code + '): ' + file, { continue: true });
+    fs.writeFileSync(file, this.toString(), 'utf8');
+  } catch(e) {
+    common.error('could not write to file (code '+e.code+'): '+file, true);
   }
 }
 module.exports = _to;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/toEnd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/toEnd.js b/node_modules/shelljs/src/toEnd.js
index dc165fe..f6d099d 100644
--- a/node_modules/shelljs/src/toEnd.js
+++ b/node_modules/shelljs/src/toEnd.js
@@ -2,13 +2,8 @@ var common = require('./common');
 var fs = require('fs');
 var path = require('path');
 
-common.register('toEnd', _toEnd, {
-  pipeOnly: true,
-  wrapOutput: false,
-});
-
 //@
-//@ ### ShellString.prototype.toEnd(file)
+//@ ### 'string'.toEnd(file)
 //@
 //@ Examples:
 //@
@@ -16,21 +11,19 @@ common.register('toEnd', _toEnd, {
 //@ cat('input.txt').toEnd('output.txt');
 //@ ```
 //@
-//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with
-//@ ShellStrings (such as those returned by `cat`, `grep`, etc).
+//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as
+//@ those returned by `cat`, `grep`, etc).
 function _toEnd(options, file) {
-  if (!file) common.error('wrong arguments');
+  if (!file)
+    common.error('wrong arguments');
 
-  if (!fs.existsSync(path.dirname(file))) {
-    common.error('no such file or directory: ' + path.dirname(file));
-  }
+  if (!fs.existsSync( path.dirname(file) ))
+      common.error('no such file or directory: ' + path.dirname(file));
 
   try {
-    fs.appendFileSync(file, this.stdout || this.toString(), 'utf8');
-    return this;
-  } catch (e) {
-    /* istanbul ignore next */
-    common.error('could not append to file (code ' + e.code + '): ' + file, { continue: true });
+    fs.appendFileSync(file, this.toString(), 'utf8');
+  } catch(e) {
+    common.error('could not append to file (code '+e.code+'): '+file, true);
   }
 }
 module.exports = _toEnd;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/touch.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/touch.js b/node_modules/shelljs/src/touch.js
deleted file mode 100644
index b672b2d..0000000
--- a/node_modules/shelljs/src/touch.js
+++ /dev/null
@@ -1,110 +0,0 @@
-var common = require('./common');
-var fs = require('fs');
-
-common.register('touch', _touch, {
-  cmdOptions: {
-    'a': 'atime_only',
-    'c': 'no_create',
-    'd': 'date',
-    'm': 'mtime_only',
-    'r': 'reference',
-  },
-});
-
-//@
-//@ ### touch([options,] file [, file ...])
-//@ ### touch([options,] file_array)
-//@ Available options:
-//@
-//@ + `-a`: Change only the access time
-//@ + `-c`: Do not create any files
-//@ + `-m`: Change only the modification time
-//@ + `-d DATE`: Parse DATE and use it instead of current time
-//@ + `-r FILE`: Use FILE's times instead of current time
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ touch('source.js');
-//@ touch('-c', '/path/to/some/dir/source.js');
-//@ touch({ '-r': FILE }, '/path/to/some/dir/source.js');
-//@ ```
-//@
-//@ Update the access and modification times of each FILE to the current time.
-//@ A FILE argument that does not exist is created empty, unless -c is supplied.
-//@ This is a partial implementation of *[touch(1)](http://linux.die.net/man/1/touch)*.
-function _touch(opts, files) {
-  if (!files) {
-    common.error('no files given');
-  } else if (typeof files === 'string') {
-    files = [].slice.call(arguments, 1);
-  } else {
-    common.error('file arg should be a string file path or an Array of string file paths');
-  }
-
-  files.forEach(function (f) {
-    touchFile(opts, f);
-  });
-  return '';
-}
-
-function touchFile(opts, file) {
-  var stat = tryStatFile(file);
-
-  if (stat && stat.isDirectory()) {
-    // don't error just exit
-    return;
-  }
-
-  // if the file doesn't already exist and the user has specified --no-create then
-  // this script is finished
-  if (!stat && opts.no_create) {
-    return;
-  }
-
-  // open the file and then close it. this will create it if it doesn't exist but will
-  // not truncate the file
-  fs.closeSync(fs.openSync(file, 'a'));
-
-  //
-  // Set timestamps
-  //
-
-  // setup some defaults
-  var now = new Date();
-  var mtime = opts.date || now;
-  var atime = opts.date || now;
-
-  // use reference file
-  if (opts.reference) {
-    var refStat = tryStatFile(opts.reference);
-    if (!refStat) {
-      common.error('failed to get attributess of ' + opts.reference);
-    }
-    mtime = refStat.mtime;
-    atime = refStat.atime;
-  } else if (opts.date) {
-    mtime = opts.date;
-    atime = opts.date;
-  }
-
-  if (opts.atime_only && opts.mtime_only) {
-    // keep the new values of mtime and atime like GNU
-  } else if (opts.atime_only) {
-    mtime = stat.mtime;
-  } else if (opts.mtime_only) {
-    atime = stat.atime;
-  }
-
-  fs.utimesSync(file, atime, mtime);
-}
-
-module.exports = _touch;
-
-function tryStatFile(filePath) {
-  try {
-    return fs.statSync(filePath);
-  } catch (e) {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/node_modules/shelljs/src/which.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/which.js b/node_modules/shelljs/src/which.js
index 03db57b..2822ecf 100644
--- a/node_modules/shelljs/src/which.js
+++ b/node_modules/shelljs/src/which.js
@@ -2,24 +2,21 @@ var common = require('./common');
 var fs = require('fs');
 var path = require('path');
 
-common.register('which', _which, {
-  allowGlobbing: false,
-  cmdOptions: {
-    'a': 'all',
-  },
-});
-
-// XP's system default value for PATHEXT system variable, just in case it's not
-// set on Windows.
-var XP_DEFAULT_PATHEXT = '.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh';
-
 // Cross-platform method for splitting environment PATH variables
 function splitPath(p) {
-  return p ? p.split(path.delimiter) : [];
+  for (i=1;i<2;i++) {}
+
+  if (!p)
+    return [];
+
+  if (common.platform === 'win')
+    return p.split(';');
+  else
+    return p.split(':');
 }
 
-function checkPath(pathName) {
-  return fs.existsSync(pathName) && !fs.statSync(pathName).isDirectory();
+function checkPath(path) {
+  return fs.existsSync(path) && fs.statSync(path).isDirectory() == false;
 }
 
 //@
@@ -31,68 +28,56 @@ function checkPath(pathName) {
 //@ var nodeExec = which('node');
 //@ ```
 //@
-//@ Searches for `command` in the system's PATH. On Windows, this uses the
-//@ `PATHEXT` variable to append the extension if it's not already executable.
+//@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
 //@ Returns string containing the absolute path to the command.
 function _which(options, cmd) {
-  if (!cmd) common.error('must specify command');
+  if (!cmd)
+    common.error('must specify command');
 
-  var pathEnv = process.env.path || process.env.Path || process.env.PATH;
-  var pathArray = splitPath(pathEnv);
-
-  var queryMatches = [];
+  var pathEnv = process.env.path || process.env.Path || process.env.PATH,
+      pathArray = splitPath(pathEnv),
+      where = null;
 
   // No relative/absolute paths provided?
-  if (cmd.indexOf('/') === -1) {
-    // Assume that there are no extensions to append to queries (this is the
-    // case for unix)
-    var pathExtArray = [''];
-    if (common.platform === 'win') {
-      // In case the PATHEXT variable is somehow not set (e.g.
-      // child_process.spawn with an empty environment), use the XP default.
-      var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT;
-      pathExtArray = splitPath(pathExtEnv.toUpperCase());
-    }
-
+  if (cmd.search(/\//) === -1) {
     // Search for command in PATH
-    for (var k = 0; k < pathArray.length; k++) {
-      // already found it
-      if (queryMatches.length > 0 && !options.all) break;
+    pathArray.forEach(function(dir) {
+      if (where)
+        return; // already found it
 
-      var attempt = path.resolve(pathArray[k], cmd);
-
-      if (common.platform === 'win') {
-        attempt = attempt.toUpperCase();
+      var attempt = path.resolve(dir + '/' + cmd);
+      if (checkPath(attempt)) {
+        where = attempt;
+        return;
       }
 
-      var match = attempt.match(/\.[^<>:"/\|?*.]+$/);
-      if (match && pathExtArray.indexOf(match[0]) >= 0) { // this is Windows-only
-        // The user typed a query with the file extension, like
-        // `which('node.exe')`
+      if (common.platform === 'win') {
+        var baseAttempt = attempt;
+        attempt = baseAttempt + '.exe';
         if (checkPath(attempt)) {
-          queryMatches.push(attempt);
-          break;
+          where = attempt;
+          return;
         }
-      } else { // All-platforms
-        // Cycle through the PATHEXT array, and check each extension
-        // Note: the array is always [''] on Unix
-        for (var i = 0; i < pathExtArray.length; i++) {
-          var ext = pathExtArray[i];
-          var newAttempt = attempt + ext;
-          if (checkPath(newAttempt)) {
-            queryMatches.push(newAttempt);
-            break;
-          }
+        attempt = baseAttempt + '.cmd';
+        if (checkPath(attempt)) {
+          where = attempt;
+          return;
         }
-      }
-    }
-  } else if (checkPath(cmd)) { // a valid absolute or relative path
-    queryMatches.push(path.resolve(cmd));
+        attempt = baseAttempt + '.bat';
+        if (checkPath(attempt)) {
+          where = attempt;
+          return;
+        }
+      } // if 'win'
+    });
   }
 
-  if (queryMatches.length > 0) {
-    return options.all ? queryMatches : queryMatches[0];
-  }
-  return options.all ? [] : null;
+  // Command not found anywhere?
+  if (!checkPath(cmd) && !where)
+    return null;
+
+  where = where || path.resolve(cmd);
+
+  return common.ShellString(where);
 }
 module.exports = _which;

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/de5c08a3/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index a7ce43c..7e805b1 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
   ],
   "scripts": {
     "jshint": "jshint bin && jshint spec",
-    "jasmine": "jasmine --captureExceptions --color",
+    "jasmine": "jasmine",
     "test": "npm run jshint && npm run jasmine"
   },
   "dependencies": {
@@ -26,7 +26,6 @@
     "cordova-common": "^2.0.1",
     "cordova-serve": "^1.0.0",
     "nopt": "^3.0.6",
-    "q": "^1.4.1",
     "shelljs": "^0.5.3"
   },
   "devDependencies": {
@@ -38,7 +37,6 @@
     "adm-zip",
     "cordova-serve",
     "nopt",
-    "q",
     "shelljs"
   ],
   "author": "Apache Software Foundation",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org