Comparing version 1.4.0 to 1.5.0
@@ -75,5 +75,5 @@ 'use strict'; | ||
// Generated by CoffeeScript 1.12.5 | ||
var isObject$1; | ||
var isObject; | ||
var isObject$2 = isObject$1 = function(value) { | ||
var isObject$1 = isObject = function(value) { | ||
return toString(value) === '[object Object]'; | ||
@@ -89,3 +89,3 @@ }; | ||
isStandardArguments = toString(value) === '[object Arguments]'; | ||
isOldArguments = !isArray$1(value) && isArrayLike$1(value) && isObject$2(value) && isFunction$1(value.callee); | ||
isOldArguments = !isArray$1(value) && isArrayLike$1(value) && isObject$1(value) && isFunction$1(value.callee); | ||
return isStandardArguments || isOldArguments; | ||
@@ -322,3 +322,3 @@ }; | ||
isHash = function(value) { | ||
return isObject$2(value) && value.constructor === Object && !value.nodeType && !value.setInterval; | ||
return isObject$1(value) && value.constructor === Object && !value.nodeType && !value.setInterval; | ||
}; | ||
@@ -469,3 +469,3 @@ | ||
} | ||
if (typeof value === 'object' || isObject$2(value) || isFunction$1(value) || isArray$1(value)) { | ||
if (typeof value === 'object' || isObject$1(value) || isFunction$1(value) || isArray$1(value)) { | ||
return false; | ||
@@ -666,3 +666,3 @@ } | ||
}; | ||
var string$2 = function () { | ||
var string$1 = function () { | ||
// Parse a string value. | ||
@@ -766,3 +766,3 @@ var hex, | ||
}; | ||
var object$2 = function () { | ||
var object$1 = function () { | ||
@@ -782,3 +782,3 @@ // Parse an object value. | ||
while (ch) { | ||
key = string$2(); | ||
key = string$1(); | ||
white(); | ||
@@ -810,7 +810,7 @@ next(':'); | ||
case '{': | ||
return object$2(); | ||
return object$1(); | ||
case '[': | ||
return array$1(); | ||
case '"': | ||
return string$2(); | ||
return string$1(); | ||
case '-': | ||
@@ -826,3 +826,3 @@ return number(); | ||
var parse$3 = function (source, reviver) { | ||
var parse$4 = function (source, reviver) { | ||
var result; | ||
@@ -1023,7 +1023,7 @@ | ||
// node_modules/jsonify/index.js | ||
var parse$2 = parse$3; | ||
var parse$3 = parse$4; | ||
var stringify = stringify$1; | ||
var index$1 = { | ||
parse: parse$2, | ||
parse: parse$3, | ||
stringify: stringify | ||
@@ -1131,3 +1131,3 @@ }; | ||
var parse_1 = function (s, env, opts) { | ||
var mapped = parse$1(s, env, opts); | ||
var mapped = parse$2(s, env, opts); | ||
if (typeof env !== 'function') return mapped; | ||
@@ -1147,3 +1147,3 @@ return index$7(mapped, function (acc, s) { | ||
function parse$1 (s, env, opts) { | ||
function parse$2 (s, env, opts) { | ||
var chunker = new RegExp([ | ||
@@ -1302,7 +1302,57 @@ '(' + CONTROL + ')', // control chars | ||
// src/spawn/shell-builtins.coffee | ||
var shellBuiltins; | ||
var builtins = shellBuiltins = { | ||
':': true, | ||
'.': true, | ||
"break": true, | ||
cd: true, | ||
"continue": true, | ||
"eval": true, | ||
exec: true, | ||
exit: true, | ||
"export": true, | ||
getopts: true, | ||
hash: true, | ||
pwd: true, | ||
readonly: true, | ||
"return": true, | ||
shift: true, | ||
test: true, | ||
times: true, | ||
trap: true, | ||
umask: true, | ||
unset: true, | ||
alias: true, | ||
bind: true, | ||
builtin: true, | ||
caller: true, | ||
command: true, | ||
declare: true, | ||
echo: true, | ||
enable: true, | ||
help: true, | ||
"let": true, | ||
local: true, | ||
logout: true, | ||
mapfile: true, | ||
printf: true, | ||
read: true, | ||
readarray: true, | ||
source: true, | ||
type: true, | ||
typeset: true, | ||
ulimit: true, | ||
unalias: true | ||
}; | ||
// src/spawn/parse.coffee | ||
var isWin; | ||
var object$1; | ||
var parse$$1; | ||
var parseEnv; | ||
var parseObject; | ||
var parseString; | ||
var shellRequired; | ||
var string$1; | ||
var unShellQuote; | ||
var winHacks; | ||
@@ -1312,29 +1362,24 @@ | ||
winHacks = function(cmd, args) { | ||
var cmdfile; | ||
cmd = path.normalize(cmd); | ||
cmdfile = cmd + '.cmd'; | ||
if (fs.existsSync(cmdfile)) { | ||
cmd = cmdfile; | ||
} | ||
args = ['/c', cmd].concat(args); | ||
cmd = 'cmd.exe'; | ||
return [cmd, args]; | ||
}; | ||
shellRequired = function(args) { | ||
var arg, i, len; | ||
unShellQuote = function(args) { | ||
var a, args_, i, len; | ||
args_ = []; | ||
for (i = 0, len = args.length; i < len; i++) { | ||
arg = args[i]; | ||
if (!isString$1(arg)) { | ||
return true; | ||
a = args[i]; | ||
if (isString$1(a)) { | ||
args_.push(a); | ||
} else { | ||
if (a.op === 'glob') { | ||
args_.push(a.pattern); | ||
} else { | ||
args_.push(a.op); | ||
} | ||
} | ||
} | ||
return false; | ||
return args_; | ||
}; | ||
string$1 = function(s, opts) { | ||
var args, cmd, env, k, ref, ref1, v; | ||
args = index.parse(s); | ||
parseEnv = function(s) { | ||
var args, cmd, env, k, ref, v; | ||
env = {}; | ||
args = s.split(' '); | ||
while (cmd = args.shift()) { | ||
@@ -1347,31 +1392,65 @@ if ((cmd.indexOf('=')) === -1) { | ||
} | ||
if (!isWin) { | ||
if ((opts.shell != null) || shellRequired(args)) { | ||
cmd = (ref1 = opts.shell) != null ? ref1 : '/bin/sh'; | ||
args = ['-c', s]; | ||
} | ||
} | ||
return env; | ||
}; | ||
parseString = function(s, opts) { | ||
var args, cmd, env; | ||
env = Object.assign({}, process.env, opts.env, parseEnv(s)); | ||
args = index.parse(s, env); | ||
cmd = args.shift(); | ||
return [cmd, args, env]; | ||
}; | ||
object$1 = function(obj, opts) { | ||
var args, cmd, ref; | ||
parseObject = function(obj, opts) { | ||
var args, cmd, env, ref; | ||
cmd = obj.cmd; | ||
args = (ref = obj.args) != null ? ref : []; | ||
return [cmd, args, obj.env]; | ||
env = Object.assign({}, process.env, opts.env, obj.env); | ||
return [cmd, args, env]; | ||
}; | ||
var parse$$1 = function(cmd, opts) { | ||
var args, env, ref, ref1, ref2; | ||
shellRequired = function(cmd, args) { | ||
var arg, i, len; | ||
if (builtins[cmd]) { | ||
return true; | ||
} | ||
for (i = 0, len = args.length; i < len; i++) { | ||
arg = args[i]; | ||
if (!isString$1(arg)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
winHacks = function(cmd, args) { | ||
var cmdfile; | ||
cmd = path.normalize(cmd); | ||
cmdfile = cmd + '.cmd'; | ||
if (fs.existsSync(cmdfile)) { | ||
cmd = cmdfile; | ||
} | ||
args = ['/c', cmd].concat(args); | ||
cmd = 'cmd.exe'; | ||
return [cmd, args]; | ||
}; | ||
var parse$1 = parse$$1 = function(cmdArgs, opts) { | ||
var args, cmd, env, ref, ref1, ref2; | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
if (isString$1(cmd)) { | ||
ref = string$1(cmd, opts), cmd = ref[0], args = ref[1], env = ref[2]; | ||
} else if (isObject(cmd)) { | ||
ref1 = object$1(cmd, opts), cmd = ref1[0], args = ref1[1], env = ref1[2]; | ||
if (isString$1(cmdArgs)) { | ||
ref = parseString(cmdArgs, opts), cmd = ref[0], args = ref[1], env = ref[2]; | ||
} else if (isObject$1(cmdArgs)) { | ||
ref1 = parseObject(cmdArgs, opts), cmd = ref1[0], args = ref1[1], env = ref1[2]; | ||
} else { | ||
throw new Error("Unable to parse cmd = " + cmd); | ||
throw new Error("Unable to parse command '" + cmdArgs + "'"); | ||
} | ||
opts.env = Object.assign({}, process.env, opts.env, env); | ||
if (shellRequired(cmd, args)) { | ||
if (opts.shell == null) { | ||
opts.shell = true; | ||
} | ||
args = unShellQuote(args); | ||
} | ||
if (isWin) { | ||
@@ -1426,3 +1505,3 @@ ref2 = winHacks(cmd, args), cmd = ref2[0], args = ref2[1]; | ||
var args, child, done, exit, ref, ref1, ref2, ref3, stderr, stdout; | ||
ref = parse$$1(cmd, opts), cmd = ref[0], args = ref[1], opts = ref[2]; | ||
ref = parse$1(cmd, opts), cmd = ref[0], args = ref[1], opts = ref[2]; | ||
stderr = new BufferStream$1(); | ||
@@ -1433,6 +1512,8 @@ stdout = new BufferStream$1(); | ||
env: opts.env, | ||
argv0: opts.argv0, | ||
stdio: (ref1 = opts.stdio) != null ? ref1 : [0, 'pipe', 'pipe'], | ||
detached: opts.detached, | ||
uid: opts.uid, | ||
gid: opts.gid | ||
gid: opts.gid, | ||
shell: opts.shell | ||
}); | ||
@@ -1487,3 +1568,3 @@ child.setMaxListeners(0); | ||
var args, error, output, pid, ref, ref1, ref2, ref3, signal, status, stderr, stdout; | ||
ref = parse$$1(cmd, opts), cmd = ref[0], args = ref[1], opts = ref[2]; | ||
ref = parse$1(cmd, opts), cmd = ref[0], args = ref[1], opts = ref[2]; | ||
ref3 = child_process.spawnSync(cmd, args, { | ||
@@ -1771,3 +1852,3 @@ cwd: opts.cwd, | ||
} | ||
if (isObject$2(cmds)) { | ||
if (isObject$1(cmds)) { | ||
return object(exec, cmds, opts, cb); | ||
@@ -1774,0 +1855,0 @@ } |
{ | ||
"name": "executive", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Elegant command execution with built-in control flow", | ||
@@ -44,4 +44,4 @@ "main": "lib/executive.js", | ||
"es-is": "3.3.10", | ||
"sake-bundle": "0.4.16", | ||
"sake-cli": "0.4.7", | ||
"sake-bundle": "0.4.17", | ||
"sake-cli": "0.4.11", | ||
"sake-outdated": "0.1.21", | ||
@@ -48,0 +48,0 @@ "sake-publish": "0.1.12", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
315359
18
3414
6