http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/bplistParser.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/bplistParser.js b/bin/node_modules/cordova-common/node_modules/bplist-parser/bplistParser.js new file mode 100644 index 0000000..1054c56 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/bplist-parser/bplistParser.js @@ -0,0 +1,337 @@ +'use strict'; + +// adapted from http://code.google.com/p/plist/source/browse/trunk/src/com/dd/plist/BinaryPropertyListParser.java + +var fs = require('fs'); +var debug = false; + +exports.maxObjectSize = 100 * 1000 * 1000; // 100Meg +exports.maxObjectCount = 32768; + +// EPOCH = new SimpleDateFormat("yyyy MM dd zzz").parse("2001 01 01 GMT").getTime(); +// ...but that's annoying in a static initializer because it can throw exceptions, ick. +// So we just hardcode the correct value. +var EPOCH = 978307200000; + +// UID object definition +var UID = exports.UID = function(id) { + this.UID = id; +} + +var parseFile = exports.parseFile = function (fileNameOrBuffer, callback) { + function tryParseBuffer(buffer) { + var err = null; + var result; + try { + result = parseBuffer(buffer); + } catch (ex) { + err = ex; + } + callback(err, result); + } + + if (Buffer.isBuffer(fileNameOrBuffer)) { + return tryParseBuffer(fileNameOrBuffer); + } else { + fs.readFile(fileNameOrBuffer, function (err, data) { + if (err) { return callback(err); } + tryParseBuffer(data); + }); + } +}; + +var parseBuffer = exports.parseBuffer = function (buffer) { + var result = {}; + + // check header + var header = buffer.slice(0, 'bplist'.length).toString('utf8'); + if (header !== 'bplist') { + throw new Error("Invalid binary plist. Expected 'bplist' at offset 0."); + } + + // Handle trailer, last 32 bytes of the file + var trailer = buffer.slice(buffer.length - 32, buffer.length); + // 6 null bytes (index 0 to 5) + var offsetSize = trailer.readUInt8(6); + if (debug) { + console.log("offsetSize: " + offsetSize); + } + var objectRefSize = trailer.readUInt8(7); + if (debug) { + console.log("objectRefSize: " + objectRefSize); + } + var numObjects = readUInt64BE(trailer, 8); + if (debug) { + console.log("numObjects: " + numObjects); + } + var topObject = readUInt64BE(trailer, 16); + if (debug) { + console.log("topObject: " + topObject); + } + var offsetTableOffset = readUInt64BE(trailer, 24); + if (debug) { + console.log("offsetTableOffset: " + offsetTableOffset); + } + + if (numObjects > exports.maxObjectCount) { + throw new Error("maxObjectCount exceeded"); + } + + // Handle offset table + var offsetTable = []; + + for (var i = 0; i < numObjects; i++) { + var offsetBytes = buffer.slice(offsetTableOffset + i * offsetSize, offsetTableOffset + (i + 1) * offsetSize); + offsetTable[i] = readUInt(offsetBytes, 0); + if (debug) { + console.log("Offset for Object #" + i + " is " + offsetTable[i] + " [" + offsetTable[i].toString(16) + "]"); + } + } + + // Parses an object inside the currently parsed binary property list. + // For the format specification check + // <a href="http://www.opensource.apple.com/source/CF/CF-635/CFBinaryPList.c"> + // Apple's binary property list parser implementation</a>. + function parseObject(tableOffset) { + var offset = offsetTable[tableOffset]; + var type = buffer[offset]; + var objType = (type & 0xF0) >> 4; //First 4 bits + var objInfo = (type & 0x0F); //Second 4 bits + switch (objType) { + case 0x0: + return parseSimple(); + case 0x1: + return parseInteger(); + case 0x8: + return parseUID(); + case 0x2: + return parseReal(); + case 0x3: + return parseDate(); + case 0x4: + return parseData(); + case 0x5: // ASCII + return parsePlistString(); + case 0x6: // UTF-16 + return parsePlistString(true); + case 0xA: + return parseArray(); + case 0xD: + return parseDictionary(); + default: + throw new Error("Unhandled type 0x" + objType.toString(16)); + } + + function parseSimple() { + //Simple + switch (objInfo) { + case 0x0: // null + return null; + case 0x8: // false + return false; + case 0x9: // true + return true; + case 0xF: // filler byte + return null; + default: + throw new Error("Unhandled simple type 0x" + objType.toString(16)); + } + } + + function parseInteger() { + var length = Math.pow(2, objInfo); + if (length < exports.maxObjectSize) { + return readUInt(buffer.slice(offset + 1, offset + 1 + length)); + } else { + throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available."); + } + } + + function parseUID() { + var length = objInfo + 1; + if (length < exports.maxObjectSize) { + return new UID(readUInt(buffer.slice(offset + 1, offset + 1 + length))); + } else { + throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available."); + } + } + + function parseReal() { + var length = Math.pow(2, objInfo); + if (length < exports.maxObjectSize) { + var realBuffer = buffer.slice(offset + 1, offset + 1 + length); + if (length === 4) { + return realBuffer.readFloatBE(0); + } + else if (length === 8) { + return realBuffer.readDoubleBE(0); + } + } else { + throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available."); + } + } + + function parseDate() { + if (objInfo != 0x3) { + console.error("Unknown date type :" + objInfo + ". Parsing anyway..."); + } + var dateBuffer = buffer.slice(offset + 1, offset + 9); + return new Date(EPOCH + (1000 * dateBuffer.readDoubleBE(0))); + } + + function parseData() { + var dataoffset = 1; + var length = objInfo; + if (objInfo == 0xF) { + var int_type = buffer[offset + 1]; + var intType = (int_type & 0xF0) / 0x10; + if (intType != 0x1) { + console.error("0x4: UNEXPECTED LENGTH-INT TYPE! " + intType); + } + var intInfo = int_type & 0x0F; + var intLength = Math.pow(2, intInfo); + dataoffset = 2 + intLength; + if (intLength < 3) { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } else { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } + } + if (length < exports.maxObjectSize) { + return buffer.slice(offset + dataoffset, offset + dataoffset + length); + } else { + throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available."); + } + } + + function parsePlistString (isUtf16) { + isUtf16 = isUtf16 || 0; + var enc = "utf8"; + var length = objInfo; + var stroffset = 1; + if (objInfo == 0xF) { + var int_type = buffer[offset + 1]; + var intType = (int_type & 0xF0) / 0x10; + if (intType != 0x1) { + console.err("UNEXPECTED LENGTH-INT TYPE! " + intType); + } + var intInfo = int_type & 0x0F; + var intLength = Math.pow(2, intInfo); + var stroffset = 2 + intLength; + if (intLength < 3) { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } else { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } + } + // length is String length -> to get byte length multiply by 2, as 1 character takes 2 bytes in UTF-16 + length *= (isUtf16 + 1); + if (length < exports.maxObjectSize) { + var plistString = new Buffer(buffer.slice(offset + stroffset, offset + stroffset + length)); + if (isUtf16) { + plistString = swapBytes(plistString); + enc = "ucs2"; + } + return plistString.toString(enc); + } else { + throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available."); + } + } + + function parseArray() { + var length = objInfo; + var arrayoffset = 1; + if (objInfo == 0xF) { + var int_type = buffer[offset + 1]; + var intType = (int_type & 0xF0) / 0x10; + if (intType != 0x1) { + console.error("0xa: UNEXPECTED LENGTH-INT TYPE! " + intType); + } + var intInfo = int_type & 0x0F; + var intLength = Math.pow(2, intInfo); + arrayoffset = 2 + intLength; + if (intLength < 3) { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } else { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } + } + if (length * objectRefSize > exports.maxObjectSize) { + throw new Error("To little heap space available!"); + } + var array = []; + for (var i = 0; i < length; i++) { + var objRef = readUInt(buffer.slice(offset + arrayoffset + i * objectRefSize, offset + arrayoffset + (i + 1) * objectRefSize)); + array[i] = parseObject(objRef); + } + return array; + } + + function parseDictionary() { + var length = objInfo; + var dictoffset = 1; + if (objInfo == 0xF) { + var int_type = buffer[offset + 1]; + var intType = (int_type & 0xF0) / 0x10; + if (intType != 0x1) { + console.error("0xD: UNEXPECTED LENGTH-INT TYPE! " + intType); + } + var intInfo = int_type & 0x0F; + var intLength = Math.pow(2, intInfo); + dictoffset = 2 + intLength; + if (intLength < 3) { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } else { + length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength)); + } + } + if (length * 2 * objectRefSize > exports.maxObjectSize) { + throw new Error("To little heap space available!"); + } + if (debug) { + console.log("Parsing dictionary #" + tableOffset); + } + var dict = {}; + for (var i = 0; i < length; i++) { + var keyRef = readUInt(buffer.slice(offset + dictoffset + i * objectRefSize, offset + dictoffset + (i + 1) * objectRefSize)); + var valRef = readUInt(buffer.slice(offset + dictoffset + (length * objectRefSize) + i * objectRefSize, offset + dictoffset + (length * objectRefSize) + (i + 1) * objectRefSize)); + var key = parseObject(keyRef); + var val = parseObject(valRef); + if (debug) { + console.log(" DICT #" + tableOffset + ": Mapped " + key + " to " + val); + } + dict[key] = val; + } + return dict; + } + } + + return [ parseObject(topObject) ]; +}; + +function readUInt(buffer, start) { + start = start || 0; + + var l = 0; + for (var i = start; i < buffer.length; i++) { + l <<= 8; + l |= buffer[i] & 0xFF; + } + return l; +} + +// we're just going to toss the high order bits because javascript doesn't have 64-bit ints +function readUInt64BE(buffer, start) { + var data = buffer.slice(start, start + 8); + return data.readUInt32BE(4, 8); +} + +function swapBytes(buffer) { + var len = buffer.length; + for (var i = 0; i < len; i += 2) { + var a = buffer[i]; + buffer[i] = buffer[i+1]; + buffer[i+1] = a; + } + return buffer; +}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/package.json ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/package.json b/bin/node_modules/cordova-common/node_modules/bplist-parser/package.json new file mode 100644 index 0000000..d558dc3 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/bplist-parser/package.json @@ -0,0 +1,52 @@ +{ + "name": "bplist-parser", + "version": "0.1.0", + "description": "Binary plist parser.", + "main": "bplistParser.js", + "scripts": { + "test": "./node_modules/nodeunit/bin/nodeunit test" + }, + "keywords": [ + "bplist", + "plist", + "parser" + ], + "author": { + "name": "Joe Ferner", + "email": "[email protected]" + }, + "license": "MIT", + "devDependencies": { + "nodeunit": "~0.9.1" + }, + "repository": { + "type": "git", + "url": "https://github.com/nearinfinity/node-bplist-parser.git" + }, + "gitHead": "82d14f8defa7fc1e9f78a469c76c235ac244fd8f", + "bugs": { + "url": "https://github.com/nearinfinity/node-bplist-parser/issues" + }, + "homepage": "https://github.com/nearinfinity/node-bplist-parser", + "_id": "[email protected]", + "_shasum": "630823f2056437d4dbefc20e84017f8bac48e008", + "_from": "bplist-parser@^0.1.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "joeferner", + "email": "[email protected]" + }, + "maintainers": [ + { + "name": "joeferner", + "email": "[email protected]" + } + ], + "dist": { + "shasum": "630823f2056437d4dbefc20e84017f8bac48e008", + "tarball": "http://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.0.tgz", + "readme": "ERROR: No README data found!" +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/airplay.bplist ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/airplay.bplist b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/airplay.bplist new file mode 100644 index 0000000..931adea Binary files /dev/null and b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/airplay.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/iTunes-small.bplist ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/iTunes-small.bplist b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/iTunes-small.bplist new file mode 100644 index 0000000..b7edb14 Binary files /dev/null and b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/iTunes-small.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/parseTest.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/parseTest.js b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/parseTest.js new file mode 100644 index 0000000..02a98e3 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/parseTest.js @@ -0,0 +1,141 @@ +'use strict'; + +// tests are adapted from https://github.com/TooTallNate/node-plist + +var path = require('path'); +var nodeunit = require('nodeunit'); +var bplist = require('../'); + +module.exports = { + 'iTunes Small': function (test) { + var file = path.join(__dirname, "iTunes-small.bplist"); + var startTime1 = new Date(); + + bplist.parseFile(file, function (err, dicts) { + if (err) { + throw err; + } + + var endTime = new Date(); + console.log('Parsed "' + file + '" in ' + (endTime - startTime1) + 'ms'); + var dict = dicts[0]; + test.equal(dict['Application Version'], "9.0.3"); + test.equal(dict['Library Persistent ID'], "6F81D37F95101437"); + test.done(); + }); + }, + + 'sample1': function (test) { + var file = path.join(__dirname, "sample1.bplist"); + var startTime = new Date(); + + bplist.parseFile(file, function (err, dicts) { + if (err) { + throw err; + } + + var endTime = new Date(); + console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms'); + var dict = dicts[0]; + test.equal(dict['CFBundleIdentifier'], 'com.apple.dictionary.MySample'); + test.done(); + }); + }, + + 'sample2': function (test) { + var file = path.join(__dirname, "sample2.bplist"); + var startTime = new Date(); + + bplist.parseFile(file, function (err, dicts) { + if (err) { + throw err; + } + + var endTime = new Date(); + console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms'); + var dict = dicts[0]; + test.equal(dict['PopupMenu'][2]['Key'], "\n #import <Cocoa/Cocoa.h>\n\n#import <MacRuby/MacRuby.h>\n\nint main(int argc, char *argv[])\n{\n return macruby_main(\"rb_main.rb\", argc, argv);\n}\n"); + test.done(); + }); + }, + + 'airplay': function (test) { + var file = path.join(__dirname, "airplay.bplist"); + var startTime = new Date(); + + bplist.parseFile(file, function (err, dicts) { + if (err) { + throw err; + } + + var endTime = new Date(); + console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms'); + + var dict = dicts[0]; + test.equal(dict['duration'], 5555.0495000000001); + test.equal(dict['position'], 4.6269989039999997); + test.done(); + }); + }, + + 'utf16': function (test) { + var file = path.join(__dirname, "utf16.bplist"); + var startTime = new Date(); + + bplist.parseFile(file, function (err, dicts) { + if (err) { + throw err; + } + + var endTime = new Date(); + console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms'); + + var dict = dicts[0]; + test.equal(dict['CFBundleName'], 'sellStuff'); + test.equal(dict['CFBundleShortVersionString'], '2.6.1'); + test.equal(dict['NSHumanReadableCopyright'], '©2008-2012, sellStuff, Inc.'); + test.done(); + }); + }, + + 'utf16chinese': function (test) { + var file = path.join(__dirname, "utf16_chinese.plist"); + var startTime = new Date(); + + bplist.parseFile(file, function (err, dicts) { + if (err) { + throw err; + } + + var endTime = new Date(); + console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms'); + + var dict = dicts[0]; + test.equal(dict['CFBundleName'], '天翼é 读'); + test.equal(dict['CFBundleDisplayName'], '天翼é 读'); + test.done(); + }); + }, + + + + 'uid': function (test) { + var file = path.join(__dirname, "uid.bplist"); + var startTime = new Date(); + + bplist.parseFile(file, function (err, dicts) { + if (err) { + throw err; + } + + var endTime = new Date(); + console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms'); + + var dict = dicts[0]; + test.deepEqual(dict['$objects'][1]['NS.keys'], [{UID:2}, {UID:3}, {UID:4}]); + test.deepEqual(dict['$objects'][1]['NS.objects'], [{UID: 5}, {UID:6}, {UID:7}]); + test.deepEqual(dict['$top']['root'], {UID:1}); + test.done(); + }); + } +}; http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample1.bplist ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample1.bplist b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample1.bplist new file mode 100644 index 0000000..5b808ff Binary files /dev/null and b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample1.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample2.bplist ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample2.bplist b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample2.bplist new file mode 100644 index 0000000..fc42979 Binary files /dev/null and b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/sample2.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/uid.bplist ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/uid.bplist b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/uid.bplist new file mode 100644 index 0000000..59f341e Binary files /dev/null and b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/uid.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16.bplist ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16.bplist b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16.bplist new file mode 100644 index 0000000..ba4bcfa Binary files /dev/null and b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16_chinese.plist ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16_chinese.plist b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16_chinese.plist new file mode 100644 index 0000000..ba1e2d7 Binary files /dev/null and b/bin/node_modules/cordova-common/node_modules/bplist-parser/test/utf16_chinese.plist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.npmignore ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.npmignore b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.npmignore @@ -0,0 +1 @@ +node_modules http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.travis.yml ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.travis.yml b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.travis.yml new file mode 100644 index 0000000..ae381fc --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +sudo: false +node_js: + - "0.10" +install: npm install +script: + - npm test http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/README.md ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/README.md b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/README.md new file mode 100644 index 0000000..3b93e5f --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/README.md @@ -0,0 +1,14 @@ +[](https://travis-ci.org/stevengill/cordova-registry-mapper) + +#Cordova Registry Mapper + +This module is used to map Cordova plugin ids to package names and vice versa. + +When Cordova users add plugins to their projects using ids +(e.g. `cordova plugin add org.apache.cordova.device`), +this module will map that id to the corresponding package name so `cordova-lib` knows what to fetch from **npm**. + +This module was created so the Apache Cordova project could migrate its plugins from +the [Cordova Registry](http://registry.cordova.io/) +to [npm](https://registry.npmjs.com/) +instead of having to maintain a registry. http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/index.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/index.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/index.js new file mode 100644 index 0000000..6c5091d --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/index.js @@ -0,0 +1,199 @@ +var map = { + 'org.apache.cordova.battery-status':'cordova-plugin-battery-status', + 'org.apache.cordova.camera':'cordova-plugin-camera', + 'org.apache.cordova.console':'cordova-plugin-console', + 'org.apache.cordova.contacts':'cordova-plugin-contacts', + 'org.apache.cordova.device':'cordova-plugin-device', + 'org.apache.cordova.device-motion':'cordova-plugin-device-motion', + 'org.apache.cordova.device-orientation':'cordova-plugin-device-orientation', + 'org.apache.cordova.dialogs':'cordova-plugin-dialogs', + 'org.apache.cordova.file':'cordova-plugin-file', + 'org.apache.cordova.file-transfer':'cordova-plugin-file-transfer', + 'org.apache.cordova.geolocation':'cordova-plugin-geolocation', + 'org.apache.cordova.globalization':'cordova-plugin-globalization', + 'org.apache.cordova.inappbrowser':'cordova-plugin-inappbrowser', + 'org.apache.cordova.media':'cordova-plugin-media', + 'org.apache.cordova.media-capture':'cordova-plugin-media-capture', + 'org.apache.cordova.network-information':'cordova-plugin-network-information', + 'org.apache.cordova.splashscreen':'cordova-plugin-splashscreen', + 'org.apache.cordova.statusbar':'cordova-plugin-statusbar', + 'org.apache.cordova.vibration':'cordova-plugin-vibration', + 'org.apache.cordova.test-framework':'cordova-plugin-test-framework', + 'com.msopentech.websql' : 'cordova-plugin-websql', + 'com.msopentech.indexeddb' : 'cordova-plugin-indexeddb', + 'com.microsoft.aad.adal' : 'cordova-plugin-ms-adal', + 'com.microsoft.capptain' : 'capptain-cordova', + 'com.microsoft.services.aadgraph' : 'cordova-plugin-ms-aad-graph', + 'com.microsoft.services.files' : 'cordova-plugin-ms-files', + 'om.microsoft.services.outlook' : 'cordova-plugin-ms-outlook', + 'com.pbakondy.sim' : 'cordova-plugin-sim', + 'android.support.v4' : 'cordova-plugin-android-support-v4', + 'android.support.v7-appcompat' : 'cordova-plugin-android-support-v7-appcompat', + 'com.google.playservices' : 'cordova-plugin-googleplayservices', + 'com.google.cordova.admob' : 'cordova-plugin-admobpro', + 'com.rjfun.cordova.extension' : 'cordova-plugin-extension', + 'com.rjfun.cordova.plugin.admob' : 'cordova-plugin-admob', + 'com.rjfun.cordova.flurryads' : 'cordova-plugin-flurry', + 'com.rjfun.cordova.facebookads' : 'cordova-plugin-facebookads', + 'com.rjfun.cordova.httpd' : 'cordova-plugin-httpd', + 'com.rjfun.cordova.iad' : 'cordova-plugin-iad', + 'com.rjfun.cordova.iflyspeech' : 'cordova-plugin-iflyspeech', + 'com.rjfun.cordova.lianlianpay' : 'cordova-plugin-lianlianpay', + 'com.rjfun.cordova.mobfox' : 'cordova-plugin-mobfox', + 'com.rjfun.cordova.mopub' : 'cordova-plugin-mopub', + 'com.rjfun.cordova.mmedia' : 'cordova-plugin-mmedia', + 'com.rjfun.cordova.nativeaudio' : 'cordova-plugin-nativeaudio', + 'com.rjfun.cordova.plugin.paypalmpl' : 'cordova-plugin-paypalmpl', + 'com.rjfun.cordova.smartadserver' : 'cordova-plugin-smartadserver', + 'com.rjfun.cordova.sms' : 'cordova-plugin-sms', + 'com.rjfun.cordova.wifi' : 'cordova-plugin-wifi', + 'com.ohh2ahh.plugins.appavailability' : 'cordova-plugin-appavailability', + 'org.adapt-it.cordova.fonts' : 'cordova-plugin-fonts', + 'de.martinreinhardt.cordova.plugins.barcodeScanner' : 'cordova-plugin-barcodescanner', + 'de.martinreinhardt.cordova.plugins.urlhandler' : 'cordova-plugin-urlhandler', + 'de.martinreinhardt.cordova.plugins.email' : 'cordova-plugin-email', + 'de.martinreinhardt.cordova.plugins.certificates' : 'cordova-plugin-certificates', + 'de.martinreinhardt.cordova.plugins.sqlite' : 'cordova-plugin-sqlite', + 'fr.smile.cordova.fileopener' : 'cordova-plugin-fileopener', + 'org.smile.websqldatabase.initializer' : 'cordova-plugin-websqldatabase-initializer', + 'org.smile.websqldatabase.wpdb' : 'cordova-plugin-websqldatabase', + 'org.jboss.aerogear.cordova.push' : 'aerogear-cordova-push', + 'org.jboss.aerogear.cordova.oauth2' : 'aerogear-cordova-oauth2', + 'org.jboss.aerogear.cordova.geo' : 'aerogear-cordova-geo', + 'org.jboss.aerogear.cordova.crypto' : 'aerogear-cordova-crypto', + 'org.jboss.aerogaer.cordova.otp' : 'aerogear-cordova-otp', + 'uk.co.ilee.applewatch' : 'cordova-plugin-apple-watch', + 'uk.co.ilee.directions' : 'cordova-plugin-directions', + 'uk.co.ilee.gamecenter' : 'cordova-plugin-game-center', + 'uk.co.ilee.jailbreakdetection' : 'cordova-plugin-jailbreak-detection', + 'uk.co.ilee.nativetransitions' : 'cordova-plugin-native-transitions', + 'uk.co.ilee.pedometer' : 'cordova-plugin-pedometer', + 'uk.co.ilee.shake' : 'cordova-plugin-shake', + 'uk.co.ilee.touchid' : 'cordova-plugin-touchid', + 'com.knowledgecode.cordova.websocket' : 'cordova-plugin-websocket', + 'com.elixel.plugins.settings' : 'cordova-plugin-settings', + 'com.cowbell.cordova.geofence' : 'cordova-plugin-geofence', + 'com.blackberry.community.preventsleep' : 'cordova-plugin-preventsleep', + 'com.blackberry.community.gamepad' : 'cordova-plugin-gamepad', + 'com.blackberry.community.led' : 'cordova-plugin-led', + 'com.blackberry.community.thumbnail' : 'cordova-plugin-thumbnail', + 'com.blackberry.community.mediakeys' : 'cordova-plugin-mediakeys', + 'com.blackberry.community.simplebtlehrplugin' : 'cordova-plugin-bluetoothheartmonitor', + 'com.blackberry.community.simplebeaconplugin' : 'cordova-plugin-bluetoothibeacon', + 'com.blackberry.community.simplebtsppplugin' : 'cordova-plugin-bluetoothspp', + 'com.blackberry.community.clipboard' : 'cordova-plugin-clipboard', + 'com.blackberry.community.curl' : 'cordova-plugin-curl', + 'com.blackberry.community.qt' : 'cordova-plugin-qtbridge', + 'com.blackberry.community.upnp' : 'cordova-plugin-upnp', + 'com.blackberry.community.PasswordCrypto' : 'cordova-plugin-password-crypto', + 'com.blackberry.community.deviceinfoplugin' : 'cordova-plugin-deviceinfo', + 'com.blackberry.community.gsecrypto' : 'cordova-plugin-bb-crypto', + 'com.blackberry.community.mongoose' : 'cordova-plugin-mongoose', + 'com.blackberry.community.sysdialog' : 'cordova-plugin-bb-sysdialog', + 'com.blackberry.community.screendisplay' : 'cordova-plugin-screendisplay', + 'com.blackberry.community.messageplugin' : 'cordova-plugin-bb-messageretrieve', + 'com.blackberry.community.emailsenderplugin' : 'cordova-plugin-emailsender', + 'com.blackberry.community.audiometadata' : 'cordova-plugin-audiometadata', + 'com.blackberry.community.deviceemails' : 'cordova-plugin-deviceemails', + 'com.blackberry.community.audiorecorder' : 'cordova-plugin-audiorecorder', + 'com.blackberry.community.vibration' : 'cordova-plugin-vibrate-intense', + 'com.blackberry.community.SMSPlugin' : 'cordova-plugin-bb-sms', + 'com.blackberry.community.extractZipFile' : 'cordova-plugin-bb-zip', + 'com.blackberry.community.lowlatencyaudio' : 'cordova-plugin-bb-nativeaudio', + 'com.blackberry.community.barcodescanner' : 'phonegap-plugin-barcodescanner', + 'com.blackberry.app' : 'cordova-plugin-bb-app', + 'com.blackberry.bbm.platform' : 'cordova-plugin-bbm', + 'com.blackberry.connection' : 'cordova-plugin-bb-connection', + 'com.blackberry.identity' : 'cordova-plugin-bb-identity', + 'com.blackberry.invoke.card' : 'cordova-plugin-bb-card', + 'com.blackberry.invoke' : 'cordova-plugin-bb-invoke', + 'com.blackberry.invoked' : 'cordova-plugin-bb-invoked', + 'com.blackberry.io.filetransfer' : 'cordova-plugin-bb-filetransfer', + 'com.blackberry.io' : 'cordova-plugin-bb-io', + 'com.blackberry.notification' : 'cordova-plugin-bb-notification', + 'com.blackberry.payment' : 'cordova-plugin-bb-payment', + 'com.blackberry.pim.calendar' : 'cordova-plugin-bb-calendar', + 'com.blackberry.pim.contacts' : 'cordova-plugin-bb-contacts', + 'com.blackberry.pim.lib' : 'cordova-plugin-bb-pimlib', + 'com.blackberry.push' : 'cordova-plugin-bb-push', + 'com.blackberry.screenshot' : 'cordova-plugin-screenshot', + 'com.blackberry.sensors' : 'cordova-plugin-bb-sensors', + 'com.blackberry.system' : 'cordova-plugin-bb-system', + 'com.blackberry.ui.contextmenu' : 'cordova-plugin-bb-ctxmenu', + 'com.blackberry.ui.cover' : 'cordova-plugin-bb-cover', + 'com.blackberry.ui.dialog' : 'cordova-plugin-bb-dialog', + 'com.blackberry.ui.input' : 'cordova-plugin-touch-keyboard', + 'com.blackberry.ui.toast' : 'cordova-plugin-toast', + 'com.blackberry.user.identity' : 'cordova-plugin-bb-idservice', + 'com.blackberry.utils' : 'cordova-plugin-bb-utils', + 'net.yoik.cordova.plugins.screenorientation' : 'cordova-plugin-screen-orientation', + 'com.phonegap.plugins.barcodescanner' : 'phonegap-plugin-barcodescanner', + 'com.manifoldjs.hostedwebapp' : 'cordova-plugin-hostedwebapp', + 'com.initialxy.cordova.themeablebrowser' : 'cordova-plugin-themeablebrowser', + 'gr.denton.photosphere' : 'cordova-plugin-panoramaviewer', + 'nl.x-services.plugins.actionsheet' : 'cordova-plugin-actionsheet', + 'nl.x-services.plugins.socialsharing' : 'cordova-plugin-x-socialsharing', + 'nl.x-services.plugins.googleplus' : 'cordova-plugin-googleplus', + 'nl.x-services.plugins.insomnia' : 'cordova-plugin-insomnia', + 'nl.x-services.plugins.toast' : 'cordova-plugin-x-toast', + 'nl.x-services.plugins.calendar' : 'cordova-plugin-calendar', + 'nl.x-services.plugins.launchmyapp' : 'cordova-plugin-customurlscheme', + 'nl.x-services.plugins.flashlight' : 'cordova-plugin-flashlight', + 'nl.x-services.plugins.sslcertificatechecker' : 'cordova-plugin-sslcertificatechecker', + 'com.bridge.open' : 'cordova-open', + 'com.bridge.safe' : 'cordova-safe', + 'com.disusered.open' : 'cordova-open', + 'com.disusered.safe' : 'cordova-safe', + 'me.apla.cordova.app-preferences' : 'cordova-plugin-app-preferences', + 'com.konotor.cordova' : 'cordova-plugin-konotor', + 'io.intercom.cordova' : 'cordova-plugin-intercom', + 'com.onesignal.plugins.onesignal' : 'onesignal-cordova-plugin', + 'com.danjarvis.document-contract': 'cordova-plugin-document-contract', + 'com.eface2face.iosrtc' : 'cordova-plugin-iosrtc', + 'com.mobileapptracking.matplugin' : 'cordova-plugin-tune', + 'com.marianhello.cordova.background-geolocation' : 'cordova-plugin-mauron85-background-geolocation', + 'fr.louisbl.cordova.locationservices' : 'cordova-plugin-locationservices', + 'fr.louisbl.cordova.gpslocation' : 'cordova-plugin-gpslocation', + 'com.hiliaox.weibo' : 'cordova-plugin-weibo', + 'com.uxcam.cordova.plugin' : 'cordova-uxcam', + 'de.fastr.phonegap.plugins.downloader' : 'cordova-plugin-fastrde-downloader', + 'de.fastr.phonegap.plugins.injectView' : 'cordova-plugin-fastrde-injectview', + 'de.fastr.phonegap.plugins.CheckGPS' : 'cordova-plugin-fastrde-checkgps', + 'de.fastr.phonegap.plugins.md5chksum' : ' cordova-plugin-fastrde-md5', + 'io.repro.cordova' : 'cordova-plugin-repro', + 're.notifica.cordova': 'cordova-plugin-notificare-push', + 'com.megster.cordova.ble': 'cordova-plugin-ble-central', + 'com.megster.cordova.bluetoothserial': 'cordova-plugin-bluetooth-serial', + 'com.megster.cordova.rfduino': 'cordova-plugin-rfduino', + 'cz.velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback', + 'cz.Velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback', + 'org.scriptotek.appinfo': 'cordova-plugin-appinfo', + 'com.yezhiming.cordova.appinfo': 'cordova-plugin-appinfo', + 'pl.makingwaves.estimotebeacons': 'cordova-plugin-estimote', + 'com.evothings.ble': 'cordova-plugin-ble', + 'com.appsee.plugin' : 'cordova-plugin-appsee', + 'am.armsoft.plugins.listpicker': 'cordova-plugin-listpicker', + 'com.pushbots.push': 'pushbots-cordova-plugin', + 'com.admob.google': 'cordova-admob', + 'admob.ads.google': 'cordova-admob-ads', + 'admob.google.plugin': 'admob-google', + 'com.admob.admobads': 'admob-ads', + 'com.connectivity.monitor': 'cordova-connectivity-monitor', + 'com.ios.libgoogleadmobads': 'cordova-libgoogleadmobads', + 'com.google.play.services': 'cordova-google-play-services', + 'android.support.v13': 'cordova-android-support-v13', + 'android.support.v4': 'cordova-android-support-v4', + 'com.analytics.google': 'cordova-plugin-analytics', + 'com.analytics.adid.google': 'cordova-plugin-analytics-adid', + 'com.chariotsolutions.nfc.plugin': 'phonegap-nfc', + 'com.samz.mixpanel': 'cordova-plugin-mixpanel' +} + +module.exports.oldToNew = map; + +var reverseMap = {}; +Object.keys(map).forEach(function(elem){ + reverseMap[map[elem]] = elem; +}) + +module.exports.newToOld = reverseMap; http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/.bin/tape ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/.bin/tape b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/.bin/tape new file mode 100644 index 0000000..dc4bc23 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/.bin/tape @@ -0,0 +1 @@ +../tape/bin/tape \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.npmignore ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.npmignore b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.npmignore new file mode 100644 index 0000000..07e6e47 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.npmignore @@ -0,0 +1 @@ +/node_modules http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.travis.yml ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.travis.yml b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.travis.yml new file mode 100644 index 0000000..cc4dba2 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/LICENSE ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/LICENSE b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/bin/tape ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/bin/tape b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/bin/tape new file mode 100644 index 0000000..500f1b1 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/bin/tape @@ -0,0 +1,14 @@ +#!/usr/bin/env node + +var path = require('path'); +var glob = require('glob'); + +process.argv.slice(2).forEach(function (arg) { + glob(arg, function (err, files) { + files.forEach(function (file) { + require(path.resolve(process.cwd(), file)); + }); + }); +}); + +// vim: ft=javascript http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/array.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/array.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/array.js new file mode 100644 index 0000000..d36857d --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/array.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/fail.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/fail.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/fail.js new file mode 100644 index 0000000..a7bf444 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/fail.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); + } + ); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested.js new file mode 100644 index 0000000..0e233d3 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested.js @@ -0,0 +1,51 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('nested array test', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true, 'inside ok'); + + setTimeout(function () { + q.ok(true, 'inside delayed'); + }, 3000); + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); + +test('another', function (t) { + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 100); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested_fail.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested_fail.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested_fail.js new file mode 100644 index 0000000..3ab5cb3 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/nested_fail.js @@ -0,0 +1,51 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('nested array test', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true); + + setTimeout(function () { + q.equal(3, 4); + }, 3000); + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); + +test('another', function (t) { + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 100); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/not_enough.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/not_enough.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/not_enough.js new file mode 100644 index 0000000..13b682b --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/not_enough.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(8); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/build.sh ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/build.sh b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/build.sh new file mode 100644 index 0000000..c583640 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +browserify ../timing.js -o bundle.js http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/index.html ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/index.html b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/index.html new file mode 100644 index 0000000..45ccf07 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/index.html @@ -0,0 +1,21 @@ +<!doctype html> +<html> +<head> +<style> +body { + font-family: monospace; + white-space: pre; +} +</style> +</head> +<body> +<script> +if (typeof console === 'undefined') console = {}; +console.log = function (msg) { + var txt = document.createTextNode(msg); + document.body.appendChild(txt); +}; +</script> +<script src="bundle.js"></script> +</body> +</html> http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/server.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/server.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/server.js new file mode 100644 index 0000000..80cea43 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/static/server.js @@ -0,0 +1,4 @@ +var http = require('http'); +var ecstatic = require('ecstatic')(__dirname); +var server = http.createServer(ecstatic); +server.listen(8000); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/object.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/object.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/object.js new file mode 100644 index 0000000..8f77f0f --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/object.js @@ -0,0 +1,10 @@ +var test = require('../../'); +var path = require('path'); + +test.createStream({ objectMode: true }).on('data', function (row) { + console.log(JSON.stringify(row)) +}); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/tap.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/tap.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/tap.js new file mode 100644 index 0000000..9ea9ff7 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/tap.js @@ -0,0 +1,8 @@ +var test = require('../../'); +var path = require('path'); + +test.createStream().pipe(process.stdout); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/x.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/x.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/x.js new file mode 100644 index 0000000..7dbb98a --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/x.js @@ -0,0 +1,5 @@ +var test = require('../../../'); +test(function (t) { + t.plan(1); + t.equal('beep', 'boop'); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/y.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/y.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/y.js new file mode 100644 index 0000000..28606d5 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/stream/test/y.js @@ -0,0 +1,11 @@ +var test = require('../../../'); +test(function (t) { + t.plan(2); + t.equal(1+1, 2); + t.ok(true); +}); + +test('wheee', function (t) { + t.ok(true); + t.end(); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/throw.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/throw.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/throw.js new file mode 100644 index 0000000..9a69ec0 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/throw.js @@ -0,0 +1,10 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('throw', function (t) { + t.plan(2); + + setTimeout(function () { + throw new Error('doom'); + }, 100); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/timing.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/timing.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/timing.js new file mode 100644 index 0000000..0268dc7 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/timing.js @@ -0,0 +1,12 @@ +var test = require('../'); + +test('timing test', function (t) { + t.plan(2); + + t.equal(typeof Date.now, 'function'); + var start = new Date; + + setTimeout(function () { + t.equal(new Date - start, 100); + }, 100); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/too_many.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/too_many.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/too_many.js new file mode 100644 index 0000000..ee285fb --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/too_many.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(3); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/two.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/two.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/two.js new file mode 100644 index 0000000..78e49c3 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/example/two.js @@ -0,0 +1,18 @@ +var test = require('../'); + +test('one', function (t) { + t.plan(2); + t.ok(true); + setTimeout(function () { + t.equal(1+3, 4); + }, 100); +}); + +test('two', function (t) { + t.plan(3); + t.equal(5, 2+3); + setTimeout(function () { + t.equal('a'.charCodeAt(0), 97); + t.ok(true); + }, 50); +}); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/index.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/index.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/index.js new file mode 100644 index 0000000..a44daf9 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/index.js @@ -0,0 +1,140 @@ +var defined = require('defined'); +var createDefaultStream = require('./lib/default_stream'); +var Test = require('./lib/test'); +var createResult = require('./lib/results'); +var through = require('through'); + +var canEmitExit = typeof process !== 'undefined' && process + && typeof process.on === 'function' && process.browser !== true +; +var canExit = typeof process !== 'undefined' && process + && typeof process.exit === 'function' +; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +exports = module.exports = (function () { + var harness; + var lazyLoad = function () { + return getHarness().apply(this, arguments); + }; + + lazyLoad.only = function () { + return getHarness().only.apply(this, arguments); + }; + + lazyLoad.createStream = function (opts) { + if (!opts) opts = {}; + if (!harness) { + var output = through(); + getHarness({ stream: output, objectMode: opts.objectMode }); + return output; + } + return harness.createStream(opts); + }; + + return lazyLoad + + function getHarness (opts) { + if (!opts) opts = {}; + opts.autoclose = !canEmitExit; + if (!harness) harness = createExitHarness(opts); + return harness; + } +})(); + +function createExitHarness (conf) { + if (!conf) conf = {}; + var harness = createHarness({ + autoclose: defined(conf.autoclose, false) + }); + + var stream = harness.createStream({ objectMode: conf.objectMode }); + var es = stream.pipe(conf.stream || createDefaultStream()); + if (canEmitExit) { + es.on('error', function (err) { harness._exitCode = 1 }); + } + + var ended = false; + stream.on('end', function () { ended = true }); + + if (conf.exit === false) return harness; + if (!canEmitExit || !canExit) return harness; + + var inErrorState = false; + + process.on('exit', function (code) { + // let the process exit cleanly. + if (code !== 0) { + return + } + + if (!ended) { + var only = harness._results._only; + for (var i = 0; i < harness._tests.length; i++) { + var t = harness._tests[i]; + if (only && t.name !== only) continue; + t._exit(); + } + } + harness.close(); + process.exit(code || harness._exitCode); + }); + + return harness; +} + +exports.createHarness = createHarness; +exports.Test = Test; +exports.test = exports; // tap compat +exports.test.skip = Test.skip; + +var exitInterval; + +function createHarness (conf_) { + if (!conf_) conf_ = {}; + var results = createResult(); + if (conf_.autoclose !== false) { + results.once('done', function () { results.close() }); + } + + var test = function (name, conf, cb) { + var t = new Test(name, conf, cb); + test._tests.push(t); + + (function inspectCode (st) { + st.on('test', function sub (st_) { + inspectCode(st_); + }); + st.on('result', function (r) { + if (!r.ok) test._exitCode = 1 + }); + })(t); + + results.push(t); + return t; + }; + test._results = results; + + test._tests = []; + + test.createStream = function (opts) { + return results.createStream(opts); + }; + + var only = false; + test.only = function (name) { + if (only) throw new Error('there can only be one only test'); + results.only(name); + only = true; + return test.apply(null, arguments); + }; + test._exitCode = 0; + + test.close = function () { results.close() }; + + return test; +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/default_stream.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/default_stream.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/default_stream.js new file mode 100644 index 0000000..c8e9918 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/default_stream.js @@ -0,0 +1,31 @@ +var through = require('through'); +var fs = require('fs'); + +module.exports = function () { + var line = ''; + var stream = through(write, flush); + return stream; + + function write (buf) { + for (var i = 0; i < buf.length; i++) { + var c = typeof buf === 'string' + ? buf.charAt(i) + : String.fromCharCode(buf[i]) + ; + if (c === '\n') flush(); + else line += c; + } + } + + function flush () { + if (fs.writeSync && /^win/.test(process.platform)) { + try { fs.writeSync(1, line + '\n'); } + catch (e) { stream.emit('error', e) } + } + else { + try { console.log(line) } + catch (e) { stream.emit('error', e) } + } + line = ''; + } +}; http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/results.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/results.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/results.js new file mode 100644 index 0000000..fa414f4 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/results.js @@ -0,0 +1,189 @@ +var EventEmitter = require('events').EventEmitter; +var inherits = require('inherits'); +var through = require('through'); +var resumer = require('resumer'); +var inspect = require('object-inspect'); +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +module.exports = Results; +inherits(Results, EventEmitter); + +function Results () { + if (!(this instanceof Results)) return new Results; + this.count = 0; + this.fail = 0; + this.pass = 0; + this._stream = through(); + this.tests = []; +} + +Results.prototype.createStream = function (opts) { + if (!opts) opts = {}; + var self = this; + var output, testId = 0; + if (opts.objectMode) { + output = through(); + self.on('_push', function ontest (t, extra) { + if (!extra) extra = {}; + var id = testId++; + t.once('prerun', function () { + var row = { + type: 'test', + name: t.name, + id: id + }; + if (has(extra, 'parent')) { + row.parent = extra.parent; + } + output.queue(row); + }); + t.on('test', function (st) { + ontest(st, { parent: id }); + }); + t.on('result', function (res) { + res.test = id; + res.type = 'assert'; + output.queue(res); + }); + t.on('end', function () { + output.queue({ type: 'end', test: id }); + }); + }); + self.on('done', function () { output.queue(null) }); + } + else { + output = resumer(); + output.queue('TAP version 13\n'); + self._stream.pipe(output); + } + + nextTick(function next() { + var t; + while (t = getNextTest(self)) { + t.run(); + if (!t.ended) return t.once('end', function(){ nextTick(next); }); + } + self.emit('done'); + }); + + return output; +}; + +Results.prototype.push = function (t) { + var self = this; + self.tests.push(t); + self._watch(t); + self.emit('_push', t); +}; + +Results.prototype.only = function (name) { + if (this._only) { + self.count ++; + self.fail ++; + write('not ok ' + self.count + ' already called .only()\n'); + } + this._only = name; +}; + +Results.prototype._watch = function (t) { + var self = this; + var write = function (s) { self._stream.queue(s) }; + t.once('prerun', function () { + write('# ' + t.name + '\n'); + }); + + t.on('result', function (res) { + if (typeof res === 'string') { + write('# ' + res + '\n'); + return; + } + write(encodeResult(res, self.count + 1)); + self.count ++; + + if (res.ok) self.pass ++ + else self.fail ++ + }); + + t.on('test', function (st) { self._watch(st) }); +}; + +Results.prototype.close = function () { + var self = this; + if (self.closed) self._stream.emit('error', new Error('ALREADY CLOSED')); + self.closed = true; + var write = function (s) { self._stream.queue(s) }; + + write('\n1..' + self.count + '\n'); + write('# tests ' + self.count + '\n'); + write('# pass ' + self.pass + '\n'); + if (self.fail) write('# fail ' + self.fail + '\n') + else write('\n# ok\n') + + self._stream.queue(null); +}; + +function encodeResult (res, count) { + var output = ''; + output += (res.ok ? 'ok ' : 'not ok ') + count; + output += res.name ? ' ' + res.name.toString().replace(/\s+/g, ' ') : ''; + + if (res.skip) output += ' # SKIP'; + else if (res.todo) output += ' # TODO'; + + output += '\n'; + if (res.ok) return output; + + var outer = ' '; + var inner = outer + ' '; + output += outer + '---\n'; + output += inner + 'operator: ' + res.operator + '\n'; + + if (has(res, 'expected') || has(res, 'actual')) { + var ex = inspect(res.expected); + var ac = inspect(res.actual); + + if (Math.max(ex.length, ac.length) > 65) { + output += inner + 'expected:\n' + inner + ' ' + ex + '\n'; + output += inner + 'actual:\n' + inner + ' ' + ac + '\n'; + } + else { + output += inner + 'expected: ' + ex + '\n'; + output += inner + 'actual: ' + ac + '\n'; + } + } + if (res.at) { + output += inner + 'at: ' + res.at + '\n'; + } + if (res.operator === 'error' && res.actual && res.actual.stack) { + var lines = String(res.actual.stack).split('\n'); + output += inner + 'stack:\n'; + output += inner + ' ' + lines[0] + '\n'; + for (var i = 1; i < lines.length; i++) { + output += inner + lines[i] + '\n'; + } + } + + output += outer + '...\n'; + return output; +} + +function getNextTest (results) { + if (!results._only) { + return results.tests.shift(); + } + + do { + var t = results.tests.shift(); + if (!t) continue; + if (results._only === t.name) { + return t; + } + } while (results.tests.length !== 0) +} + +function has (obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/test.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/test.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/test.js new file mode 100644 index 0000000..b9d6111 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/lib/test.js @@ -0,0 +1,496 @@ +var deepEqual = require('deep-equal'); +var defined = require('defined'); +var path = require('path'); +var inherits = require('inherits'); +var EventEmitter = require('events').EventEmitter; + +module.exports = Test; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +inherits(Test, EventEmitter); + +var getTestArgs = function (name_, opts_, cb_) { + var name = '(anonymous)'; + var opts = {}; + var cb; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + var t = typeof arg; + if (t === 'string') { + name = arg; + } + else if (t === 'object') { + opts = arg || opts; + } + else if (t === 'function') { + cb = arg; + } + } + return { name: name, opts: opts, cb: cb }; +}; + +function Test (name_, opts_, cb_) { + if (! (this instanceof Test)) { + return new Test(name_, opts_, cb_); + } + + var args = getTestArgs(name_, opts_, cb_); + + this.readable = true; + this.name = args.name || '(anonymous)'; + this.assertCount = 0; + this.pendingCount = 0; + this._skip = args.opts.skip || false; + this._plan = undefined; + this._cb = args.cb; + this._progeny = []; + this._ok = true; + + if (args.opts.timeout !== undefined) { + this.timeoutAfter(args.opts.timeout); + } + + for (var prop in this) { + this[prop] = (function bind(self, val) { + if (typeof val === 'function') { + return function bound() { + return val.apply(self, arguments); + }; + } + else return val; + })(this, this[prop]); + } +} + +Test.prototype.run = function () { + if (!this._cb || this._skip) { + return this._end(); + } + this.emit('prerun'); + this._cb(this); + this.emit('run'); +}; + +Test.prototype.test = function (name, opts, cb) { + var self = this; + var t = new Test(name, opts, cb); + this._progeny.push(t); + this.pendingCount++; + this.emit('test', t); + t.on('prerun', function () { + self.assertCount++; + }) + + if (!self._pendingAsserts()) { + nextTick(function () { + self._end(); + }); + } + + nextTick(function() { + if (!self._plan && self.pendingCount == self._progeny.length) { + self._end(); + } + }); +}; + +Test.prototype.comment = function (msg) { + this.emit('result', msg.trim().replace(/^#\s*/, '')); +}; + +Test.prototype.plan = function (n) { + this._plan = n; + this.emit('plan', n); +}; + +Test.prototype.timeoutAfter = function(ms) { + if (!ms) throw new Error('timeoutAfter requires a timespan'); + var self = this; + var timeout = setTimeout(function() { + self.fail('test timed out after ' + ms + 'ms'); + self.end(); + }, ms); + this.once('end', function() { + clearTimeout(timeout); + }); +} + +Test.prototype.end = function (err) { + var self = this; + if (arguments.length >= 1) { + this.ifError(err); + } + + if (this.calledEnd) { + this.fail('.end() called twice'); + } + this.calledEnd = true; + this._end(); +}; + +Test.prototype._end = function (err) { + var self = this; + if (this._progeny.length) { + var t = this._progeny.shift(); + t.on('end', function () { self._end() }); + t.run(); + return; + } + + if (!this.ended) this.emit('end'); + var pendingAsserts = this._pendingAsserts(); + if (!this._planError && this._plan !== undefined && pendingAsserts) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount + }); + } + this.ended = true; +}; + +Test.prototype._exit = function () { + if (this._plan !== undefined && + !this._planError && this.assertCount !== this._plan) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount, + exiting : true + }); + } + else if (!this.ended) { + this.fail('test exited without ending', { + exiting: true + }); + } +}; + +Test.prototype._pendingAsserts = function () { + if (this._plan === undefined) { + return 1; + } + else { + return this._plan - (this._progeny.length + this.assertCount); + } +}; + +Test.prototype._assert = function assert (ok, opts) { + var self = this; + var extra = opts.extra || {}; + + var res = { + id : self.assertCount ++, + ok : Boolean(ok), + skip : defined(extra.skip, opts.skip), + name : defined(extra.message, opts.message, '(unnamed assert)'), + operator : defined(extra.operator, opts.operator) + }; + if (has(opts, 'actual') || has(extra, 'actual')) { + res.actual = defined(extra.actual, opts.actual); + } + if (has(opts, 'expected') || has(extra, 'expected')) { + res.expected = defined(extra.expected, opts.expected); + } + this._ok = Boolean(this._ok && ok); + + if (!ok) { + res.error = defined(extra.error, opts.error, new Error(res.name)); + } + + if (!ok) { + var e = new Error('exception'); + var err = (e.stack || '').split('\n'); + var dir = path.dirname(__dirname) + '/'; + + for (var i = 0; i < err.length; i++) { + var m = /^[^\s]*\s*\bat\s+(.+)/.exec(err[i]); + if (!m) { + continue; + } + + var s = m[1].split(/\s+/); + var filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[1]); + if (!filem) { + filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[2]); + + if (!filem) { + filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[3]); + + if (!filem) { + continue; + } + } + } + + if (filem[1].slice(0, dir.length) === dir) { + continue; + } + + res.functionName = s[0]; + res.file = filem[1]; + res.line = Number(filem[2]); + if (filem[3]) res.column = filem[3]; + + res.at = m[1]; + break; + } + } + + self.emit('result', res); + + var pendingAsserts = self._pendingAsserts(); + if (!pendingAsserts) { + if (extra.exiting) { + self._end(); + } else { + nextTick(function () { + self._end(); + }); + } + } + + if (!self._planError && pendingAsserts < 0) { + self._planError = true; + self.fail('plan != count', { + expected : self._plan, + actual : self._plan - pendingAsserts + }); + } +}; + +Test.prototype.fail = function (msg, extra) { + this._assert(false, { + message : msg, + operator : 'fail', + extra : extra + }); +}; + +Test.prototype.pass = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'pass', + extra : extra + }); +}; + +Test.prototype.skip = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'skip', + skip : true, + extra : extra + }); +}; + +Test.prototype.ok += Test.prototype['true'] += Test.prototype.assert += function (value, msg, extra) { + this._assert(value, { + message : msg, + operator : 'ok', + expected : true, + actual : value, + extra : extra + }); +}; + +Test.prototype.notOk += Test.prototype['false'] += Test.prototype.notok += function (value, msg, extra) { + this._assert(!value, { + message : msg, + operator : 'notOk', + expected : false, + actual : value, + extra : extra + }); +}; + +Test.prototype.error += Test.prototype.ifError += Test.prototype.ifErr += Test.prototype.iferror += function (err, msg, extra) { + this._assert(!err, { + message : defined(msg, String(err)), + operator : 'error', + actual : err, + extra : extra + }); +}; + +Test.prototype.equal += Test.prototype.equals += Test.prototype.isEqual += Test.prototype.is += Test.prototype.strictEqual += Test.prototype.strictEquals += function (a, b, msg, extra) { + this._assert(a === b, { + message : defined(msg, 'should be equal'), + operator : 'equal', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notEqual += Test.prototype.notEquals += Test.prototype.notStrictEqual += Test.prototype.notStrictEquals += Test.prototype.isNotEqual += Test.prototype.isNot += Test.prototype.not += Test.prototype.doesNotEqual += Test.prototype.isInequal += function (a, b, msg, extra) { + this._assert(a !== b, { + message : defined(msg, 'should not be equal'), + operator : 'notEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.deepEqual += Test.prototype.deepEquals += Test.prototype.isEquivalent += Test.prototype.same += function (a, b, msg, extra) { + this._assert(deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should be equivalent'), + operator : 'deepEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.deepLooseEqual += Test.prototype.looseEqual += Test.prototype.looseEquals += function (a, b, msg, extra) { + this._assert(deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'deepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notDeepEqual += Test.prototype.notEquivalent += Test.prototype.notDeeply += Test.prototype.notSame += Test.prototype.isNotDeepEqual += Test.prototype.isNotDeeply += Test.prototype.isNotEquivalent += Test.prototype.isInequivalent += function (a, b, msg, extra) { + this._assert(!deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should not be equivalent'), + operator : 'notDeepEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.notDeepLooseEqual += Test.prototype.notLooseEqual += Test.prototype.notLooseEquals += function (a, b, msg, extra) { + this._assert(!deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'notDeepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype['throws'] = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + + var caught = undefined; + + try { + fn(); + } catch (err) { + caught = { error : err }; + var message = err.message; + delete err.message; + err.message = message; + } + + var passed = caught; + + if (expected instanceof RegExp) { + passed = expected.test(caught && caught.error); + expected = String(expected); + } + + if (typeof expected === 'function') { + passed = caught.error instanceof expected; + caught.error = caught.error.constructor; + } + + this._assert(passed, { + message : defined(msg, 'should throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error: !passed && caught && caught.error, + extra : extra + }); +}; + +Test.prototype.doesNotThrow = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + var caught = undefined; + try { + fn(); + } + catch (err) { + caught = { error : err }; + } + this._assert(!caught, { + message : defined(msg, 'should not throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error : caught && caught.error, + extra : extra + }); +}; + +function has (obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +Test.skip = function (name_, _opts, _cb) { + var args = getTestArgs.apply(null, arguments); + args.opts.skip = true; + return Test(args.name, args.opts, args.cb); +}; + +// vim: set softtabstop=4 shiftwidth=4: + http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/.travis.yml ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/.travis.yml b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/26cca47e/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/LICENSE ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/LICENSE b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/deep-equal/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
