mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-18 22:52:54 +08:00
Revert "Other minor dependencies updates in 7.1.x patch"
This reverts commit5a5f544a48
. Rationale: base64-js update in5a5f544
causes extra base64-js version to be installed under plist (node_modules/plist/node_modules/base64-js), which would need to be committed to satisfy the needs of the deprecated Node.js 4 version. The extra base64-js version in node_modules/plist/node_modules/base64-js was missed at the time5a5f544
was committed. The base64-js update in5a5f544
is now deemed as not wanted due to the extra base64-js version that would need to be committed. The other dependencies updates in5a5f544
may be nice to have but not considered necessary for the patch release. Reverting now to unblock the upcoming 7.1.4 patch release. Note that neither5a5f544
nor this revert will show up in the master branch.
This commit is contained in:
parent
b7643a3712
commit
84cb08b23e
10
node_modules/base64-js/README.md
generated
vendored
10
node_modules/base64-js/README.md
generated
vendored
@ -15,15 +15,13 @@ Sometimes encoding/decoding binary data in the browser is useful, and that is wh
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
`npm install base64-js` and `var base64js = require('base64-js')`
|
||||
|
||||
For use in web browsers do:
|
||||
|
||||
`<script src="base64js.min.js"></script>`
|
||||
`npm install base64-js`
|
||||
|
||||
## methods
|
||||
|
||||
`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||
`var base64 = require('base64-js')`
|
||||
|
||||
`base64` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||
|
||||
* `byteLength` - Takes a base64 string and returns length of byte array
|
||||
* `toByteArray` - Takes a base64 string and returns a byte array
|
||||
|
2
node_modules/base64-js/base64js.min.js
generated
vendored
2
node_modules/base64-js/base64js.min.js
generated
vendored
@ -1 +1 @@
|
||||
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function r(e,n,t){function o(f,i){if(!n[f]){if(!e[f]){var u="function"==typeof require&&require;if(!i&&u)return u(f,!0);if(a)return a(f,!0);var v=new Error("Cannot find module '"+f+"'");throw v.code="MODULE_NOT_FOUND",v}var d=n[f]={exports:{}};e[f][0].call(d.exports,function(r){var n=e[f][1][r];return o(n||r)},d,d.exports,r,e,n,t)}return n[f].exports}for(var a="function"==typeof require&&require,f=0;f<t.length;f++)o(t[f]);return o}return r}()({"/":[function(r,e,n){"use strict";n.byteLength=d;n.toByteArray=h;n.fromByteArray=p;var t=[];var o=[];var a=typeof Uint8Array!=="undefined"?Uint8Array:Array;var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,u=f.length;i<u;++i){t[i]=f[i];o[f.charCodeAt(i)]=i}o["-".charCodeAt(0)]=62;o["_".charCodeAt(0)]=63;function v(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function d(r){var e=v(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function c(r,e,n){return(e+n)*3/4-n}function h(r){var e;var n=v(r);var t=n[0];var f=n[1];var i=new a(c(r,t,f));var u=0;var d=f>0?t-4:t;for(var h=0;h<d;h+=4){e=o[r.charCodeAt(h)]<<18|o[r.charCodeAt(h+1)]<<12|o[r.charCodeAt(h+2)]<<6|o[r.charCodeAt(h+3)];i[u++]=e>>16&255;i[u++]=e>>8&255;i[u++]=e&255}if(f===2){e=o[r.charCodeAt(h)]<<2|o[r.charCodeAt(h+1)]>>4;i[u++]=e&255}if(f===1){e=o[r.charCodeAt(h)]<<10|o[r.charCodeAt(h+1)]<<4|o[r.charCodeAt(h+2)]>>2;i[u++]=e>>8&255;i[u++]=e&255}return i}function s(r){return t[r>>18&63]+t[r>>12&63]+t[r>>6&63]+t[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;a<n;a+=3){t=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255);o.push(s(t))}return o.join("")}function p(r){var e;var n=r.length;var o=n%3;var a=[];var f=16383;for(var i=0,u=n-o;i<u;i+=f){a.push(l(r,i,i+f>u?u:i+f))}if(o===1){e=r[n-1];a.push(t[e>>2]+t[e<<4&63]+"==")}else if(o===2){e=(r[n-2]<<8)+r[n-1];a.push(t[e>>10]+t[e>>4&63]+t[e<<2&63]+"=")}return a.join("")}},{}]},{},[])("/")});
|
||||
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,t;return function r(e,t,n){function o(i,a){if(!t[i]){if(!e[i]){var u=typeof require=="function"&&require;if(!a&&u)return u(i,!0);if(f)return f(i,!0);var d=new Error("Cannot find module '"+i+"'");throw d.code="MODULE_NOT_FOUND",d}var c=t[i]={exports:{}};e[i][0].call(c.exports,function(r){var t=e[i][1][r];return o(t?t:r)},c,c.exports,r,e,t,n)}return t[i].exports}var f=typeof require=="function"&&require;for(var i=0;i<n.length;i++)o(n[i]);return o}({"/":[function(r,e,t){"use strict";t.byteLength=c;t.toByteArray=v;t.fromByteArray=s;var n=[];var o=[];var f=typeof Uint8Array!=="undefined"?Uint8Array:Array;var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var a=0,u=i.length;a<u;++a){n[a]=i[a];o[i.charCodeAt(a)]=a}o["-".charCodeAt(0)]=62;o["_".charCodeAt(0)]=63;function d(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return r[e-2]==="="?2:r[e-1]==="="?1:0}function c(r){return r.length*3/4-d(r)}function v(r){var e,t,n,i,a,u;var c=r.length;a=d(r);u=new f(c*3/4-a);n=a>0?c-4:c;var v=0;for(e=0,t=0;e<n;e+=4,t+=3){i=o[r.charCodeAt(e)]<<18|o[r.charCodeAt(e+1)]<<12|o[r.charCodeAt(e+2)]<<6|o[r.charCodeAt(e+3)];u[v++]=i>>16&255;u[v++]=i>>8&255;u[v++]=i&255}if(a===2){i=o[r.charCodeAt(e)]<<2|o[r.charCodeAt(e+1)]>>4;u[v++]=i&255}else if(a===1){i=o[r.charCodeAt(e)]<<10|o[r.charCodeAt(e+1)]<<4|o[r.charCodeAt(e+2)]>>2;u[v++]=i>>8&255;u[v++]=i&255}return u}function l(r){return n[r>>18&63]+n[r>>12&63]+n[r>>6&63]+n[r&63]}function h(r,e,t){var n;var o=[];for(var f=e;f<t;f+=3){n=(r[f]<<16)+(r[f+1]<<8)+r[f+2];o.push(l(n))}return o.join("")}function s(r){var e;var t=r.length;var o=t%3;var f="";var i=[];var a=16383;for(var u=0,d=t-o;u<d;u+=a){i.push(h(r,u,u+a>d?d:u+a))}if(o===1){e=r[t-1];f+=n[e>>2];f+=n[e<<4&63];f+="=="}else if(o===2){e=(r[t-2]<<8)+r[t-1];f+=n[e>>10];f+=n[e>>4&63];f+=n[e<<2&63];f+="="}i.push(f);return i.join("")}},{}]},{},[])("/")});
|
||||
|
121
node_modules/base64-js/index.js
generated
vendored
121
node_modules/base64-js/index.js
generated
vendored
@ -14,102 +14,68 @@ for (var i = 0, len = code.length; i < len; ++i) {
|
||||
revLookup[code.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
revLookup['-'.charCodeAt(0)] = 62
|
||||
revLookup['_'.charCodeAt(0)] = 63
|
||||
|
||||
function getLens (b64) {
|
||||
function placeHoldersCount (b64) {
|
||||
var len = b64.length
|
||||
|
||||
if (len % 4 > 0) {
|
||||
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||
}
|
||||
|
||||
// Trim off extra bytes after placeholder bytes are found
|
||||
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||
var validLen = b64.indexOf('=')
|
||||
if (validLen === -1) validLen = len
|
||||
|
||||
var placeHoldersLen = validLen === len
|
||||
? 0
|
||||
: 4 - (validLen % 4)
|
||||
|
||||
return [validLen, placeHoldersLen]
|
||||
// the number of equal signs (place holders)
|
||||
// if there are two placeholders, than the two characters before it
|
||||
// represent one byte
|
||||
// if there is only one, then the three characters before it represent 2 bytes
|
||||
// this is just a cheap hack to not do indexOf twice
|
||||
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
|
||||
}
|
||||
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
function byteLength (b64) {
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function _byteLength (b64, validLen, placeHoldersLen) {
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
return b64.length * 3 / 4 - placeHoldersCount(b64)
|
||||
}
|
||||
|
||||
function toByteArray (b64) {
|
||||
var tmp
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
var i, j, l, tmp, placeHolders, arr
|
||||
var len = b64.length
|
||||
placeHolders = placeHoldersCount(b64)
|
||||
|
||||
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
||||
|
||||
var curByte = 0
|
||||
arr = new Arr(len * 3 / 4 - placeHolders)
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
var len = placeHoldersLen > 0
|
||||
? validLen - 4
|
||||
: validLen
|
||||
l = placeHolders > 0 ? len - 4 : len
|
||||
|
||||
for (var i = 0; i < len; i += 4) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||
revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[curByte++] = (tmp >> 16) & 0xFF
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
var L = 0
|
||||
|
||||
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[L++] = (tmp >> 16) & 0xFF
|
||||
arr[L++] = (tmp >> 8) & 0xFF
|
||||
arr[L++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 2) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 1) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
if (placeHolders === 2) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[L++] = tmp & 0xFF
|
||||
} else if (placeHolders === 1) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[L++] = (tmp >> 8) & 0xFF
|
||||
arr[L++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
function tripletToBase64 (num) {
|
||||
return lookup[num >> 18 & 0x3F] +
|
||||
lookup[num >> 12 & 0x3F] +
|
||||
lookup[num >> 6 & 0x3F] +
|
||||
lookup[num & 0x3F]
|
||||
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
||||
}
|
||||
|
||||
function encodeChunk (uint8, start, end) {
|
||||
var tmp
|
||||
var output = []
|
||||
for (var i = start; i < end; i += 3) {
|
||||
tmp =
|
||||
((uint8[i] << 16) & 0xFF0000) +
|
||||
((uint8[i + 1] << 8) & 0xFF00) +
|
||||
(uint8[i + 2] & 0xFF)
|
||||
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
||||
output.push(tripletToBase64(tmp))
|
||||
}
|
||||
return output.join('')
|
||||
@ -119,33 +85,30 @@ function fromByteArray (uint8) {
|
||||
var tmp
|
||||
var len = uint8.length
|
||||
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||
var output = ''
|
||||
var parts = []
|
||||
var maxChunkLength = 16383 // must be multiple of 3
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||
parts.push(encodeChunk(
|
||||
uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
|
||||
))
|
||||
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
if (extraBytes === 1) {
|
||||
tmp = uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 2] +
|
||||
lookup[(tmp << 4) & 0x3F] +
|
||||
'=='
|
||||
)
|
||||
output += lookup[tmp >> 2]
|
||||
output += lookup[(tmp << 4) & 0x3F]
|
||||
output += '=='
|
||||
} else if (extraBytes === 2) {
|
||||
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 10] +
|
||||
lookup[(tmp >> 4) & 0x3F] +
|
||||
lookup[(tmp << 2) & 0x3F] +
|
||||
'='
|
||||
)
|
||||
tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
|
||||
output += lookup[tmp >> 10]
|
||||
output += lookup[(tmp >> 4) & 0x3F]
|
||||
output += lookup[(tmp << 2) & 0x3F]
|
||||
output += '='
|
||||
}
|
||||
|
||||
parts.push(output)
|
||||
|
||||
return parts.join('')
|
||||
}
|
||||
|
33
node_modules/base64-js/package.json
generated
vendored
33
node_modules/base64-js/package.json
generated
vendored
@ -1,28 +1,27 @@
|
||||
{
|
||||
"_from": "base64-js@1",
|
||||
"_id": "base64-js@1.3.0",
|
||||
"_from": "base64-js@1.2.0",
|
||||
"_id": "base64-js@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==",
|
||||
"_integrity": "sha1-o5mS1yNYSBGYK+XikLtqU9hnAPE=",
|
||||
"_location": "/base64-js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "base64-js@1",
|
||||
"raw": "base64-js@1.2.0",
|
||||
"name": "base64-js",
|
||||
"escapedName": "base64-js",
|
||||
"rawSpec": "1",
|
||||
"rawSpec": "1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1"
|
||||
"fetchSpec": "1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
"/plist"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
||||
"_shasum": "cab1e6118f051095e58b5281aea8c1cd22bfc0e3",
|
||||
"_spec": "base64-js@1",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android",
|
||||
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.0.tgz",
|
||||
"_shasum": "a39992d723584811982be5e290bb6a53d86700f1",
|
||||
"_spec": "base64-js@1.2.0",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/plist",
|
||||
"author": {
|
||||
"name": "T. Jameson Little",
|
||||
"email": "t.jameson.little@gmail.com"
|
||||
@ -34,11 +33,11 @@
|
||||
"deprecated": false,
|
||||
"description": "Base64 encoding/decoding in pure JS",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"browserify": "^14.0.0",
|
||||
"benchmark": "^2.1.0",
|
||||
"browserify": "^13.0.0",
|
||||
"standard": "*",
|
||||
"tape": "4.x",
|
||||
"uglify-js": "^2.8.29"
|
||||
"uglify-js": "^2.6.2"
|
||||
},
|
||||
"files": [
|
||||
"test",
|
||||
@ -62,5 +61,5 @@
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "tape test/*.js"
|
||||
},
|
||||
"version": "1.3.0"
|
||||
"version": "1.2.0"
|
||||
}
|
||||
|
1
node_modules/base64-js/test/big-data.js
generated
vendored
1
node_modules/base64-js/test/big-data.js
generated
vendored
@ -10,7 +10,6 @@ test('convert big data to base64', function (t) {
|
||||
b64str = b64.fromByteArray(big)
|
||||
arr = b64.toByteArray(b64str)
|
||||
t.ok(equal(arr, big))
|
||||
t.equal(b64.byteLength(b64str), arr.length)
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
40
node_modules/base64-js/test/convert.js
generated
vendored
40
node_modules/base64-js/test/convert.js
generated
vendored
@ -29,46 +29,6 @@ test('convert to base64 and back', function (t) {
|
||||
}
|
||||
})
|
||||
|
||||
var data = [
|
||||
[[0, 0, 0], 'AAAA'],
|
||||
[[0, 0, 1], 'AAAB'],
|
||||
[[0, 1, -1], 'AAH/'],
|
||||
[[1, 1, 1], 'AQEB'],
|
||||
[[0, -73, 23], 'ALcX']
|
||||
]
|
||||
|
||||
test('convert known data to string', function (t) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var bytes = data[i][0]
|
||||
var expected = data[i][1]
|
||||
var actual = b64.fromByteArray(bytes)
|
||||
t.equal(actual, expected, 'Ensure that ' + bytes + ' serialise to ' + expected)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('convert known data from string', function (t) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var expected = data[i][0]
|
||||
var string = data[i][1]
|
||||
var actual = b64.toByteArray(string)
|
||||
t.ok(equal(actual, expected), 'Ensure that ' + string + ' deserialise to ' + expected)
|
||||
var length = b64.byteLength(string)
|
||||
t.equal(length, expected.length, 'Ensure that ' + string + ' has byte lentgh of ' + expected.length)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
function equal (a, b) {
|
||||
var i
|
||||
var length = a.length
|
||||
if (length !== b.length) return false
|
||||
for (i = 0; i < length; ++i) {
|
||||
if ((a[i] & 0xFF) !== (b[i] & 0xFF)) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function map (arr, callback) {
|
||||
var res = []
|
||||
var kValue, mappedValue
|
||||
|
10
node_modules/base64-js/test/corrupt.js
generated
vendored
10
node_modules/base64-js/test/corrupt.js
generated
vendored
@ -1,10 +0,0 @@
|
||||
var test = require('tape')
|
||||
var b64 = require('../')
|
||||
|
||||
test('padding bytes found inside base64 string', function (t) {
|
||||
// See https://github.com/beatgammit/base64-js/issues/42
|
||||
var str = 'SQ==QU0='
|
||||
t.deepEqual(b64.toByteArray(str), new Uint8Array([73]))
|
||||
t.equal(b64.byteLength(str), 1)
|
||||
t.end()
|
||||
})
|
10
node_modules/base64-js/test/url-safe.js
generated
vendored
10
node_modules/base64-js/test/url-safe.js
generated
vendored
@ -4,21 +4,15 @@ var b64 = require('../')
|
||||
test('decode url-safe style base64 strings', function (t) {
|
||||
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]
|
||||
|
||||
var str = '//++/++/++//'
|
||||
var actual = b64.toByteArray(str)
|
||||
var actual = b64.toByteArray('//++/++/++//')
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.equal(b64.byteLength(str), actual.length)
|
||||
|
||||
str = '__--_--_--__'
|
||||
actual = b64.toByteArray(str)
|
||||
actual = b64.toByteArray('__--_--_--__')
|
||||
for (i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.equal(b64.byteLength(str), actual.length)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
59
node_modules/big-integer/BigInteger.js
generated
vendored
59
node_modules/big-integer/BigInteger.js
generated
vendored
@ -785,44 +785,29 @@ var bigInt = (function (undefined) {
|
||||
if (n.isUnit()) return false;
|
||||
if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
|
||||
if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
|
||||
if (n.lesser(49)) return true;
|
||||
if (n.lesser(25)) return true;
|
||||
// we don't know if it's prime: let the other functions figure it out
|
||||
}
|
||||
|
||||
function millerRabinTest(n, a) {
|
||||
var nPrev = n.prev(),
|
||||
b = nPrev,
|
||||
r = 0,
|
||||
d, t, i, x;
|
||||
while (b.isEven()) b = b.divide(2), r++;
|
||||
next : for (i = 0; i < a.length; i++) {
|
||||
if (n.lesser(a[i])) continue;
|
||||
x = bigInt(a[i]).modPow(b, n);
|
||||
if (x.equals(Integer[1]) || x.equals(nPrev)) continue;
|
||||
for (d = r - 1; d != 0; d--) {
|
||||
x = x.square().mod(n);
|
||||
if (x.isUnit()) return false;
|
||||
if (x.equals(nPrev)) continue next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2
|
||||
BigInteger.prototype.isPrime = function (strict) {
|
||||
|
||||
BigInteger.prototype.isPrime = function () {
|
||||
var isPrime = isBasicPrime(this);
|
||||
if (isPrime !== undefined) return isPrime;
|
||||
var n = this.abs();
|
||||
var bits = n.bitLength();
|
||||
if(bits <= 64)
|
||||
return millerRabinTest(n, [2, 325, 9375, 28178, 450775, 9780504, 1795265022]);
|
||||
var logN = Math.log(2) * bits;
|
||||
var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);
|
||||
for (var a = [], i = 0; i < t; i++) {
|
||||
a.push(bigInt(i + 2));
|
||||
var n = this.abs(),
|
||||
nPrev = n.prev();
|
||||
var a = [2, 3, 5, 7, 11, 13, 17, 19],
|
||||
b = nPrev,
|
||||
d, t, i, x;
|
||||
while (b.isEven()) b = b.divide(2);
|
||||
for (i = 0; i < a.length; i++) {
|
||||
x = bigInt(a[i]).modPow(b, n);
|
||||
if (x.equals(Integer[1]) || x.equals(nPrev)) continue;
|
||||
for (t = true, d = b; t && d.lesser(nPrev); d = d.multiply(2)) {
|
||||
x = x.square().mod(n);
|
||||
if (x.equals(nPrev)) t = false;
|
||||
}
|
||||
if (t) return false;
|
||||
}
|
||||
return millerRabinTest(n, a);
|
||||
return true;
|
||||
};
|
||||
SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
|
||||
|
||||
@ -831,10 +816,12 @@ var bigInt = (function (undefined) {
|
||||
if (isPrime !== undefined) return isPrime;
|
||||
var n = this.abs();
|
||||
var t = iterations === undefined ? 5 : iterations;
|
||||
for (var a = [], i = 0; i < t; i++) {
|
||||
a.push(bigInt.randBetween(2, n.minus(2)));
|
||||
// use the Fermat primality test
|
||||
for (var i = 0; i < t; i++) {
|
||||
var a = bigInt.randBetween(2, n.minus(2));
|
||||
if (!a.modPow(n.prev(), n).isUnit()) return false; // definitely composite
|
||||
}
|
||||
return millerRabinTest(n, a);
|
||||
return true; // large chance of being prime
|
||||
};
|
||||
SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
|
||||
|
||||
|
2
node_modules/big-integer/BigInteger.min.js
generated
vendored
2
node_modules/big-integer/BigInteger.min.js
generated
vendored
File diff suppressed because one or more lines are too long
10
node_modules/big-integer/README.md
generated
vendored
10
node_modules/big-integer/README.md
generated
vendored
@ -219,15 +219,15 @@ Returns `true` if the number is prime, `false` otherwise.
|
||||
|
||||
Returns `true` if the number is very likely to be prime, `false` otherwise.
|
||||
Argument is optional and determines the amount of iterations of the test (default: `5`). The more iterations, the lower chance of getting a false positive.
|
||||
This uses the [Miller Rabin test](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test).
|
||||
This uses the [Fermat primality test](https://en.wikipedia.org/wiki/Fermat_primality_test).
|
||||
|
||||
- `bigInt(5).isProbablePrime()` => `true`
|
||||
- `bigInt(49).isProbablePrime()` => `false`
|
||||
- `bigInt(1729).isProbablePrime()` => `false`
|
||||
- `bigInt(1729).isProbablePrime(50)` => `false`
|
||||
|
||||
Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same.
|
||||
If the number is composite then the Miller–Rabin primality test declares the number probably prime with a probability at most `4` to the power `−iterations`.
|
||||
If the number is prime, this function always returns `true`.
|
||||
Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same. [Carmichael numbers](https://en.wikipedia.org/wiki/Carmichael_number) are particularly prone to give unreliable results.
|
||||
|
||||
For example, `bigInt(1729).isProbablePrime()` returns `false` about 76% of the time and `true` about 24% of the time. The correct result is `false`.
|
||||
|
||||
#### `isUnit()`
|
||||
|
||||
|
24
node_modules/big-integer/package.json
generated
vendored
24
node_modules/big-integer/package.json
generated
vendored
@ -1,29 +1,27 @@
|
||||
{
|
||||
"_from": "big-integer@1",
|
||||
"_id": "big-integer@1.6.36",
|
||||
"_from": "big-integer@^1.6.7",
|
||||
"_id": "big-integer@1.6.32",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==",
|
||||
"_integrity": "sha512-ljKJdR3wk9thHfLj4DtrNiOSTxvGFaMjWrG4pW75juXC4j7+XuKJVFdg4kgFMYp85PVkO05dFMj2dk2xVsH4xw==",
|
||||
"_location": "/big-integer",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "big-integer@1",
|
||||
"raw": "big-integer@^1.6.7",
|
||||
"name": "big-integer",
|
||||
"escapedName": "big-integer",
|
||||
"rawSpec": "1",
|
||||
"rawSpec": "^1.6.7",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1"
|
||||
"fetchSpec": "^1.6.7"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/bplist-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz",
|
||||
"_shasum": "78631076265d4ae3555c04f85e7d9d2f3a071a36",
|
||||
"_spec": "big-integer@1",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android",
|
||||
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.32.tgz",
|
||||
"_shasum": "5867458b25ecd5bcb36b627c30bb501a13c07e89",
|
||||
"_spec": "big-integer@^1.6.7",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/bplist-parser",
|
||||
"author": {
|
||||
"name": "Peter Olson",
|
||||
"email": "peter.e.c.olson+npm@gmail.com"
|
||||
@ -78,5 +76,5 @@
|
||||
"test": "tsc && karma start my.conf.js && node spec/tsDefinitions.js"
|
||||
},
|
||||
"typings": "./BigInteger.d.ts",
|
||||
"version": "1.6.36"
|
||||
"version": "1.6.32"
|
||||
}
|
||||
|
17
node_modules/path-is-absolute/package.json
generated
vendored
17
node_modules/path-is-absolute/package.json
generated
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"_from": "path-is-absolute@1",
|
||||
"_from": "path-is-absolute@^1.0.0",
|
||||
"_id": "path-is-absolute@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
@ -8,25 +8,24 @@
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "path-is-absolute@1",
|
||||
"raw": "path-is-absolute@^1.0.0",
|
||||
"name": "path-is-absolute",
|
||||
"escapedName": "path-is-absolute",
|
||||
"rawSpec": "1",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1"
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/eslint/glob",
|
||||
"/glob",
|
||||
"/globby/glob",
|
||||
"/jasmine/glob",
|
||||
"/rimraf/glob"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
|
||||
"_spec": "path-is-absolute@1",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android",
|
||||
"_spec": "path-is-absolute@^1.0.0",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/glob",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
23
node_modules/semver/README.md
generated
vendored
23
node_modules/semver/README.md
generated
vendored
@ -29,6 +29,8 @@ As a command-line utility:
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
SemVer 5.3.0
|
||||
|
||||
A JavaScript implementation of the http://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
@ -52,9 +54,6 @@ Options:
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
@ -275,7 +274,7 @@ logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
@ -290,19 +289,9 @@ part ::= nr | [-0-9A-Za-z]+
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
All methods and classes take a final `loose` boolean argument that, if
|
||||
true, will be more forgiving about not-quite-valid semver strings.
|
||||
The resulting output will always be 100% strict, of course.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
18
node_modules/semver/bin/semver
generated
vendored
18
node_modules/semver/bin/semver
generated
vendored
@ -12,12 +12,10 @@ var argv = process.argv.slice(2)
|
||||
, inc = null
|
||||
, version = require("../package.json").version
|
||||
, loose = false
|
||||
, includePrerelease = false
|
||||
, coerce = false
|
||||
, identifier = undefined
|
||||
, semver = require("../semver")
|
||||
, reverse = false
|
||||
, options = {}
|
||||
|
||||
main()
|
||||
|
||||
@ -37,9 +35,6 @@ function main () {
|
||||
case "-l": case "--loose":
|
||||
loose = true
|
||||
break
|
||||
case "-p": case "--include-prerelease":
|
||||
includePrerelease = true
|
||||
break
|
||||
case "-v": case "--version":
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
@ -71,8 +66,6 @@ function main () {
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v) || {version: v}).version : v
|
||||
}).filter(function (v) {
|
||||
@ -84,7 +77,7 @@ function main () {
|
||||
|
||||
for (var i = 0, l = range.length; i < l ; i ++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
return semver.satisfies(v, range[i], loose)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
@ -101,11 +94,11 @@ function fail () { process.exit(1) }
|
||||
function success () {
|
||||
var compare = reverse ? "rcompare" : "compare"
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, options)
|
||||
return semver[compare](a, b, loose)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, options)
|
||||
return semver.clean(v, loose)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
return inc ? semver.inc(v, inc, loose, identifier) : v
|
||||
}).forEach(function (v,i,_) { console.log(v) })
|
||||
}
|
||||
|
||||
@ -135,9 +128,6 @@ function help () {
|
||||
,"-l --loose"
|
||||
," Interpret versions and ranges loosely"
|
||||
,""
|
||||
,"-p --include-prerelease"
|
||||
," Always include prerelease versions in range matching"
|
||||
,""
|
||||
,"-c --coerce"
|
||||
," Coerce a string into SemVer if possible"
|
||||
," (does not imply --loose)"
|
||||
|
26
node_modules/semver/package.json
generated
vendored
26
node_modules/semver/package.json
generated
vendored
@ -1,30 +1,28 @@
|
||||
{
|
||||
"_from": "semver@5",
|
||||
"_id": "semver@5.6.0",
|
||||
"_from": "semver@^5.4.1",
|
||||
"_id": "semver@5.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==",
|
||||
"_integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
|
||||
"_location": "/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "semver@5",
|
||||
"raw": "semver@^5.4.1",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "5",
|
||||
"rawSpec": "^5.4.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5"
|
||||
"fetchSpec": "^5.4.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/android-versions",
|
||||
"/normalize-package-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
|
||||
"_shasum": "7e74256fbaa49c75aa7c7a205cc22799cac80004",
|
||||
"_spec": "semver@5",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android",
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
||||
"_shasum": "dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab",
|
||||
"_spec": "semver@^5.4.1",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/android-versions",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
@ -35,7 +33,7 @@
|
||||
"deprecated": false,
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^12.0.1"
|
||||
"tap": "^10.7.0"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
@ -53,5 +51,5 @@
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov -J"
|
||||
},
|
||||
"version": "5.6.0"
|
||||
"version": "5.5.0"
|
||||
}
|
||||
|
236
node_modules/semver/semver.js
generated
vendored
236
node_modules/semver/semver.js
generated
vendored
@ -245,10 +245,7 @@ for (var i = 0; i < R; i++) {
|
||||
}
|
||||
|
||||
exports.parse = parse;
|
||||
function parse(version, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
function parse(version, loose) {
|
||||
if (version instanceof SemVer)
|
||||
return version;
|
||||
|
||||
@ -258,37 +255,35 @@ function parse(version, options) {
|
||||
if (version.length > MAX_LENGTH)
|
||||
return null;
|
||||
|
||||
var r = options.loose ? re[LOOSE] : re[FULL];
|
||||
var r = loose ? re[LOOSE] : re[FULL];
|
||||
if (!r.test(version))
|
||||
return null;
|
||||
|
||||
try {
|
||||
return new SemVer(version, options);
|
||||
return new SemVer(version, loose);
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
exports.valid = valid;
|
||||
function valid(version, options) {
|
||||
var v = parse(version, options);
|
||||
function valid(version, loose) {
|
||||
var v = parse(version, loose);
|
||||
return v ? v.version : null;
|
||||
}
|
||||
|
||||
|
||||
exports.clean = clean;
|
||||
function clean(version, options) {
|
||||
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
|
||||
function clean(version, loose) {
|
||||
var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
|
||||
return s ? s.version : null;
|
||||
}
|
||||
|
||||
exports.SemVer = SemVer;
|
||||
|
||||
function SemVer(version, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
function SemVer(version, loose) {
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === options.loose)
|
||||
if (version.loose === loose)
|
||||
return version;
|
||||
else
|
||||
version = version.version;
|
||||
@ -300,13 +295,11 @@ function SemVer(version, options) {
|
||||
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
|
||||
|
||||
if (!(this instanceof SemVer))
|
||||
return new SemVer(version, options);
|
||||
return new SemVer(version, loose);
|
||||
|
||||
debug('SemVer', version, options);
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
|
||||
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
|
||||
debug('SemVer', version, loose);
|
||||
this.loose = loose;
|
||||
var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
|
||||
|
||||
if (!m)
|
||||
throw new TypeError('Invalid Version: ' + version);
|
||||
@ -356,16 +349,16 @@ SemVer.prototype.toString = function() {
|
||||
};
|
||||
|
||||
SemVer.prototype.compare = function(other) {
|
||||
debug('SemVer.compare', this.version, this.options, other);
|
||||
debug('SemVer.compare', this.version, this.loose, other);
|
||||
if (!(other instanceof SemVer))
|
||||
other = new SemVer(other, this.options);
|
||||
other = new SemVer(other, this.loose);
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other);
|
||||
};
|
||||
|
||||
SemVer.prototype.compareMain = function(other) {
|
||||
if (!(other instanceof SemVer))
|
||||
other = new SemVer(other, this.options);
|
||||
other = new SemVer(other, this.loose);
|
||||
|
||||
return compareIdentifiers(this.major, other.major) ||
|
||||
compareIdentifiers(this.minor, other.minor) ||
|
||||
@ -374,7 +367,7 @@ SemVer.prototype.compareMain = function(other) {
|
||||
|
||||
SemVer.prototype.comparePre = function(other) {
|
||||
if (!(other instanceof SemVer))
|
||||
other = new SemVer(other, this.options);
|
||||
other = new SemVer(other, this.loose);
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length)
|
||||
@ -665,23 +658,19 @@ function cmp(a, op, b, loose) {
|
||||
}
|
||||
|
||||
exports.Comparator = Comparator;
|
||||
function Comparator(comp, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
function Comparator(comp, loose) {
|
||||
if (comp instanceof Comparator) {
|
||||
if (comp.loose === !!options.loose)
|
||||
if (comp.loose === loose)
|
||||
return comp;
|
||||
else
|
||||
comp = comp.value;
|
||||
}
|
||||
|
||||
if (!(this instanceof Comparator))
|
||||
return new Comparator(comp, options);
|
||||
return new Comparator(comp, loose);
|
||||
|
||||
debug('comparator', comp, options);
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
debug('comparator', comp, loose);
|
||||
this.loose = loose;
|
||||
this.parse(comp);
|
||||
|
||||
if (this.semver === ANY)
|
||||
@ -694,7 +683,7 @@ function Comparator(comp, options) {
|
||||
|
||||
var ANY = {};
|
||||
Comparator.prototype.parse = function(comp) {
|
||||
var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
||||
var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
||||
var m = comp.match(r);
|
||||
|
||||
if (!m)
|
||||
@ -708,7 +697,7 @@ Comparator.prototype.parse = function(comp) {
|
||||
if (!m[2])
|
||||
this.semver = ANY;
|
||||
else
|
||||
this.semver = new SemVer(m[2], this.options.loose);
|
||||
this.semver = new SemVer(m[2], this.loose);
|
||||
};
|
||||
|
||||
Comparator.prototype.toString = function() {
|
||||
@ -716,33 +705,30 @@ Comparator.prototype.toString = function() {
|
||||
};
|
||||
|
||||
Comparator.prototype.test = function(version) {
|
||||
debug('Comparator.test', version, this.options.loose);
|
||||
debug('Comparator.test', version, this.loose);
|
||||
|
||||
if (this.semver === ANY)
|
||||
return true;
|
||||
|
||||
if (typeof version === 'string')
|
||||
version = new SemVer(version, this.options);
|
||||
version = new SemVer(version, this.loose);
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.options);
|
||||
return cmp(version, this.operator, this.semver, this.loose);
|
||||
};
|
||||
|
||||
Comparator.prototype.intersects = function(comp, options) {
|
||||
Comparator.prototype.intersects = function(comp, loose) {
|
||||
if (!(comp instanceof Comparator)) {
|
||||
throw new TypeError('a Comparator is required');
|
||||
}
|
||||
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
var rangeTmp;
|
||||
|
||||
if (this.operator === '') {
|
||||
rangeTmp = new Range(comp.value, options);
|
||||
return satisfies(this.value, rangeTmp, options);
|
||||
rangeTmp = new Range(comp.value, loose);
|
||||
return satisfies(this.value, rangeTmp, loose);
|
||||
} else if (comp.operator === '') {
|
||||
rangeTmp = new Range(this.value, options);
|
||||
return satisfies(comp.semver, rangeTmp, options);
|
||||
rangeTmp = new Range(this.value, loose);
|
||||
return satisfies(comp.semver, rangeTmp, loose);
|
||||
}
|
||||
|
||||
var sameDirectionIncreasing =
|
||||
@ -756,11 +742,11 @@ Comparator.prototype.intersects = function(comp, options) {
|
||||
(this.operator === '>=' || this.operator === '<=') &&
|
||||
(comp.operator === '>=' || comp.operator === '<=');
|
||||
var oppositeDirectionsLessThan =
|
||||
cmp(this.semver, '<', comp.semver, options) &&
|
||||
cmp(this.semver, '<', comp.semver, loose) &&
|
||||
((this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '<=' || comp.operator === '<'));
|
||||
var oppositeDirectionsGreaterThan =
|
||||
cmp(this.semver, '>', comp.semver, options) &&
|
||||
cmp(this.semver, '>', comp.semver, loose) &&
|
||||
((this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '>=' || comp.operator === '>'));
|
||||
|
||||
@ -771,29 +757,23 @@ Comparator.prototype.intersects = function(comp, options) {
|
||||
|
||||
|
||||
exports.Range = Range;
|
||||
function Range(range, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
function Range(range, loose) {
|
||||
if (range instanceof Range) {
|
||||
if (range.loose === !!options.loose &&
|
||||
range.includePrerelease === !!options.includePrerelease) {
|
||||
if (range.loose === loose) {
|
||||
return range;
|
||||
} else {
|
||||
return new Range(range.raw, options);
|
||||
return new Range(range.raw, loose);
|
||||
}
|
||||
}
|
||||
|
||||
if (range instanceof Comparator) {
|
||||
return new Range(range.value, options);
|
||||
return new Range(range.value, loose);
|
||||
}
|
||||
|
||||
if (!(this instanceof Range))
|
||||
return new Range(range, options);
|
||||
return new Range(range, loose);
|
||||
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
this.loose = loose;
|
||||
|
||||
// First, split based on boolean or ||
|
||||
this.raw = range;
|
||||
@ -823,8 +803,9 @@ Range.prototype.toString = function() {
|
||||
};
|
||||
|
||||
Range.prototype.parseRange = function(range) {
|
||||
var loose = this.options.loose;
|
||||
var loose = this.loose;
|
||||
range = range.trim();
|
||||
debug('range', range, loose);
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
|
||||
range = range.replace(hr, hyphenReplace);
|
||||
@ -847,22 +828,22 @@ Range.prototype.parseRange = function(range) {
|
||||
|
||||
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
||||
var set = range.split(' ').map(function(comp) {
|
||||
return parseComparator(comp, this.options);
|
||||
}, this).join(' ').split(/\s+/);
|
||||
if (this.options.loose) {
|
||||
return parseComparator(comp, loose);
|
||||
}).join(' ').split(/\s+/);
|
||||
if (this.loose) {
|
||||
// in loose mode, throw out any that are not valid comparators
|
||||
set = set.filter(function(comp) {
|
||||
return !!comp.match(compRe);
|
||||
});
|
||||
}
|
||||
set = set.map(function(comp) {
|
||||
return new Comparator(comp, this.options);
|
||||
}, this);
|
||||
return new Comparator(comp, loose);
|
||||
});
|
||||
|
||||
return set;
|
||||
};
|
||||
|
||||
Range.prototype.intersects = function(range, options) {
|
||||
Range.prototype.intersects = function(range, loose) {
|
||||
if (!(range instanceof Range)) {
|
||||
throw new TypeError('a Range is required');
|
||||
}
|
||||
@ -871,7 +852,7 @@ Range.prototype.intersects = function(range, options) {
|
||||
return thisComparators.every(function(thisComparator) {
|
||||
return range.set.some(function(rangeComparators) {
|
||||
return rangeComparators.every(function(rangeComparator) {
|
||||
return thisComparator.intersects(rangeComparator, options);
|
||||
return thisComparator.intersects(rangeComparator, loose);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -880,8 +861,8 @@ Range.prototype.intersects = function(range, options) {
|
||||
|
||||
// Mostly just for testing and legacy API reasons
|
||||
exports.toComparators = toComparators;
|
||||
function toComparators(range, options) {
|
||||
return new Range(range, options).set.map(function(comp) {
|
||||
function toComparators(range, loose) {
|
||||
return new Range(range, loose).set.map(function(comp) {
|
||||
return comp.map(function(c) {
|
||||
return c.value;
|
||||
}).join(' ').trim().split(' ');
|
||||
@ -891,15 +872,15 @@ function toComparators(range, options) {
|
||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
||||
// already replaced the hyphen ranges
|
||||
// turn into a set of JUST comparators.
|
||||
function parseComparator(comp, options) {
|
||||
debug('comp', comp, options);
|
||||
comp = replaceCarets(comp, options);
|
||||
function parseComparator(comp, loose) {
|
||||
debug('comp', comp);
|
||||
comp = replaceCarets(comp, loose);
|
||||
debug('caret', comp);
|
||||
comp = replaceTildes(comp, options);
|
||||
comp = replaceTildes(comp, loose);
|
||||
debug('tildes', comp);
|
||||
comp = replaceXRanges(comp, options);
|
||||
comp = replaceXRanges(comp, loose);
|
||||
debug('xrange', comp);
|
||||
comp = replaceStars(comp, options);
|
||||
comp = replaceStars(comp, loose);
|
||||
debug('stars', comp);
|
||||
return comp;
|
||||
}
|
||||
@ -914,16 +895,14 @@ function isX(id) {
|
||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
||||
function replaceTildes(comp, options) {
|
||||
function replaceTildes(comp, loose) {
|
||||
return comp.trim().split(/\s+/).map(function(comp) {
|
||||
return replaceTilde(comp, options);
|
||||
return replaceTilde(comp, loose);
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
function replaceTilde(comp, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
var r = options.loose ? re[TILDELOOSE] : re[TILDE];
|
||||
function replaceTilde(comp, loose) {
|
||||
var r = loose ? re[TILDELOOSE] : re[TILDE];
|
||||
return comp.replace(r, function(_, M, m, p, pr) {
|
||||
debug('tilde', comp, _, M, m, p, pr);
|
||||
var ret;
|
||||
@ -957,17 +936,15 @@ function replaceTilde(comp, options) {
|
||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
||||
// ^1.2.3 --> >=1.2.3 <2.0.0
|
||||
// ^1.2.0 --> >=1.2.0 <2.0.0
|
||||
function replaceCarets(comp, options) {
|
||||
function replaceCarets(comp, loose) {
|
||||
return comp.trim().split(/\s+/).map(function(comp) {
|
||||
return replaceCaret(comp, options);
|
||||
return replaceCaret(comp, loose);
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
function replaceCaret(comp, options) {
|
||||
debug('caret', comp, options);
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
var r = options.loose ? re[CARETLOOSE] : re[CARET];
|
||||
function replaceCaret(comp, loose) {
|
||||
debug('caret', comp, loose);
|
||||
var r = loose ? re[CARETLOOSE] : re[CARET];
|
||||
return comp.replace(r, function(_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr);
|
||||
var ret;
|
||||
@ -1014,18 +991,16 @@ function replaceCaret(comp, options) {
|
||||
});
|
||||
}
|
||||
|
||||
function replaceXRanges(comp, options) {
|
||||
debug('replaceXRanges', comp, options);
|
||||
function replaceXRanges(comp, loose) {
|
||||
debug('replaceXRanges', comp, loose);
|
||||
return comp.split(/\s+/).map(function(comp) {
|
||||
return replaceXRange(comp, options);
|
||||
return replaceXRange(comp, loose);
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
function replaceXRange(comp, options) {
|
||||
function replaceXRange(comp, loose) {
|
||||
comp = comp.trim();
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
|
||||
var r = loose ? re[XRANGELOOSE] : re[XRANGE];
|
||||
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
||||
var xM = isX(M);
|
||||
@ -1089,8 +1064,8 @@ function replaceXRange(comp, options) {
|
||||
|
||||
// Because * is AND-ed with everything else in the comparator,
|
||||
// and '' means "any version", just remove the *s entirely.
|
||||
function replaceStars(comp, options) {
|
||||
debug('replaceStars', comp, options);
|
||||
function replaceStars(comp, loose) {
|
||||
debug('replaceStars', comp, loose);
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[STAR], '');
|
||||
}
|
||||
@ -1134,25 +1109,22 @@ Range.prototype.test = function(version) {
|
||||
return false;
|
||||
|
||||
if (typeof version === 'string')
|
||||
version = new SemVer(version, this.options);
|
||||
version = new SemVer(version, this.loose);
|
||||
|
||||
for (var i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version, this.options))
|
||||
if (testSet(this.set[i], version))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function testSet(set, version, options) {
|
||||
function testSet(set, version) {
|
||||
for (var i = 0; i < set.length; i++) {
|
||||
if (!set[i].test(version))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
if (version.prerelease.length && !options.includePrerelease) {
|
||||
if (version.prerelease.length) {
|
||||
// Find the set of versions that are allowed to have prereleases
|
||||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
||||
// That should allow `1.2.3-pr.2` to pass.
|
||||
@ -1180,9 +1152,9 @@ function testSet(set, version, options) {
|
||||
}
|
||||
|
||||
exports.satisfies = satisfies;
|
||||
function satisfies(version, range, options) {
|
||||
function satisfies(version, range, loose) {
|
||||
try {
|
||||
range = new Range(range, options);
|
||||
range = new Range(range, loose);
|
||||
} catch (er) {
|
||||
return false;
|
||||
}
|
||||
@ -1190,19 +1162,19 @@ function satisfies(version, range, options) {
|
||||
}
|
||||
|
||||
exports.maxSatisfying = maxSatisfying;
|
||||
function maxSatisfying(versions, range, options) {
|
||||
function maxSatisfying(versions, range, loose) {
|
||||
var max = null;
|
||||
var maxSV = null;
|
||||
try {
|
||||
var rangeObj = new Range(range, options);
|
||||
var rangeObj = new Range(range, loose);
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
versions.forEach(function (v) {
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, options)
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, loose)
|
||||
if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
|
||||
max = v;
|
||||
maxSV = new SemVer(max, options);
|
||||
maxSV = new SemVer(max, loose);
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1210,19 +1182,19 @@ function maxSatisfying(versions, range, options) {
|
||||
}
|
||||
|
||||
exports.minSatisfying = minSatisfying;
|
||||
function minSatisfying(versions, range, options) {
|
||||
function minSatisfying(versions, range, loose) {
|
||||
var min = null;
|
||||
var minSV = null;
|
||||
try {
|
||||
var rangeObj = new Range(range, options);
|
||||
var rangeObj = new Range(range, loose);
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
versions.forEach(function (v) {
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, options)
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, loose)
|
||||
if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
|
||||
min = v;
|
||||
minSV = new SemVer(min, options);
|
||||
minSV = new SemVer(min, loose);
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1230,11 +1202,11 @@ function minSatisfying(versions, range, options) {
|
||||
}
|
||||
|
||||
exports.validRange = validRange;
|
||||
function validRange(range, options) {
|
||||
function validRange(range, loose) {
|
||||
try {
|
||||
// Return '*' instead of '' so that truthiness works.
|
||||
// This will throw if it's invalid anyway
|
||||
return new Range(range, options).range || '*';
|
||||
return new Range(range, loose).range || '*';
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
@ -1242,20 +1214,20 @@ function validRange(range, options) {
|
||||
|
||||
// Determine if version is less than all the versions possible in the range
|
||||
exports.ltr = ltr;
|
||||
function ltr(version, range, options) {
|
||||
return outside(version, range, '<', options);
|
||||
function ltr(version, range, loose) {
|
||||
return outside(version, range, '<', loose);
|
||||
}
|
||||
|
||||
// Determine if version is greater than all the versions possible in the range.
|
||||
exports.gtr = gtr;
|
||||
function gtr(version, range, options) {
|
||||
return outside(version, range, '>', options);
|
||||
function gtr(version, range, loose) {
|
||||
return outside(version, range, '>', loose);
|
||||
}
|
||||
|
||||
exports.outside = outside;
|
||||
function outside(version, range, hilo, options) {
|
||||
version = new SemVer(version, options);
|
||||
range = new Range(range, options);
|
||||
function outside(version, range, hilo, loose) {
|
||||
version = new SemVer(version, loose);
|
||||
range = new Range(range, loose);
|
||||
|
||||
var gtfn, ltefn, ltfn, comp, ecomp;
|
||||
switch (hilo) {
|
||||
@ -1278,7 +1250,7 @@ function outside(version, range, hilo, options) {
|
||||
}
|
||||
|
||||
// If it satisifes the range it is not outside
|
||||
if (satisfies(version, range, options)) {
|
||||
if (satisfies(version, range, loose)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1297,9 +1269,9 @@ function outside(version, range, hilo, options) {
|
||||
}
|
||||
high = high || comparator;
|
||||
low = low || comparator;
|
||||
if (gtfn(comparator.semver, high.semver, options)) {
|
||||
if (gtfn(comparator.semver, high.semver, loose)) {
|
||||
high = comparator;
|
||||
} else if (ltfn(comparator.semver, low.semver, options)) {
|
||||
} else if (ltfn(comparator.semver, low.semver, loose)) {
|
||||
low = comparator;
|
||||
}
|
||||
});
|
||||
@ -1323,15 +1295,15 @@ function outside(version, range, hilo, options) {
|
||||
}
|
||||
|
||||
exports.prerelease = prerelease;
|
||||
function prerelease(version, options) {
|
||||
var parsed = parse(version, options);
|
||||
function prerelease(version, loose) {
|
||||
var parsed = parse(version, loose);
|
||||
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
|
||||
}
|
||||
|
||||
exports.intersects = intersects;
|
||||
function intersects(r1, r2, options) {
|
||||
r1 = new Range(r1, options)
|
||||
r2 = new Range(r2, options)
|
||||
function intersects(r1, r2, loose) {
|
||||
r1 = new Range(r1, loose)
|
||||
r2 = new Range(r2, loose)
|
||||
return r1.intersects(r2)
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"android-versions": "1.4.0",
|
||||
"base64-js": "1.3.0",
|
||||
"big-integer": "1.6.36",
|
||||
"base64-js": "1.2.0",
|
||||
"big-integer": "1.6.32",
|
||||
"cordova-common": "2.2.5",
|
||||
"elementtree": "0.1.6",
|
||||
"glob": "5.0.15",
|
||||
@ -41,7 +41,7 @@
|
||||
"properties-parser": "0.2.3",
|
||||
"q": "1.4.1",
|
||||
"sax": "0.3.5",
|
||||
"semver": "5.6.0",
|
||||
"semver": "5.5.0",
|
||||
"shelljs": "0.5.3",
|
||||
"xmlbuilder": "8.2.2"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user