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 2014/09/19 00:49:57 UTC
[22/27] git commit: add required node_modules
add required node_modules
Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/dc1d926a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/dc1d926a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/dc1d926a
Branch: refs/heads/master
Commit: dc1d926ad70ab80d13fa1aa2c4b4547c363b9b2e
Parents: c74fdaf
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Sat Sep 6 01:59:42 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Sat Sep 6 01:59:42 2014 -0700
----------------------------------------------------------------------
node_modules/.bin/nopt | 15 +
node_modules/.bin/nopt.cmd | 5 +
node_modules/.bin/shjs | 15 +
node_modules/.bin/shjs.cmd | 5 +
node_modules/nopt/.npmignore | 1 +
node_modules/nopt/LICENSE | 23 +
node_modules/nopt/README.md | 209 ++
node_modules/nopt/bin/nopt.js | 54 +
node_modules/nopt/examples/my-program.js | 30 +
node_modules/nopt/lib/nopt.js | 414 ++++
.../nopt/node_modules/abbrev/CONTRIBUTING.md | 3 +
node_modules/nopt/node_modules/abbrev/LICENSE | 23 +
node_modules/nopt/node_modules/abbrev/README.md | 23 +
node_modules/nopt/node_modules/abbrev/abbrev.js | 62 +
.../nopt/node_modules/abbrev/package.json | 46 +
node_modules/nopt/node_modules/abbrev/test.js | 47 +
node_modules/nopt/package.json | 57 +
node_modules/nopt/test/basic.js | 251 +++
node_modules/q/CONTRIBUTING.md | 40 +
node_modules/q/LICENSE | 18 +
node_modules/q/README.md | 820 ++++++++
.../q/benchmark/compare-with-callbacks.js | 71 +
node_modules/q/benchmark/scenarios.js | 36 +
node_modules/q/package.json | 113 ++
node_modules/q/q.js | 1904 ++++++++++++++++++
node_modules/q/queue.js | 35 +
node_modules/shelljs/.documentup.json | 6 +
node_modules/shelljs/.jshintrc | 7 +
node_modules/shelljs/.npmignore | 2 +
node_modules/shelljs/.travis.yml | 5 +
node_modules/shelljs/LICENSE | 26 +
node_modules/shelljs/README.md | 569 ++++++
node_modules/shelljs/bin/shjs | 51 +
node_modules/shelljs/global.js | 3 +
node_modules/shelljs/make.js | 47 +
node_modules/shelljs/package.json | 62 +
node_modules/shelljs/scripts/generate-docs.js | 21 +
node_modules/shelljs/scripts/run-tests.js | 50 +
node_modules/shelljs/shell.js | 157 ++
node_modules/shelljs/src/cat.js | 43 +
node_modules/shelljs/src/cd.js | 19 +
node_modules/shelljs/src/chmod.js | 208 ++
node_modules/shelljs/src/common.js | 203 ++
node_modules/shelljs/src/cp.js | 201 ++
node_modules/shelljs/src/dirs.js | 191 ++
node_modules/shelljs/src/echo.js | 20 +
node_modules/shelljs/src/error.js | 10 +
node_modules/shelljs/src/exec.js | 181 ++
node_modules/shelljs/src/find.js | 51 +
node_modules/shelljs/src/grep.js | 52 +
node_modules/shelljs/src/ln.js | 53 +
node_modules/shelljs/src/ls.js | 126 ++
node_modules/shelljs/src/mkdir.js | 68 +
node_modules/shelljs/src/mv.js | 80 +
node_modules/shelljs/src/popd.js | 1 +
node_modules/shelljs/src/pushd.js | 1 +
node_modules/shelljs/src/pwd.js | 11 +
node_modules/shelljs/src/rm.js | 145 ++
node_modules/shelljs/src/sed.js | 43 +
node_modules/shelljs/src/tempdir.js | 56 +
node_modules/shelljs/src/test.js | 85 +
node_modules/shelljs/src/to.js | 29 +
node_modules/shelljs/src/toEnd.js | 29 +
node_modules/shelljs/src/which.js | 83 +
64 files changed, 7315 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/.bin/nopt
----------------------------------------------------------------------
diff --git a/node_modules/.bin/nopt b/node_modules/.bin/nopt
new file mode 100644
index 0000000..25995f3
--- /dev/null
+++ b/node_modules/.bin/nopt
@@ -0,0 +1,15 @@
+#!/bin/sh
+basedir=`dirname "$0"`
+
+case `uname` in
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
+ ret=$?
+else
+ node "$basedir/../nopt/bin/nopt.js" "$@"
+ ret=$?
+fi
+exit $ret
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/.bin/nopt.cmd
----------------------------------------------------------------------
diff --git a/node_modules/.bin/nopt.cmd b/node_modules/.bin/nopt.cmd
new file mode 100644
index 0000000..c8e8216
--- /dev/null
+++ b/node_modules/.bin/nopt.cmd
@@ -0,0 +1,5 @@
+@IF EXIST "%~dp0\node.exe" (
+ "%~dp0\node.exe" "%~dp0\..\nopt\bin\nopt.js" %*
+) ELSE (
+ node "%~dp0\..\nopt\bin\nopt.js" %*
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/.bin/shjs
----------------------------------------------------------------------
diff --git a/node_modules/.bin/shjs b/node_modules/.bin/shjs
new file mode 100644
index 0000000..9908675
--- /dev/null
+++ b/node_modules/.bin/shjs
@@ -0,0 +1,15 @@
+#!/bin/sh
+basedir=`dirname "$0"`
+
+case `uname` in
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ "$basedir/node" "$basedir/../shelljs/bin/shjs" "$@"
+ ret=$?
+else
+ node "$basedir/../shelljs/bin/shjs" "$@"
+ ret=$?
+fi
+exit $ret
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/.bin/shjs.cmd
----------------------------------------------------------------------
diff --git a/node_modules/.bin/shjs.cmd b/node_modules/.bin/shjs.cmd
new file mode 100644
index 0000000..9ce460a
--- /dev/null
+++ b/node_modules/.bin/shjs.cmd
@@ -0,0 +1,5 @@
+@IF EXIST "%~dp0\node.exe" (
+ "%~dp0\node.exe" "%~dp0\..\shelljs\bin\shjs" %*
+) ELSE (
+ node "%~dp0\..\shelljs\bin\shjs" %*
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/.npmignore
----------------------------------------------------------------------
diff --git a/node_modules/nopt/.npmignore b/node_modules/nopt/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/node_modules/nopt/.npmignore
@@ -0,0 +1 @@
+node_modules
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/nopt/LICENSE b/node_modules/nopt/LICENSE
new file mode 100644
index 0000000..05a4010
--- /dev/null
+++ b/node_modules/nopt/LICENSE
@@ -0,0 +1,23 @@
+Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/README.md
----------------------------------------------------------------------
diff --git a/node_modules/nopt/README.md b/node_modules/nopt/README.md
new file mode 100644
index 0000000..5aba088
--- /dev/null
+++ b/node_modules/nopt/README.md
@@ -0,0 +1,209 @@
+If you want to write an option parser, and have it be good, there are
+two ways to do it. The Right Way, and the Wrong Way.
+
+The Wrong Way is to sit down and write an option parser. We've all done
+that.
+
+The Right Way is to write some complex configurable program with so many
+options that you go half-insane just trying to manage them all, and put
+it off with duct-tape solutions until you see exactly to the core of the
+problem, and finally snap and write an awesome option parser.
+
+If you want to write an option parser, don't write an option parser.
+Write a package manager, or a source control system, or a service
+restarter, or an operating system. You probably won't end up with a
+good one of those, but if you don't give up, and you are relentless and
+diligent enough in your procrastination, you may just end up with a very
+nice option parser.
+
+## USAGE
+
+ // my-program.js
+ var nopt = require("nopt")
+ , Stream = require("stream").Stream
+ , path = require("path")
+ , knownOpts = { "foo" : [String, null]
+ , "bar" : [Stream, Number]
+ , "baz" : path
+ , "bloo" : [ "big", "medium", "small" ]
+ , "flag" : Boolean
+ , "pick" : Boolean
+ , "many" : [String, Array]
+ }
+ , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+ , "b7" : ["--bar", "7"]
+ , "m" : ["--bloo", "medium"]
+ , "p" : ["--pick"]
+ , "f" : ["--flag"]
+ }
+ // everything is optional.
+ // knownOpts and shorthands default to {}
+ // arg list defaults to process.argv
+ // slice defaults to 2
+ , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+ console.log(parsed)
+
+This would give you support for any of the following:
+
+```bash
+$ node my-program.js --foo "blerp" --no-flag
+{ "foo" : "blerp", "flag" : false }
+
+$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
+{ bar: 7, foo: "Mr. Hand", flag: true }
+
+$ node my-program.js --foo "blerp" -f -----p
+{ foo: "blerp", flag: true, pick: true }
+
+$ node my-program.js -fp --foofoo
+{ foo: "Mr. Foo", flag: true, pick: true }
+
+$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.
+{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
+
+$ node my-program.js --blatzk -fp # unknown opts are ok.
+{ blatzk: true, flag: true, pick: true }
+
+$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value
+{ blatzk: 1000, flag: true, pick: true }
+
+$ node my-program.js --no-blatzk -fp # unless they start with "no-"
+{ blatzk: false, flag: true, pick: true }
+
+$ node my-program.js --baz b/a/z # known paths are resolved.
+{ baz: "/Users/isaacs/b/a/z" }
+
+# if Array is one of the types, then it can take many
+# values, and will always be an array. The other types provided
+# specify what types are allowed in the list.
+
+$ node my-program.js --many 1 --many null --many foo
+{ many: ["1", "null", "foo"] }
+
+$ node my-program.js --many foo
+{ many: ["foo"] }
+```
+
+Read the tests at the bottom of `lib/nopt.js` for more examples of
+what this puppy can do.
+
+## Types
+
+The following types are supported, and defined on `nopt.typeDefs`
+
+* String: A normal string. No parsing is done.
+* path: A file system path. Gets resolved against cwd if not absolute.
+* url: A url. If it doesn't parse, it isn't accepted.
+* Number: Must be numeric.
+* Date: Must parse as a date. If it does, and `Date` is one of the options,
+ then it will return a Date object, not a string.
+* Boolean: Must be either `true` or `false`. If an option is a boolean,
+ then it does not need a value, and its presence will imply `true` as
+ the value. To negate boolean flags, do `--no-whatever` or `--whatever
+ false`
+* NaN: Means that the option is strictly not allowed. Any value will
+ fail.
+* Stream: An object matching the "Stream" class in node. Valuable
+ for use when validating programmatically. (npm uses this to let you
+ supply any WriteStream on the `outfd` and `logfd` config options.)
+* Array: If `Array` is specified as one of the types, then the value
+ will be parsed as a list of options. This means that multiple values
+ can be specified, and that the value will always be an array.
+
+If a type is an array of values not on this list, then those are
+considered valid values. For instance, in the example above, the
+`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
+and any other value will be rejected.
+
+When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
+interpreted as their JavaScript equivalents.
+
+You can also mix types and values, or multiple types, in a list. For
+instance `{ blah: [Number, null] }` would allow a value to be set to
+either a Number or null. When types are ordered, this implies a
+preference, and the first type that can be used to properly interpret
+the value will be used.
+
+To define a new type, add it to `nopt.typeDefs`. Each item in that
+hash is an object with a `type` member and a `validate` method. The
+`type` member is an object that matches what goes in the type list. The
+`validate` method is a function that gets called with `validate(data,
+key, val)`. Validate methods should assign `data[key]` to the valid
+value of `val` if it can be handled properly, or return boolean
+`false` if it cannot.
+
+You can also call `nopt.clean(data, types, typeDefs)` to clean up a
+config object and remove its invalid properties.
+
+## Error Handling
+
+By default, nopt outputs a warning to standard error when invalid
+options are found. You can change this behavior by assigning a method
+to `nopt.invalidHandler`. This method will be called with
+the offending `nopt.invalidHandler(key, val, types)`.
+
+If no `nopt.invalidHandler` is assigned, then it will console.error
+its whining. If it is assigned to boolean `false` then the warning is
+suppressed.
+
+## Abbreviations
+
+Yes, they are supported. If you define options like this:
+
+```javascript
+{ "foolhardyelephants" : Boolean
+, "pileofmonkeys" : Boolean }
+```
+
+Then this will work:
+
+```bash
+node program.js --foolhar --pil
+node program.js --no-f --pileofmon
+# etc.
+```
+
+## Shorthands
+
+Shorthands are a hash of shorter option names to a snippet of args that
+they expand to.
+
+If multiple one-character shorthands are all combined, and the
+combination does not unambiguously match any other option or shorthand,
+then they will be broken up into their constituent parts. For example:
+
+```json
+{ "s" : ["--loglevel", "silent"]
+, "g" : "--global"
+, "f" : "--force"
+, "p" : "--parseable"
+, "l" : "--long"
+}
+```
+
+```bash
+npm ls -sgflp
+# just like doing this:
+npm ls --loglevel silent --global --force --long --parseable
+```
+
+## The Rest of the args
+
+The config object returned by nopt is given a special member called
+`argv`, which is an object with the following fields:
+
+* `remain`: The remaining args after all the parsing has occurred.
+* `original`: The args as they originally appeared.
+* `cooked`: The args after flags and shorthands are expanded.
+
+## Slicing
+
+Node programs are called with more or less the exact argv as it appears
+in C land, after the v8 and node-specific options have been plucked off.
+As such, `argv[0]` is always `node` and `argv[1]` is always the
+JavaScript program being run.
+
+That's usually not very useful to you. So they're sliced off by
+default. If you want them, then you can pass in `0` as the last
+argument, or any other number that you'd like to slice off the start of
+the list.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/bin/nopt.js
----------------------------------------------------------------------
diff --git a/node_modules/nopt/bin/nopt.js b/node_modules/nopt/bin/nopt.js
new file mode 100644
index 0000000..3232d4c
--- /dev/null
+++ b/node_modules/nopt/bin/nopt.js
@@ -0,0 +1,54 @@
+#!/usr/bin/env node
+var nopt = require("../lib/nopt")
+ , path = require("path")
+ , types = { num: Number
+ , bool: Boolean
+ , help: Boolean
+ , list: Array
+ , "num-list": [Number, Array]
+ , "str-list": [String, Array]
+ , "bool-list": [Boolean, Array]
+ , str: String
+ , clear: Boolean
+ , config: Boolean
+ , length: Number
+ , file: path
+ }
+ , shorthands = { s: [ "--str", "astring" ]
+ , b: [ "--bool" ]
+ , nb: [ "--no-bool" ]
+ , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ]
+ , "?": ["--help"]
+ , h: ["--help"]
+ , H: ["--help"]
+ , n: [ "--num", "125" ]
+ , c: ["--config"]
+ , l: ["--length"]
+ , f: ["--file"]
+ }
+ , parsed = nopt( types
+ , shorthands
+ , process.argv
+ , 2 )
+
+console.log("parsed", parsed)
+
+if (parsed.help) {
+ console.log("")
+ console.log("nopt cli tester")
+ console.log("")
+ console.log("types")
+ console.log(Object.keys(types).map(function M (t) {
+ var type = types[t]
+ if (Array.isArray(type)) {
+ return [t, type.map(function (type) { return type.name })]
+ }
+ return [t, type && type.name]
+ }).reduce(function (s, i) {
+ s[i[0]] = i[1]
+ return s
+ }, {}))
+ console.log("")
+ console.log("shorthands")
+ console.log(shorthands)
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/examples/my-program.js
----------------------------------------------------------------------
diff --git a/node_modules/nopt/examples/my-program.js b/node_modules/nopt/examples/my-program.js
new file mode 100644
index 0000000..142447e
--- /dev/null
+++ b/node_modules/nopt/examples/my-program.js
@@ -0,0 +1,30 @@
+#!/usr/bin/env node
+
+//process.env.DEBUG_NOPT = 1
+
+// my-program.js
+var nopt = require("../lib/nopt")
+ , Stream = require("stream").Stream
+ , path = require("path")
+ , knownOpts = { "foo" : [String, null]
+ , "bar" : [Stream, Number]
+ , "baz" : path
+ , "bloo" : [ "big", "medium", "small" ]
+ , "flag" : Boolean
+ , "pick" : Boolean
+ }
+ , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+ , "b7" : ["--bar", "7"]
+ , "m" : ["--bloo", "medium"]
+ , "p" : ["--pick"]
+ , "f" : ["--flag", "true"]
+ , "g" : ["--flag"]
+ , "s" : "--flag"
+ }
+ // everything is optional.
+ // knownOpts and shorthands default to {}
+ // arg list defaults to process.argv
+ // slice defaults to 2
+ , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+
+console.log("parsed =\n"+ require("util").inspect(parsed))
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/lib/nopt.js
----------------------------------------------------------------------
diff --git a/node_modules/nopt/lib/nopt.js b/node_modules/nopt/lib/nopt.js
new file mode 100644
index 0000000..5309a00
--- /dev/null
+++ b/node_modules/nopt/lib/nopt.js
@@ -0,0 +1,414 @@
+// info about each config option.
+
+var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
+ ? function () { console.error.apply(console, arguments) }
+ : function () {}
+
+var url = require("url")
+ , path = require("path")
+ , Stream = require("stream").Stream
+ , abbrev = require("abbrev")
+
+module.exports = exports = nopt
+exports.clean = clean
+
+exports.typeDefs =
+ { String : { type: String, validate: validateString }
+ , Boolean : { type: Boolean, validate: validateBoolean }
+ , url : { type: url, validate: validateUrl }
+ , Number : { type: Number, validate: validateNumber }
+ , path : { type: path, validate: validatePath }
+ , Stream : { type: Stream, validate: validateStream }
+ , Date : { type: Date, validate: validateDate }
+ }
+
+function nopt (types, shorthands, args, slice) {
+ args = args || process.argv
+ types = types || {}
+ shorthands = shorthands || {}
+ if (typeof slice !== "number") slice = 2
+
+ debug(types, shorthands, args, slice)
+
+ args = args.slice(slice)
+ var data = {}
+ , key
+ , remain = []
+ , cooked = args
+ , original = args.slice(0)
+
+ parse(args, data, remain, types, shorthands)
+ // now data is full
+ clean(data, types, exports.typeDefs)
+ data.argv = {remain:remain,cooked:cooked,original:original}
+ Object.defineProperty(data.argv, 'toString', { value: function () {
+ return this.original.map(JSON.stringify).join(" ")
+ }, enumerable: false })
+ return data
+}
+
+function clean (data, types, typeDefs) {
+ typeDefs = typeDefs || exports.typeDefs
+ var remove = {}
+ , typeDefault = [false, true, null, String, Array]
+
+ Object.keys(data).forEach(function (k) {
+ if (k === "argv") return
+ var val = data[k]
+ , isArray = Array.isArray(val)
+ , type = types[k]
+ if (!isArray) val = [val]
+ if (!type) type = typeDefault
+ if (type === Array) type = typeDefault.concat(Array)
+ if (!Array.isArray(type)) type = [type]
+
+ debug("val=%j", val)
+ debug("types=", type)
+ val = val.map(function (val) {
+ // if it's an unknown value, then parse false/true/null/numbers/dates
+ if (typeof val === "string") {
+ debug("string %j", val)
+ val = val.trim()
+ if ((val === "null" && ~type.indexOf(null))
+ || (val === "true" &&
+ (~type.indexOf(true) || ~type.indexOf(Boolean)))
+ || (val === "false" &&
+ (~type.indexOf(false) || ~type.indexOf(Boolean)))) {
+ val = JSON.parse(val)
+ debug("jsonable %j", val)
+ } else if (~type.indexOf(Number) && !isNaN(val)) {
+ debug("convert to number", val)
+ val = +val
+ } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) {
+ debug("convert to date", val)
+ val = new Date(val)
+ }
+ }
+
+ if (!types.hasOwnProperty(k)) {
+ return val
+ }
+
+ // allow `--no-blah` to set 'blah' to null if null is allowed
+ if (val === false && ~type.indexOf(null) &&
+ !(~type.indexOf(false) || ~type.indexOf(Boolean))) {
+ val = null
+ }
+
+ var d = {}
+ d[k] = val
+ debug("prevalidated val", d, val, types[k])
+ if (!validate(d, k, val, types[k], typeDefs)) {
+ if (exports.invalidHandler) {
+ exports.invalidHandler(k, val, types[k], data)
+ } else if (exports.invalidHandler !== false) {
+ debug("invalid: "+k+"="+val, types[k])
+ }
+ return remove
+ }
+ debug("validated val", d, val, types[k])
+ return d[k]
+ }).filter(function (val) { return val !== remove })
+
+ if (!val.length) delete data[k]
+ else if (isArray) {
+ debug(isArray, data[k], val)
+ data[k] = val
+ } else data[k] = val[0]
+
+ debug("k=%s val=%j", k, val, data[k])
+ })
+}
+
+function validateString (data, k, val) {
+ data[k] = String(val)
+}
+
+function validatePath (data, k, val) {
+ if (val === true) return false
+ if (val === null) return true
+
+ val = String(val)
+ var homePattern = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//
+ if (val.match(homePattern) && process.env.HOME) {
+ val = path.resolve(process.env.HOME, val.substr(2))
+ }
+ data[k] = path.resolve(String(val))
+ return true
+}
+
+function validateNumber (data, k, val) {
+ debug("validate Number %j %j %j", k, val, isNaN(val))
+ if (isNaN(val)) return false
+ data[k] = +val
+}
+
+function validateDate (data, k, val) {
+ debug("validate Date %j %j %j", k, val, Date.parse(val))
+ var s = Date.parse(val)
+ if (isNaN(s)) return false
+ data[k] = new Date(val)
+}
+
+function validateBoolean (data, k, val) {
+ if (val instanceof Boolean) val = val.valueOf()
+ else if (typeof val === "string") {
+ if (!isNaN(val)) val = !!(+val)
+ else if (val === "null" || val === "false") val = false
+ else val = true
+ } else val = !!val
+ data[k] = val
+}
+
+function validateUrl (data, k, val) {
+ val = url.parse(String(val))
+ if (!val.host) return false
+ data[k] = val.href
+}
+
+function validateStream (data, k, val) {
+ if (!(val instanceof Stream)) return false
+ data[k] = val
+}
+
+function validate (data, k, val, type, typeDefs) {
+ // arrays are lists of types.
+ if (Array.isArray(type)) {
+ for (var i = 0, l = type.length; i < l; i ++) {
+ if (type[i] === Array) continue
+ if (validate(data, k, val, type[i], typeDefs)) return true
+ }
+ delete data[k]
+ return false
+ }
+
+ // an array of anything?
+ if (type === Array) return true
+
+ // NaN is poisonous. Means that something is not allowed.
+ if (type !== type) {
+ debug("Poison NaN", k, val, type)
+ delete data[k]
+ return false
+ }
+
+ // explicit list of values
+ if (val === type) {
+ debug("Explicitly allowed %j", val)
+ // if (isArray) (data[k] = data[k] || []).push(val)
+ // else data[k] = val
+ data[k] = val
+ return true
+ }
+
+ // now go through the list of typeDefs, validate against each one.
+ var ok = false
+ , types = Object.keys(typeDefs)
+ for (var i = 0, l = types.length; i < l; i ++) {
+ debug("test type %j %j %j", k, val, types[i])
+ var t = typeDefs[types[i]]
+ if (t && type === t.type) {
+ var d = {}
+ ok = false !== t.validate(d, k, val)
+ val = d[k]
+ if (ok) {
+ // if (isArray) (data[k] = data[k] || []).push(val)
+ // else data[k] = val
+ data[k] = val
+ break
+ }
+ }
+ }
+ debug("OK? %j (%j %j %j)", ok, k, val, types[i])
+
+ if (!ok) delete data[k]
+ return ok
+}
+
+function parse (args, data, remain, types, shorthands) {
+ debug("parse", args, data, remain)
+
+ var key = null
+ , abbrevs = abbrev(Object.keys(types))
+ , shortAbbr = abbrev(Object.keys(shorthands))
+
+ for (var i = 0; i < args.length; i ++) {
+ var arg = args[i]
+ debug("arg", arg)
+
+ if (arg.match(/^-{2,}$/)) {
+ // done with keys.
+ // the rest are args.
+ remain.push.apply(remain, args.slice(i + 1))
+ args[i] = "--"
+ break
+ }
+ var hadEq = false
+ if (arg.charAt(0) === "-" && arg.length > 1) {
+ if (arg.indexOf("=") !== -1) {
+ hadEq = true
+ var v = arg.split("=")
+ arg = v.shift()
+ v = v.join("=")
+ args.splice.apply(args, [i, 1].concat([arg, v]))
+ }
+
+ // see if it's a shorthand
+ // if so, splice and back up to re-parse it.
+ var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs)
+ debug("arg=%j shRes=%j", arg, shRes)
+ if (shRes) {
+ debug(arg, shRes)
+ args.splice.apply(args, [i, 1].concat(shRes))
+ if (arg !== shRes[0]) {
+ i --
+ continue
+ }
+ }
+ arg = arg.replace(/^-+/, "")
+ var no = null
+ while (arg.toLowerCase().indexOf("no-") === 0) {
+ no = !no
+ arg = arg.substr(3)
+ }
+
+ if (abbrevs[arg]) arg = abbrevs[arg]
+
+ var isArray = types[arg] === Array ||
+ Array.isArray(types[arg]) && types[arg].indexOf(Array) !== -1
+
+ // allow unknown things to be arrays if specified multiple times.
+ if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) {
+ if (!Array.isArray(data[arg]))
+ data[arg] = [data[arg]]
+ isArray = true
+ }
+
+ var val
+ , la = args[i + 1]
+
+ var isBool = typeof no === 'boolean' ||
+ types[arg] === Boolean ||
+ Array.isArray(types[arg]) && types[arg].indexOf(Boolean) !== -1 ||
+ (typeof types[arg] === 'undefined' && !hadEq) ||
+ (la === "false" &&
+ (types[arg] === null ||
+ Array.isArray(types[arg]) && ~types[arg].indexOf(null)))
+
+ if (isBool) {
+ // just set and move along
+ val = !no
+ // however, also support --bool true or --bool false
+ if (la === "true" || la === "false") {
+ val = JSON.parse(la)
+ la = null
+ if (no) val = !val
+ i ++
+ }
+
+ // also support "foo":[Boolean, "bar"] and "--foo bar"
+ if (Array.isArray(types[arg]) && la) {
+ if (~types[arg].indexOf(la)) {
+ // an explicit type
+ val = la
+ i ++
+ } else if ( la === "null" && ~types[arg].indexOf(null) ) {
+ // null allowed
+ val = null
+ i ++
+ } else if ( !la.match(/^-{2,}[^-]/) &&
+ !isNaN(la) &&
+ ~types[arg].indexOf(Number) ) {
+ // number
+ val = +la
+ i ++
+ } else if ( !la.match(/^-[^-]/) && ~types[arg].indexOf(String) ) {
+ // string
+ val = la
+ i ++
+ }
+ }
+
+ if (isArray) (data[arg] = data[arg] || []).push(val)
+ else data[arg] = val
+
+ continue
+ }
+
+ if (types[arg] === String && la === undefined)
+ la = ""
+
+ if (la && la.match(/^-{2,}$/)) {
+ la = undefined
+ i --
+ }
+
+ val = la === undefined ? true : la
+ if (isArray) (data[arg] = data[arg] || []).push(val)
+ else data[arg] = val
+
+ i ++
+ continue
+ }
+ remain.push(arg)
+ }
+}
+
+function resolveShort (arg, shorthands, shortAbbr, abbrevs) {
+ // handle single-char shorthands glommed together, like
+ // npm ls -glp, but only if there is one dash, and only if
+ // all of the chars are single-char shorthands, and it's
+ // not a match to some other abbrev.
+ arg = arg.replace(/^-+/, '')
+
+ // if it's an exact known option, then don't go any further
+ if (abbrevs[arg] === arg)
+ return null
+
+ // if it's an exact known shortopt, same deal
+ if (shorthands[arg]) {
+ // make it an array, if it's a list of words
+ if (shorthands[arg] && !Array.isArray(shorthands[arg]))
+ shorthands[arg] = shorthands[arg].split(/\s+/)
+
+ return shorthands[arg]
+ }
+
+ // first check to see if this arg is a set of single-char shorthands
+ var singles = shorthands.___singles
+ if (!singles) {
+ singles = Object.keys(shorthands).filter(function (s) {
+ return s.length === 1
+ }).reduce(function (l,r) {
+ l[r] = true
+ return l
+ }, {})
+ shorthands.___singles = singles
+ debug('shorthand singles', singles)
+ }
+
+ var chrs = arg.split("").filter(function (c) {
+ return singles[c]
+ })
+
+ if (chrs.join("") === arg) return chrs.map(function (c) {
+ return shorthands[c]
+ }).reduce(function (l, r) {
+ return l.concat(r)
+ }, [])
+
+
+ // if it's an arg abbrev, and not a literal shorthand, then prefer the arg
+ if (abbrevs[arg] && !shorthands[arg])
+ return null
+
+ // if it's an abbr for a shorthand, then use that
+ if (shortAbbr[arg])
+ arg = shortAbbr[arg]
+
+ // make it an array, if it's a list of words
+ if (shorthands[arg] && !Array.isArray(shorthands[arg]))
+ shorthands[arg] = shorthands[arg].split(/\s+/)
+
+ return shorthands[arg]
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md b/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md
new file mode 100644
index 0000000..2f30261
--- /dev/null
+++ b/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md
@@ -0,0 +1,3 @@
+ To get started, <a
+ href="http://www.clahub.com/agreements/isaacs/abbrev-js">sign the
+ Contributor License Agreement</a>.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/node_modules/abbrev/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/nopt/node_modules/abbrev/LICENSE b/node_modules/nopt/node_modules/abbrev/LICENSE
new file mode 100644
index 0000000..05a4010
--- /dev/null
+++ b/node_modules/nopt/node_modules/abbrev/LICENSE
@@ -0,0 +1,23 @@
+Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/node_modules/abbrev/README.md
----------------------------------------------------------------------
diff --git a/node_modules/nopt/node_modules/abbrev/README.md b/node_modules/nopt/node_modules/abbrev/README.md
new file mode 100644
index 0000000..99746fe
--- /dev/null
+++ b/node_modules/nopt/node_modules/abbrev/README.md
@@ -0,0 +1,23 @@
+# abbrev-js
+
+Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
+
+Usage:
+
+ var abbrev = require("abbrev");
+ abbrev("foo", "fool", "folding", "flop");
+
+ // returns:
+ { fl: 'flop'
+ , flo: 'flop'
+ , flop: 'flop'
+ , fol: 'folding'
+ , fold: 'folding'
+ , foldi: 'folding'
+ , foldin: 'folding'
+ , folding: 'folding'
+ , foo: 'foo'
+ , fool: 'fool'
+ }
+
+This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/node_modules/abbrev/abbrev.js
----------------------------------------------------------------------
diff --git a/node_modules/nopt/node_modules/abbrev/abbrev.js b/node_modules/nopt/node_modules/abbrev/abbrev.js
new file mode 100644
index 0000000..69cfeac
--- /dev/null
+++ b/node_modules/nopt/node_modules/abbrev/abbrev.js
@@ -0,0 +1,62 @@
+
+module.exports = exports = abbrev.abbrev = abbrev
+
+abbrev.monkeyPatch = monkeyPatch
+
+function monkeyPatch () {
+ Object.defineProperty(Array.prototype, 'abbrev', {
+ value: function () { return abbrev(this) },
+ enumerable: false, configurable: true, writable: true
+ })
+
+ Object.defineProperty(Object.prototype, 'abbrev', {
+ value: function () { return abbrev(Object.keys(this)) },
+ enumerable: false, configurable: true, writable: true
+ })
+}
+
+function abbrev (list) {
+ if (arguments.length !== 1 || !Array.isArray(list)) {
+ list = Array.prototype.slice.call(arguments, 0)
+ }
+ for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
+ args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
+ }
+
+ // sort them lexicographically, so that they're next to their nearest kin
+ args = args.sort(lexSort)
+
+ // walk through each, seeing how much it has in common with the next and previous
+ var abbrevs = {}
+ , prev = ""
+ for (var i = 0, l = args.length ; i < l ; i ++) {
+ var current = args[i]
+ , next = args[i + 1] || ""
+ , nextMatches = true
+ , prevMatches = true
+ if (current === next) continue
+ for (var j = 0, cl = current.length ; j < cl ; j ++) {
+ var curChar = current.charAt(j)
+ nextMatches = nextMatches && curChar === next.charAt(j)
+ prevMatches = prevMatches && curChar === prev.charAt(j)
+ if (!nextMatches && !prevMatches) {
+ j ++
+ break
+ }
+ }
+ prev = current
+ if (j === cl) {
+ abbrevs[current] = current
+ continue
+ }
+ for (var a = current.substr(0, j) ; j <= cl ; j ++) {
+ abbrevs[a] = current
+ a += current.charAt(j)
+ }
+ }
+ return abbrevs
+}
+
+function lexSort (a, b) {
+ return a === b ? 0 : a > b ? 1 : -1
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/node_modules/abbrev/package.json
----------------------------------------------------------------------
diff --git a/node_modules/nopt/node_modules/abbrev/package.json b/node_modules/nopt/node_modules/abbrev/package.json
new file mode 100644
index 0000000..1dad5f2
--- /dev/null
+++ b/node_modules/nopt/node_modules/abbrev/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "abbrev",
+ "version": "1.0.5",
+ "description": "Like ruby's abbrev module, but in js",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me"
+ },
+ "main": "abbrev.js",
+ "scripts": {
+ "test": "node test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/isaacs/abbrev-js"
+ },
+ "license": {
+ "type": "MIT",
+ "url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE"
+ },
+ "bugs": {
+ "url": "https://github.com/isaacs/abbrev-js/issues"
+ },
+ "homepage": "https://github.com/isaacs/abbrev-js",
+ "_id": "abbrev@1.0.5",
+ "_shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03",
+ "_from": "abbrev@1",
+ "_npmVersion": "1.4.7",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03",
+ "tarball": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz",
+ "readme": "ERROR: No README data found!"
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/node_modules/abbrev/test.js
----------------------------------------------------------------------
diff --git a/node_modules/nopt/node_modules/abbrev/test.js b/node_modules/nopt/node_modules/abbrev/test.js
new file mode 100644
index 0000000..d5a7303
--- /dev/null
+++ b/node_modules/nopt/node_modules/abbrev/test.js
@@ -0,0 +1,47 @@
+var abbrev = require('./abbrev.js')
+var assert = require("assert")
+var util = require("util")
+
+console.log("TAP Version 13")
+var count = 0
+
+function test (list, expect) {
+ count++
+ var actual = abbrev(list)
+ assert.deepEqual(actual, expect,
+ "abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "\n"+
+ "actual: "+util.inspect(actual))
+ actual = abbrev.apply(exports, list)
+ assert.deepEqual(abbrev.apply(exports, list), expect,
+ "abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "\n"+
+ "actual: "+util.inspect(actual))
+ console.log('ok - ' + list.join(' '))
+}
+
+test([ "ruby", "ruby", "rules", "rules", "rules" ],
+{ rub: 'ruby'
+, ruby: 'ruby'
+, rul: 'rules'
+, rule: 'rules'
+, rules: 'rules'
+})
+test(["fool", "foom", "pool", "pope"],
+{ fool: 'fool'
+, foom: 'foom'
+, poo: 'pool'
+, pool: 'pool'
+, pop: 'pope'
+, pope: 'pope'
+})
+test(["a", "ab", "abc", "abcd", "abcde", "acde"],
+{ a: 'a'
+, ab: 'ab'
+, abc: 'abc'
+, abcd: 'abcd'
+, abcde: 'abcde'
+, ac: 'acde'
+, acd: 'acde'
+, acde: 'acde'
+})
+
+console.log("0..%d", count)
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/package.json
----------------------------------------------------------------------
diff --git a/node_modules/nopt/package.json b/node_modules/nopt/package.json
new file mode 100644
index 0000000..f039825
--- /dev/null
+++ b/node_modules/nopt/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "nopt",
+ "version": "3.0.1",
+ "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "main": "lib/nopt.js",
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/isaacs/nopt"
+ },
+ "bin": {
+ "nopt": "./bin/nopt.js"
+ },
+ "license": {
+ "type": "MIT",
+ "url": "https://github.com/isaacs/nopt/raw/master/LICENSE"
+ },
+ "dependencies": {
+ "abbrev": "1"
+ },
+ "devDependencies": {
+ "tap": "~0.4.8"
+ },
+ "gitHead": "4296f7aba7847c198fea2da594f9e1bec02817ec",
+ "bugs": {
+ "url": "https://github.com/isaacs/nopt/issues"
+ },
+ "homepage": "https://github.com/isaacs/nopt",
+ "_id": "nopt@3.0.1",
+ "_shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd",
+ "_from": "nopt@~3",
+ "_npmVersion": "1.4.18",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd",
+ "tarball": "http://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz",
+ "readme": "ERROR: No README data found!"
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/nopt/test/basic.js
----------------------------------------------------------------------
diff --git a/node_modules/nopt/test/basic.js b/node_modules/nopt/test/basic.js
new file mode 100644
index 0000000..2f9088c
--- /dev/null
+++ b/node_modules/nopt/test/basic.js
@@ -0,0 +1,251 @@
+var nopt = require("../")
+ , test = require('tap').test
+
+
+test("passing a string results in a string", function (t) {
+ var parsed = nopt({ key: String }, {}, ["--key", "myvalue"], 0)
+ t.same(parsed.key, "myvalue")
+ t.end()
+})
+
+// https://github.com/npm/nopt/issues/31
+test("Empty String results in empty string, not true", function (t) {
+ var parsed = nopt({ empty: String }, {}, ["--empty"], 0)
+ t.same(parsed.empty, "")
+ t.end()
+})
+
+test("~ path is resolved to $HOME", function (t) {
+ var path = require("path")
+ if (!process.env.HOME) process.env.HOME = "/tmp"
+ var parsed = nopt({key: path}, {}, ["--key=~/val"], 0)
+ t.same(parsed.key, path.resolve(process.env.HOME, "val"))
+ t.end()
+})
+
+// https://github.com/npm/nopt/issues/24
+test("Unknown options are not parsed as numbers", function (t) {
+ var parsed = nopt({"parse-me": Number}, null, ['--leave-as-is=1.20', '--parse-me=1.20'], 0)
+ t.equal(parsed['leave-as-is'], '1.20')
+ t.equal(parsed['parse-me'], 1.2)
+ t.end()
+});
+
+test("other tests", function (t) {
+
+ var util = require("util")
+ , Stream = require("stream")
+ , path = require("path")
+ , url = require("url")
+
+ , shorthands =
+ { s : ["--loglevel", "silent"]
+ , d : ["--loglevel", "info"]
+ , dd : ["--loglevel", "verbose"]
+ , ddd : ["--loglevel", "silly"]
+ , noreg : ["--no-registry"]
+ , reg : ["--registry"]
+ , "no-reg" : ["--no-registry"]
+ , silent : ["--loglevel", "silent"]
+ , verbose : ["--loglevel", "verbose"]
+ , h : ["--usage"]
+ , H : ["--usage"]
+ , "?" : ["--usage"]
+ , help : ["--usage"]
+ , v : ["--version"]
+ , f : ["--force"]
+ , desc : ["--description"]
+ , "no-desc" : ["--no-description"]
+ , "local" : ["--no-global"]
+ , l : ["--long"]
+ , p : ["--parseable"]
+ , porcelain : ["--parseable"]
+ , g : ["--global"]
+ }
+
+ , types =
+ { aoa: Array
+ , nullstream: [null, Stream]
+ , date: Date
+ , str: String
+ , browser : String
+ , cache : path
+ , color : ["always", Boolean]
+ , depth : Number
+ , description : Boolean
+ , dev : Boolean
+ , editor : path
+ , force : Boolean
+ , global : Boolean
+ , globalconfig : path
+ , group : [String, Number]
+ , gzipbin : String
+ , logfd : [Number, Stream]
+ , loglevel : ["silent","win","error","warn","info","verbose","silly"]
+ , long : Boolean
+ , "node-version" : [false, String]
+ , npaturl : url
+ , npat : Boolean
+ , "onload-script" : [false, String]
+ , outfd : [Number, Stream]
+ , parseable : Boolean
+ , pre: Boolean
+ , prefix: path
+ , proxy : url
+ , "rebuild-bundle" : Boolean
+ , registry : url
+ , searchopts : String
+ , searchexclude: [null, String]
+ , shell : path
+ , t: [Array, String]
+ , tag : String
+ , tar : String
+ , tmp : path
+ , "unsafe-perm" : Boolean
+ , usage : Boolean
+ , user : String
+ , username : String
+ , userconfig : path
+ , version : Boolean
+ , viewer: path
+ , _exit : Boolean
+ , path: path
+ }
+
+ ; [["-v", {version:true}, []]
+ ,["---v", {version:true}, []]
+ ,["ls -s --no-reg connect -d",
+ {loglevel:"info",registry:null},["ls","connect"]]
+ ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]]
+ ,["ls --registry blargle", {}, ["ls"]]
+ ,["--no-registry", {registry:null}, []]
+ ,["--no-color true", {color:false}, []]
+ ,["--no-color false", {color:true}, []]
+ ,["--no-color", {color:false}, []]
+ ,["--color false", {color:false}, []]
+ ,["--color --logfd 7", {logfd:7,color:true}, []]
+ ,["--color=true", {color:true}, []]
+ ,["--logfd=10", {logfd:10}, []]
+ ,["--tmp=/tmp -tar=gtar",{tmp:"/tmp",tar:"gtar"},[]]
+ ,["--tmp=tmp -tar=gtar",
+ {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]]
+ ,["--logfd x", {}, []]
+ ,["a -true -- -no-false", {true:true},["a","-no-false"]]
+ ,["a -no-false", {false:false},["a"]]
+ ,["a -no-no-true", {true:true}, ["a"]]
+ ,["a -no-no-no-false", {false:false}, ["a"]]
+ ,["---NO-no-No-no-no-no-nO-no-no"+
+ "-No-no-no-no-no-no-no-no-no"+
+ "-no-no-no-no-NO-NO-no-no-no-no-no-no"+
+ "-no-body-can-do-the-boogaloo-like-I-do"
+ ,{"body-can-do-the-boogaloo-like-I-do":false}, []]
+ ,["we are -no-strangers-to-love "+
+ "--you-know=the-rules --and=so-do-i "+
+ "---im-thinking-of=a-full-commitment "+
+ "--no-you-would-get-this-from-any-other-guy "+
+ "--no-gonna-give-you-up "+
+ "-no-gonna-let-you-down=true "+
+ "--no-no-gonna-run-around false "+
+ "--desert-you=false "+
+ "--make-you-cry false "+
+ "--no-tell-a-lie "+
+ "--no-no-and-hurt-you false"
+ ,{"strangers-to-love":false
+ ,"you-know":"the-rules"
+ ,"and":"so-do-i"
+ ,"you-would-get-this-from-any-other-guy":false
+ ,"gonna-give-you-up":false
+ ,"gonna-let-you-down":false
+ ,"gonna-run-around":false
+ ,"desert-you":false
+ ,"make-you-cry":false
+ ,"tell-a-lie":false
+ ,"and-hurt-you":false
+ },["we", "are"]]
+ ,["-t one -t two -t three"
+ ,{t: ["one", "two", "three"]}
+ ,[]]
+ ,["-t one -t null -t three four five null"
+ ,{t: ["one", "null", "three"]}
+ ,["four", "five", "null"]]
+ ,["-t foo"
+ ,{t:["foo"]}
+ ,[]]
+ ,["--no-t"
+ ,{t:["false"]}
+ ,[]]
+ ,["-no-no-t"
+ ,{t:["true"]}
+ ,[]]
+ ,["-aoa one -aoa null -aoa 100"
+ ,{aoa:["one", null, '100']}
+ ,[]]
+ ,["-str 100"
+ ,{str:"100"}
+ ,[]]
+ ,["--color always"
+ ,{color:"always"}
+ ,[]]
+ ,["--no-nullstream"
+ ,{nullstream:null}
+ ,[]]
+ ,["--nullstream false"
+ ,{nullstream:null}
+ ,[]]
+ ,["--notadate=2011-01-25"
+ ,{notadate: "2011-01-25"}
+ ,[]]
+ ,["--date 2011-01-25"
+ ,{date: new Date("2011-01-25")}
+ ,[]]
+ ,["-cl 1"
+ ,{config: true, length: 1}
+ ,[]
+ ,{config: Boolean, length: Number, clear: Boolean}
+ ,{c: "--config", l: "--length"}]
+ ,["--acount bla"
+ ,{"acount":true}
+ ,["bla"]
+ ,{account: Boolean, credentials: Boolean, options: String}
+ ,{a:"--account", c:"--credentials",o:"--options"}]
+ ,["--clear"
+ ,{clear:true}
+ ,[]
+ ,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean}
+ ,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}]
+ ,["--file -"
+ ,{"file":"-"}
+ ,[]
+ ,{file:String}
+ ,{}]
+ ,["--file -"
+ ,{"file":true}
+ ,["-"]
+ ,{file:Boolean}
+ ,{}]
+ ,["--path"
+ ,{"path":null}
+ ,[]]
+ ,["--path ."
+ ,{"path":process.cwd()}
+ ,[]]
+ ].forEach(function (test) {
+ var argv = test[0].split(/\s+/)
+ , opts = test[1]
+ , rem = test[2]
+ , actual = nopt(test[3] || types, test[4] || shorthands, argv, 0)
+ , parsed = actual.argv
+ delete actual.argv
+ for (var i in opts) {
+ var e = JSON.stringify(opts[i])
+ , a = JSON.stringify(actual[i] === undefined ? null : actual[i])
+ if (e && typeof e === "object") {
+ t.deepEqual(e, a)
+ } else {
+ t.equal(e, a)
+ }
+ }
+ t.deepEqual(rem, parsed.remain)
+ })
+ t.end()
+})
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/q/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/node_modules/q/CONTRIBUTING.md b/node_modules/q/CONTRIBUTING.md
new file mode 100644
index 0000000..500ab17
--- /dev/null
+++ b/node_modules/q/CONTRIBUTING.md
@@ -0,0 +1,40 @@
+
+For pull requests:
+
+- Be consistent with prevalent style and design decisions.
+- Add a Jasmine spec to `specs/q-spec.js`.
+- Use `npm test` to avoid regressions.
+- Run tests in `q-spec/run.html` in as many supported browsers as you
+ can find the will to deal with.
+- Do not build minified versions; we do this each release.
+- If you would be so kind, add a note to `CHANGES.md` in an
+ appropriate section:
+
+ - `Next Major Version` if it introduces backward incompatibilities
+ to code in the wild using documented features.
+ - `Next Minor Version` if it adds a new feature.
+ - `Next Patch Version` if it fixes a bug.
+
+For releases:
+
+- Run `npm test`.
+- Run tests in `q-spec/run.html` in a representative sample of every
+ browser under the sun.
+- Run `npm run cover` and make sure you're happy with the results.
+- Run `npm run minify` and be sure to commit the resulting `q.min.js`.
+- Note the Gzipped size output by the previous command, and update
+ `README.md` if it has changed to 1 significant digit.
+- Stash any local changes.
+- Update `CHANGES.md` to reflect all changes in the differences
+ between `HEAD` and the previous tagged version. Give credit where
+ credit is due.
+- Update `README.md` to address all new, non-experimental features.
+- Update the API reference on the Wiki to reflect all non-experimental
+ features.
+- Use `npm version major|minor|patch` to update `package.json`,
+ commit, and tag the new version.
+- Use `npm publish` to send up a new release.
+- Send an email to the q-continuum mailing list announcing the new
+ release and the notes from the change log. This helps folks
+ maintaining other package ecosystems.
+
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/q/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/q/LICENSE b/node_modules/q/LICENSE
new file mode 100644
index 0000000..8a706b5
--- /dev/null
+++ b/node_modules/q/LICENSE
@@ -0,0 +1,18 @@
+Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/q/README.md
----------------------------------------------------------------------
diff --git a/node_modules/q/README.md b/node_modules/q/README.md
new file mode 100644
index 0000000..bdd4168
--- /dev/null
+++ b/node_modules/q/README.md
@@ -0,0 +1,820 @@
+[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)
+
+<a href="http://promises-aplus.github.com/promises-spec">
+ <img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png"
+ align="right" alt="Promises/A+ logo" />
+</a>
+
+*This is Q version 1, from the `v1` branch in Git. This documentation applies to
+the latest of both the version 1 and version 0.9 release trains. These releases
+are stable. There will be no further releases of 0.9 after 0.9.7 which is nearly
+equivalent to version 1.0.0. All further releases of `q@~1.0` will be backward
+compatible. The version 2 release train introduces significant but
+backward-incompatible changes and is experimental at this time.*
+
+If a function cannot return a value or throw an exception without
+blocking, it can return a promise instead. A promise is an object
+that represents the return value or the thrown exception that the
+function may eventually provide. A promise can also be used as a
+proxy for a [remote object][Q-Connection] to overcome latency.
+
+[Q-Connection]: https://github.com/kriskowal/q-connection
+
+On the first pass, promises can mitigate the “[Pyramid of
+Doom][POD]”: the situation where code marches to the right faster
+than it marches forward.
+
+[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/
+
+```javascript
+step1(function (value1) {
+ step2(value1, function(value2) {
+ step3(value2, function(value3) {
+ step4(value3, function(value4) {
+ // Do something with value4
+ });
+ });
+ });
+});
+```
+
+With a promise library, you can flatten the pyramid.
+
+```javascript
+Q.fcall(promisedStep1)
+.then(promisedStep2)
+.then(promisedStep3)
+.then(promisedStep4)
+.then(function (value4) {
+ // Do something with value4
+})
+.catch(function (error) {
+ // Handle any error from all above steps
+})
+.done();
+```
+
+With this approach, you also get implicit error propagation, just like `try`,
+`catch`, and `finally`. An error in `promisedStep1` will flow all the way to
+the `catch` function, where it’s caught and handled. (Here `promisedStepN` is
+a version of `stepN` that returns a promise.)
+
+The callback approach is called an “inversion of control”.
+A function that accepts a callback instead of a return value
+is saying, “Don’t call me, I’ll call you.”. Promises
+[un-invert][IOC] the inversion, cleanly separating the input
+arguments from control flow arguments. This simplifies the
+use and creation of API’s, particularly variadic,
+rest and spread arguments.
+
+[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
+
+
+## Getting Started
+
+The Q module can be loaded as:
+
+- A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and
+ gzipped.
+- A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as
+ the [q](https://npmjs.org/package/q) package
+- An AMD module
+- A [component](https://github.com/component/component) as ``microjs/q``
+- Using [bower](http://bower.io/) as ``q``
+- Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)
+
+Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
+
+## Resources
+
+Our [wiki][] contains a number of useful resources, including:
+
+- A method-by-method [Q API reference][reference].
+- A growing [examples gallery][examples], showing how Q can be used to make
+ everything better. From XHR to database access to accessing the Flickr API,
+ Q is there for you.
+- There are many libraries that produce and consume Q promises for everything
+ from file system/database access or RPC to templating. For a list of some of
+ the more popular ones, see [Libraries][].
+- If you want materials that introduce the promise concept generally, and the
+ below tutorial isn't doing it for you, check out our collection of
+ [presentations, blog posts, and podcasts][resources].
+- A guide for those [coming from jQuery's `$.Deferred`][jquery].
+
+We'd also love to have you join the Q-Continuum [mailing list][].
+
+[wiki]: https://github.com/kriskowal/q/wiki
+[reference]: https://github.com/kriskowal/q/wiki/API-Reference
+[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery
+[Libraries]: https://github.com/kriskowal/q/wiki/Libraries
+[resources]: https://github.com/kriskowal/q/wiki/General-Promise-Resources
+[jquery]: https://github.com/kriskowal/q/wiki/Coming-from-jQuery
+[mailing list]: https://groups.google.com/forum/#!forum/q-continuum
+
+
+## Tutorial
+
+Promises have a ``then`` method, which you can use to get the eventual
+return value (fulfillment) or thrown exception (rejection).
+
+```javascript
+promiseMeSomething()
+.then(function (value) {
+}, function (reason) {
+});
+```
+
+If ``promiseMeSomething`` returns a promise that gets fulfilled later
+with a return value, the first function (the fulfillment handler) will be
+called with the value. However, if the ``promiseMeSomething`` function
+gets rejected later by a thrown exception, the second function (the
+rejection handler) will be called with the exception.
+
+Note that resolution of a promise is always asynchronous: that is, the
+fulfillment or rejection handler will always be called in the next turn of the
+event loop (i.e. `process.nextTick` in Node). This gives you a nice
+guarantee when mentally tracing the flow of your code, namely that
+``then`` will always return before either handler is executed.
+
+In this tutorial, we begin with how to consume and work with promises. We'll
+talk about how to create them, and thus create functions like
+`promiseMeSomething` that return promises, [below](#the-beginning).
+
+
+### Propagation
+
+The ``then`` method returns a promise, which in this example, I’m
+assigning to ``outputPromise``.
+
+```javascript
+var outputPromise = getInputPromise()
+.then(function (input) {
+}, function (reason) {
+});
+```
+
+The ``outputPromise`` variable becomes a new promise for the return
+value of either handler. Since a function can only either return a
+value or throw an exception, only one handler will ever be called and it
+will be responsible for resolving ``outputPromise``.
+
+- If you return a value in a handler, ``outputPromise`` will get
+ fulfilled.
+
+- If you throw an exception in a handler, ``outputPromise`` will get
+ rejected.
+
+- If you return a **promise** in a handler, ``outputPromise`` will
+ “become” that promise. Being able to become a new promise is useful
+ for managing delays, combining results, or recovering from errors.
+
+If the ``getInputPromise()`` promise gets rejected and you omit the
+rejection handler, the **error** will go to ``outputPromise``:
+
+```javascript
+var outputPromise = getInputPromise()
+.then(function (value) {
+});
+```
+
+If the input promise gets fulfilled and you omit the fulfillment handler, the
+**value** will go to ``outputPromise``:
+
+```javascript
+var outputPromise = getInputPromise()
+.then(null, function (error) {
+});
+```
+
+Q promises provide a ``fail`` shorthand for ``then`` when you are only
+interested in handling the error:
+
+```javascript
+var outputPromise = getInputPromise()
+.fail(function (error) {
+});
+```
+
+If you are writing JavaScript for modern engines only or using
+CoffeeScript, you may use `catch` instead of `fail`.
+
+Promises also have a ``fin`` function that is like a ``finally`` clause.
+The final handler gets called, with no arguments, when the promise
+returned by ``getInputPromise()`` either returns a value or throws an
+error. The value returned or error thrown by ``getInputPromise()``
+passes directly to ``outputPromise`` unless the final handler fails, and
+may be delayed if the final handler returns a promise.
+
+```javascript
+var outputPromise = getInputPromise()
+.fin(function () {
+ // close files, database connections, stop servers, conclude tests
+});
+```
+
+- If the handler returns a value, the value is ignored
+- If the handler throws an error, the error passes to ``outputPromise``
+- If the handler returns a promise, ``outputPromise`` gets postponed. The
+ eventual value or error has the same effect as an immediate return
+ value or thrown error: a value would be ignored, an error would be
+ forwarded.
+
+If you are writing JavaScript for modern engines only or using
+CoffeeScript, you may use `finally` instead of `fin`.
+
+### Chaining
+
+There are two ways to chain promises. You can chain promises either
+inside or outside handlers. The next two examples are equivalent.
+
+```javascript
+return getUsername()
+.then(function (username) {
+ return getUser(username)
+ .then(function (user) {
+ // if we get here without an error,
+ // the value returned here
+ // or the exception thrown here
+ // resolves the promise returned
+ // by the first line
+ })
+});
+```
+
+```javascript
+return getUsername()
+.then(function (username) {
+ return getUser(username);
+})
+.then(function (user) {
+ // if we get here without an error,
+ // the value returned here
+ // or the exception thrown here
+ // resolves the promise returned
+ // by the first line
+});
+```
+
+The only difference is nesting. It’s useful to nest handlers if you
+need to capture multiple input values in your closure.
+
+```javascript
+function authenticate() {
+ return getUsername()
+ .then(function (username) {
+ return getUser(username);
+ })
+ // chained because we will not need the user name in the next event
+ .then(function (user) {
+ return getPassword()
+ // nested because we need both user and password next
+ .then(function (password) {
+ if (user.passwordHash !== hash(password)) {
+ throw new Error("Can't authenticate");
+ }
+ });
+ });
+}
+```
+
+
+### Combination
+
+You can turn an array of promises into a promise for the whole,
+fulfilled array using ``all``.
+
+```javascript
+return Q.all([
+ eventualAdd(2, 2),
+ eventualAdd(10, 20)
+]);
+```
+
+If you have a promise for an array, you can use ``spread`` as a
+replacement for ``then``. The ``spread`` function “spreads” the
+values over the arguments of the fulfillment handler. The rejection handler
+will get called at the first sign of failure. That is, whichever of
+the recived promises fails first gets handled by the rejection handler.
+
+```javascript
+function eventualAdd(a, b) {
+ return Q.spread([a, b], function (a, b) {
+ return a + b;
+ })
+}
+```
+
+But ``spread`` calls ``all`` initially, so you can skip it in chains.
+
+```javascript
+return getUsername()
+.then(function (username) {
+ return [username, getUser(username)];
+})
+.spread(function (username, user) {
+});
+```
+
+The ``all`` function returns a promise for an array of values. When this
+promise is fulfilled, the array contains the fulfillment values of the original
+promises, in the same order as those promises. If one of the given promises
+is rejected, the returned promise is immediately rejected, not waiting for the
+rest of the batch. If you want to wait for all of the promises to either be
+fulfilled or rejected, you can use ``allSettled``.
+
+```javascript
+Q.allSettled(promises)
+.then(function (results) {
+ results.forEach(function (result) {
+ if (result.state === "fulfilled") {
+ var value = result.value;
+ } else {
+ var reason = result.reason;
+ }
+ });
+});
+```
+
+
+### Sequences
+
+If you have a number of promise-producing functions that need
+to be run sequentially, you can of course do so manually:
+
+```javascript
+return foo(initialVal).then(bar).then(baz).then(qux);
+```
+
+However, if you want to run a dynamically constructed sequence of
+functions, you'll want something like this:
+
+```javascript
+var funcs = [foo, bar, baz, qux];
+
+var result = Q(initialVal);
+funcs.forEach(function (f) {
+ result = result.then(f);
+});
+return result;
+```
+
+You can make this slightly more compact using `reduce`:
+
+```javascript
+return funcs.reduce(function (soFar, f) {
+ return soFar.then(f);
+}, Q(initialVal));
+```
+
+Or, you could use th ultra-compact version:
+
+```javascript
+return funcs.reduce(Q.when, Q());
+```
+
+### Handling Errors
+
+One sometimes-unintuive aspect of promises is that if you throw an
+exception in the fulfillment handler, it will not be be caught by the error
+handler.
+
+```javascript
+return foo()
+.then(function (value) {
+ throw new Error("Can't bar.");
+}, function (error) {
+ // We only get here if "foo" fails
+});
+```
+
+To see why this is, consider the parallel between promises and
+``try``/``catch``. We are ``try``-ing to execute ``foo()``: the error
+handler represents a ``catch`` for ``foo()``, while the fulfillment handler
+represents code that happens *after* the ``try``/``catch`` block.
+That code then needs its own ``try``/``catch`` block.
+
+In terms of promises, this means chaining your rejection handler:
+
+```javascript
+return foo()
+.then(function (value) {
+ throw new Error("Can't bar.");
+})
+.fail(function (error) {
+ // We get here with either foo's error or bar's error
+});
+```
+
+### Progress Notification
+
+It's possible for promises to report their progress, e.g. for tasks that take a
+long time like a file upload. Not all promises will implement progress
+notifications, but for those that do, you can consume the progress values using
+a third parameter to ``then``:
+
+```javascript
+return uploadFile()
+.then(function () {
+ // Success uploading the file
+}, function (err) {
+ // There was an error, and we get the reason for error
+}, function (progress) {
+ // We get notified of the upload's progress as it is executed
+});
+```
+
+Like `fail`, Q also provides a shorthand for progress callbacks
+called `progress`:
+
+```javascript
+return uploadFile().progress(function (progress) {
+ // We get notified of the upload's progress
+});
+```
+
+### The End
+
+When you get to the end of a chain of promises, you should either
+return the last promise or end the chain. Since handlers catch
+errors, it’s an unfortunate pattern that the exceptions can go
+unobserved.
+
+So, either return it,
+
+```javascript
+return foo()
+.then(function () {
+ return "bar";
+});
+```
+
+Or, end it.
+
+```javascript
+foo()
+.then(function () {
+ return "bar";
+})
+.done();
+```
+
+Ending a promise chain makes sure that, if an error doesn’t get
+handled before the end, it will get rethrown and reported.
+
+This is a stopgap. We are exploring ways to make unhandled errors
+visible without any explicit handling.
+
+
+### The Beginning
+
+Everything above assumes you get a promise from somewhere else. This
+is the common case. Every once in a while, you will need to create a
+promise from scratch.
+
+#### Using ``Q.fcall``
+
+You can create a promise from a value using ``Q.fcall``. This returns a
+promise for 10.
+
+```javascript
+return Q.fcall(function () {
+ return 10;
+});
+```
+
+You can also use ``fcall`` to get a promise for an exception.
+
+```javascript
+return Q.fcall(function () {
+ throw new Error("Can't do it");
+});
+```
+
+As the name implies, ``fcall`` can call functions, or even promised
+functions. This uses the ``eventualAdd`` function above to add two
+numbers.
+
+```javascript
+return Q.fcall(eventualAdd, 2, 2);
+```
+
+
+#### Using Deferreds
+
+If you have to interface with asynchronous functions that are callback-based
+instead of promise-based, Q provides a few shortcuts (like ``Q.nfcall`` and
+friends). But much of the time, the solution will be to use *deferreds*.
+
+```javascript
+var deferred = Q.defer();
+FS.readFile("foo.txt", "utf-8", function (error, text) {
+ if (error) {
+ deferred.reject(new Error(error));
+ } else {
+ deferred.resolve(text);
+ }
+});
+return deferred.promise;
+```
+
+Note that a deferred can be resolved with a value or a promise. The
+``reject`` function is a shorthand for resolving with a rejected
+promise.
+
+```javascript
+// this:
+deferred.reject(new Error("Can't do it"));
+
+// is shorthand for:
+var rejection = Q.fcall(function () {
+ throw new Error("Can't do it");
+});
+deferred.resolve(rejection);
+```
+
+This is a simplified implementation of ``Q.delay``.
+
+```javascript
+function delay(ms) {
+ var deferred = Q.defer();
+ setTimeout(deferred.resolve, ms);
+ return deferred.promise;
+}
+```
+
+This is a simplified implementation of ``Q.timeout``
+
+```javascript
+function timeout(promise, ms) {
+ var deferred = Q.defer();
+ Q.when(promise, deferred.resolve);
+ delay(ms).then(function () {
+ deferred.reject(new Error("Timed out"));
+ });
+ return deferred.promise;
+}
+```
+
+Finally, you can send a progress notification to the promise with
+``deferred.notify``.
+
+For illustration, this is a wrapper for XML HTTP requests in the browser. Note
+that a more [thorough][XHR] implementation would be in order in practice.
+
+[XHR]: https://github.com/montagejs/mr/blob/71e8df99bb4f0584985accd6f2801ef3015b9763/browser.js#L29-L73
+
+```javascript
+function requestOkText(url) {
+ var request = new XMLHttpRequest();
+ var deferred = Q.defer();
+
+ request.open("GET", url, true);
+ request.onload = onload;
+ request.onerror = onerror;
+ request.onprogress = onprogress;
+ request.send();
+
+ function onload() {
+ if (request.status === 200) {
+ deferred.resolve(request.responseText);
+ } else {
+ deferred.reject(new Error("Status code was " + request.status));
+ }
+ }
+
+ function onerror() {
+ deferred.reject(new Error("Can't XHR " + JSON.stringify(url)));
+ }
+
+ function onprogress(event) {
+ deferred.notify(event.loaded / event.total);
+ }
+
+ return deferred.promise;
+}
+```
+
+Below is an example of how to use this ``requestOkText`` function:
+
+```javascript
+requestOkText("http://localhost:3000")
+.then(function (responseText) {
+ // If the HTTP response returns 200 OK, log the response text.
+ console.log(responseText);
+}, function (error) {
+ // If there's an error or a non-200 status code, log the error.
+ console.error(error);
+}, function (progress) {
+ // Log the progress as it comes in.
+ console.log("Request progress: " + Math.round(progress * 100) + "%");
+});
+```
+
+### The Middle
+
+If you are using a function that may return a promise, but just might
+return a value if it doesn’t need to defer, you can use the “static”
+methods of the Q library.
+
+The ``when`` function is the static equivalent for ``then``.
+
+```javascript
+return Q.when(valueOrPromise, function (value) {
+}, function (error) {
+});
+```
+
+All of the other methods on a promise have static analogs with the
+same name.
+
+The following are equivalent:
+
+```javascript
+return Q.all([a, b]);
+```
+
+```javascript
+return Q.fcall(function () {
+ return [a, b];
+})
+.all();
+```
+
+When working with promises provided by other libraries, you should
+convert it to a Q promise. Not all promise libraries make the same
+guarantees as Q and certainly don’t provide all of the same methods.
+Most libraries only provide a partially functional ``then`` method.
+This thankfully is all we need to turn them into vibrant Q promises.
+
+```javascript
+return Q($.ajax(...))
+.then(function () {
+});
+```
+
+If there is any chance that the promise you receive is not a Q promise
+as provided by your library, you should wrap it using a Q function.
+You can even use ``Q.invoke`` as a shorthand.
+
+```javascript
+return Q.invoke($, 'ajax', ...)
+.then(function () {
+});
+```
+
+
+### Over the Wire
+
+A promise can serve as a proxy for another object, even a remote
+object. There are methods that allow you to optimistically manipulate
+properties or call functions. All of these interactions return
+promises, so they can be chained.
+
+```
+direct manipulation using a promise as a proxy
+-------------------------- -------------------------------
+value.foo promise.get("foo")
+value.foo = value promise.put("foo", value)
+delete value.foo promise.del("foo")
+value.foo(...args) promise.post("foo", [args])
+value.foo(...args) promise.invoke("foo", ...args)
+value(...args) promise.fapply([args])
+value(...args) promise.fcall(...args)
+```
+
+If the promise is a proxy for a remote object, you can shave
+round-trips by using these functions instead of ``then``. To take
+advantage of promises for remote objects, check out [Q-Connection][].
+
+[Q-Connection]: https://github.com/kriskowal/q-connection
+
+Even in the case of non-remote objects, these methods can be used as
+shorthand for particularly-simple fulfillment handlers. For example, you
+can replace
+
+```javascript
+return Q.fcall(function () {
+ return [{ foo: "bar" }, { foo: "baz" }];
+})
+.then(function (value) {
+ return value[0].foo;
+});
+```
+
+with
+
+```javascript
+return Q.fcall(function () {
+ return [{ foo: "bar" }, { foo: "baz" }];
+})
+.get(0)
+.get("foo");
+```
+
+
+### Adapting Node
+
+If you're working with functions that make use of the Node.js callback pattern,
+where callbacks are in the form of `function(err, result)`, Q provides a few
+useful utility functions for converting between them. The most straightforward
+are probably `Q.nfcall` and `Q.nfapply` ("Node function call/apply") for calling
+Node.js-style functions and getting back a promise:
+
+```javascript
+return Q.nfcall(FS.readFile, "foo.txt", "utf-8");
+return Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]);
+```
+
+If you are working with methods, instead of simple functions, you can easily
+run in to the usual problems where passing a method to another function—like
+`Q.nfcall`—"un-binds" the method from its owner. To avoid this, you can either
+use `Function.prototype.bind` or some nice shortcut methods we provide:
+
+```javascript
+return Q.ninvoke(redisClient, "get", "user:1:id");
+return Q.npost(redisClient, "get", ["user:1:id"]);
+```
+
+You can also create reusable wrappers with `Q.denodeify` or `Q.nbind`:
+
+```javascript
+var readFile = Q.denodeify(FS.readFile);
+return readFile("foo.txt", "utf-8");
+
+var redisClientGet = Q.nbind(redisClient.get, redisClient);
+return redisClientGet("user:1:id");
+```
+
+Finally, if you're working with raw deferred objects, there is a
+`makeNodeResolver` method on deferreds that can be handy:
+
+```javascript
+var deferred = Q.defer();
+FS.readFile("foo.txt", "utf-8", deferred.makeNodeResolver());
+return deferred.promise;
+```
+
+### Long Stack Traces
+
+Q comes with optional support for “long stack traces,” wherein the `stack`
+property of `Error` rejection reasons is rewritten to be traced along
+asynchronous jumps instead of stopping at the most recent one. As an example:
+
+```js
+function theDepthsOfMyProgram() {
+ Q.delay(100).done(function explode() {
+ throw new Error("boo!");
+ });
+}
+
+theDepthsOfMyProgram();
+```
+
+usually would give a rather unhelpful stack trace looking something like
+
+```
+Error: boo!
+ at explode (/path/to/test.js:3:11)
+ at _fulfilled (/path/to/test.js:q:54)
+ at resolvedValue.promiseDispatch.done (/path/to/q.js:823:30)
+ at makePromise.promise.promiseDispatch (/path/to/q.js:496:13)
+ at pending (/path/to/q.js:397:39)
+ at process.startup.processNextTick.process._tickCallback (node.js:244:9)
+```
+
+But, if you turn this feature on by setting
+
+```js
+Q.longStackSupport = true;
+```
+
+then the above code gives a nice stack trace to the tune of
+
+```
+Error: boo!
+ at explode (/path/to/test.js:3:11)
+From previous event:
+ at theDepthsOfMyProgram (/path/to/test.js:2:16)
+ at Object.<anonymous> (/path/to/test.js:7:1)
+```
+
+Note how you can see the the function that triggered the async operation in the
+stack trace! This is very helpful for debugging, as otherwise you end up getting
+only the first line, plus a bunch of Q internals, with no sign of where the
+operation started.
+
+This feature does come with somewhat-serious performance and memory overhead,
+however. If you're working with lots of promises, or trying to scale a server
+to many users, you should probably keep it off. But in development, go for it!
+
+## Tests
+
+You can view the results of the Q test suite [in your browser][tests]!
+
+[tests]: https://rawgithub.com/kriskowal/q/v1/spec/q-spec.html
+
+## License
+
+Copyright 2009–2014 Kristopher Michael Kowal
+MIT License (enclosed)
+
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/q/benchmark/compare-with-callbacks.js
----------------------------------------------------------------------
diff --git a/node_modules/q/benchmark/compare-with-callbacks.js b/node_modules/q/benchmark/compare-with-callbacks.js
new file mode 100644
index 0000000..97f1298
--- /dev/null
+++ b/node_modules/q/benchmark/compare-with-callbacks.js
@@ -0,0 +1,71 @@
+"use strict";
+
+var Q = require("../q");
+var fs = require("fs");
+
+suite("A single simple async operation", function () {
+ bench("with an immediately-fulfilled promise", function (done) {
+ Q().then(done);
+ });
+
+ bench("with direct setImmediate usage", function (done) {
+ setImmediate(done);
+ });
+
+ bench("with direct setTimeout(…, 0)", function (done) {
+ setTimeout(done, 0);
+ });
+});
+
+suite("A fs.readFile", function () {
+ var denodeified = Q.denodeify(fs.readFile);
+
+ set("iterations", 1000);
+ set("delay", 1000);
+
+ bench("directly, with callbacks", function (done) {
+ fs.readFile(__filename, done);
+ });
+
+ bench("with Q.nfcall", function (done) {
+ Q.nfcall(fs.readFile, __filename).then(done);
+ });
+
+ bench("with a Q.denodeify'ed version", function (done) {
+ denodeified(__filename).then(done);
+ });
+
+ bench("with manual usage of deferred.makeNodeResolver", function (done) {
+ var deferred = Q.defer();
+ fs.readFile(__filename, deferred.makeNodeResolver());
+ deferred.promise.then(done);
+ });
+});
+
+suite("1000 operations in parallel", function () {
+ function makeCounter(desiredCount, ultimateCallback) {
+ var soFar = 0;
+ return function () {
+ if (++soFar === desiredCount) {
+ ultimateCallback();
+ }
+ };
+ }
+ var numberOfOps = 1000;
+
+ bench("with immediately-fulfilled promises", function (done) {
+ var counter = makeCounter(numberOfOps, done);
+
+ for (var i = 0; i < numberOfOps; ++i) {
+ Q().then(counter);
+ }
+ });
+
+ bench("with direct setImmediate usage", function (done) {
+ var counter = makeCounter(numberOfOps, done);
+
+ for (var i = 0; i < numberOfOps; ++i) {
+ setImmediate(counter);
+ }
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/q/benchmark/scenarios.js
----------------------------------------------------------------------
diff --git a/node_modules/q/benchmark/scenarios.js b/node_modules/q/benchmark/scenarios.js
new file mode 100644
index 0000000..7c18564
--- /dev/null
+++ b/node_modules/q/benchmark/scenarios.js
@@ -0,0 +1,36 @@
+"use strict";
+
+var Q = require("../q");
+
+suite("Chaining", function () {
+ var numberToChain = 1000;
+
+ bench("Chaining many already-fulfilled promises together", function (done) {
+ var currentPromise = Q();
+ for (var i = 0; i < numberToChain; ++i) {
+ currentPromise = currentPromise.then(function () {
+ return Q();
+ });
+ }
+
+ currentPromise.then(done);
+ });
+
+ bench("Chaining and then fulfilling the end of the chain", function (done) {
+ var deferred = Q.defer();
+
+ var currentPromise = deferred.promise;
+ for (var i = 0; i < numberToChain; ++i) {
+ (function () {
+ var promiseToReturn = currentPromise;
+ currentPromise = Q().then(function () {
+ return promiseToReturn;
+ });
+ }());
+ }
+
+ currentPromise.then(done);
+
+ deferred.resolve();
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/dc1d926a/node_modules/q/package.json
----------------------------------------------------------------------
diff --git a/node_modules/q/package.json b/node_modules/q/package.json
new file mode 100644
index 0000000..4c98a98
--- /dev/null
+++ b/node_modules/q/package.json
@@ -0,0 +1,113 @@
+{
+ "name": "q",
+ "version": "1.0.1",
+ "description": "A library for promises (CommonJS/Promises/A,B,D)",
+ "homepage": "https://github.com/kriskowal/q",
+ "author": {
+ "name": "Kris Kowal",
+ "email": "kris@cixar.com",
+ "url": "https://github.com/kriskowal"
+ },
+ "keywords": [
+ "q",
+ "promise",
+ "promises",
+ "promises-a",
+ "promises-aplus",
+ "deferred",
+ "future",
+ "async",
+ "flow control",
+ "fluent",
+ "browser",
+ "node"
+ ],
+ "contributors": [
+ {
+ "name": "Kris Kowal",
+ "email": "kris@cixar.com",
+ "url": "https://github.com/kriskowal"
+ },
+ {
+ "name": "Irakli Gozalishvili",
+ "email": "rfobic@gmail.com",
+ "url": "http://jeditoolkit.com"
+ },
+ {
+ "name": "Domenic Denicola",
+ "email": "domenic@domenicdenicola.com",
+ "url": "http://domenicdenicola.com"
+ }
+ ],
+ "bugs": {
+ "url": "http://github.com/kriskowal/q/issues"
+ },
+ "license": {
+ "type": "MIT",
+ "url": "http://github.com/kriskowal/q/raw/master/LICENSE"
+ },
+ "main": "q.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/kriskowal/q.git"
+ },
+ "engines": {
+ "node": ">=0.6.0",
+ "teleport": ">=0.2.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "jshint": "~2.1.9",
+ "cover": "*",
+ "jasmine-node": "1.11.0",
+ "opener": "*",
+ "promises-aplus-tests": "1.x",
+ "grunt": "~0.4.1",
+ "grunt-cli": "~0.1.9",
+ "grunt-contrib-uglify": "~0.2.2",
+ "matcha": "~0.2.0"
+ },
+ "scripts": {
+ "test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
+ "test-browser": "opener spec/q-spec.html",
+ "benchmark": "matcha",
+ "lint": "jshint q.js",
+ "cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html",
+ "minify": "grunt",
+ "prepublish": "grunt"
+ },
+ "overlay": {
+ "teleport": {
+ "dependencies": {
+ "system": ">=0.0.4"
+ }
+ }
+ },
+ "directories": {
+ "test": "./spec"
+ },
+ "_id": "q@1.0.1",
+ "dist": {
+ "shasum": "11872aeedee89268110b10a718448ffb10112a14",
+ "tarball": "http://registry.npmjs.org/q/-/q-1.0.1.tgz"
+ },
+ "_from": "q@~1",
+ "_npmVersion": "1.4.4",
+ "_npmUser": {
+ "name": "kriskowal",
+ "email": "kris.kowal@cixar.com"
+ },
+ "maintainers": [
+ {
+ "name": "kriskowal",
+ "email": "kris.kowal@cixar.com"
+ },
+ {
+ "name": "domenic",
+ "email": "domenic@domenicdenicola.com"
+ }
+ ],
+ "_shasum": "11872aeedee89268110b10a718448ffb10112a14",
+ "_resolved": "https://registry.npmjs.org/q/-/q-1.0.1.tgz",
+ "readme": "ERROR: No README data found!"
+}