From 0a0002b480dc40ecd94c542d1101e87404a47692 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 24 Jul 2012 12:34:13 -0700 Subject: npm: Upgrade to 1.1.45 This includes node-gyp 0.6.1 --- deps/npm/node_modules/node-gyp/lib/node-gyp.js | 28 ++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'deps/npm/node_modules/node-gyp/lib/node-gyp.js') diff --git a/deps/npm/node_modules/node-gyp/lib/node-gyp.js b/deps/npm/node_modules/node-gyp/lib/node-gyp.js index 9b2282520..6681daafe 100644 --- a/deps/npm/node_modules/node-gyp/lib/node-gyp.js +++ b/deps/npm/node_modules/node-gyp/lib/node-gyp.js @@ -112,15 +112,31 @@ proto.parseArgv = function parseOpts (argv) { this.opts = nopt(this.configDefs, this.shorthands, argv) this.argv = this.opts.argv.remain.slice() - var commands = [] - this.argv.slice().forEach(function (arg) { - if (arg in this.commands || arg in this.aliases) { - this.argv.splice(this.argv.indexOf(arg), 1) - commands.push(arg) + var commands = this.todo = [] + + // create a copy of the argv array with aliases mapped + var argv = this.argv.map(function (arg) { + // is this an alias? + if (arg in this.aliases) { + arg = this.aliases[arg] } + return arg }, this) - this.todo = commands + // process the mapped args into "command" objects ("name" and "args" props) + argv.slice().forEach(function (arg) { + if (arg in this.commands) { + var args = argv.splice(0, argv.indexOf(arg)) + argv.shift() + if (commands.length > 0) { + commands[commands.length - 1].args = args + } + commands.push({ name: arg, args: [] }) + } + }, this) + if (commands.length > 0) { + commands[commands.length - 1].args = argv.splice(0) + } // support for inheriting config env variables from npm var npm_config_prefix = 'npm_config_' -- cgit v1.2.1