Merge pull request #573 from brodybits/7.1.4-patch-updates

7.1.4 patch updates
This commit is contained in:
Chris Brody 2018-11-22 14:45:04 -05:00 committed by GitHub
commit b7643a3712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 495 additions and 308 deletions

View File

@ -194,7 +194,7 @@ function validatePackageName (package_name) {
var msg = 'Error validating package name. '; var msg = 'Error validating package name. ';
if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) { if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
return Q.reject(new CordovaError(msg + 'Package name must look like: com.company.Name')); return Q.reject(new CordovaError(msg + 'Must look like: `com.company.Name`. Currently is: `' + package_name + '`'));
} }
// Class is a reserved word // Class is a reserved word

View File

@ -320,7 +320,7 @@ function generateAttributeError (attribute, element, id) {
function getInstallDestination (obj) { function getInstallDestination (obj) {
var APP_MAIN_PREFIX = 'app/src/main'; var APP_MAIN_PREFIX = 'app/src/main';
if (obj.targetDir.includes('app')) { if (obj.targetDir.startsWith('app')) {
// If any source file is using the new app directory structure, // If any source file is using the new app directory structure,
// don't penalize it // don't penalize it
return path.join(obj.targetDir, path.basename(obj.src)); return path.join(obj.targetDir, path.basename(obj.src));

View File

@ -1,4 +1,5 @@
{ {
"esversion": 6,
"indent": 2, "indent": 2,
"forin": true, "forin": true,
"noarg": true, "noarg": true,

View File

@ -30,35 +30,42 @@
*/ */
var VERSIONS = { var VERSIONS = {
BASE: { api: 1, ndk: 0, semver: "1.0", name: "(no code name)", versionCode: "BASE" }, BASE: { api: 1, ndk: 0, semver: "1.0", name: "(no code name)", },
BASE_1_1: { api: 2, ndk: 0, semver: "1.1", name: "(no code name)", versionCode: "BASE_1_1" }, BASE_1_1: { api: 2, ndk: 0, semver: "1.1", name: "(no code name)", },
CUPCAKE: { api: 3, ndk: 1, semver: "1.5", name: "Cupcake", versionCode: "CUPCAKE" }, CUPCAKE: { api: 3, ndk: 1, semver: "1.5", name: "Cupcake", },
DONUT: { api: 4, ndk: 2, semver: "1.6", name: "Donut", versionCode: "DONUT" }, DONUT: { api: 4, ndk: 2, semver: "1.6", name: "Donut", },
ECLAIR: { api: 5, ndk: 2, semver: "2.0", name: "Eclair", versionCode: "ECLAIR" }, ECLAIR: { api: 5, ndk: 2, semver: "2.0", name: "Eclair", },
ECLAIR_0_1: { api: 6, ndk: 2, semver: "2.0.1", name: "Eclair", versionCode: "ECLAIR_0_1" }, ECLAIR_0_1: { api: 6, ndk: 2, semver: "2.0.1", name: "Eclair", },
ECLAIR_MR1: { api: 7, ndk: 3, semver: "2.1", name: "Eclair", versionCode: "ECLAIR_MR1" }, ECLAIR_MR1: { api: 7, ndk: 3, semver: "2.1", name: "Eclair", },
FROYO: { api: 8, ndk: 4, semver: "2.2.x", name: "Froyo", versionCode: "FROYO" }, FROYO: { api: 8, ndk: 4, semver: "2.2.x", name: "Froyo", },
GINGERBREAD: { api: 9, ndk: 5, semver: "2.3.0 - 2.3.2", name: "Gingerbread", versionCode: "GINGERBREAD" }, GINGERBREAD: { api: 9, ndk: 5, semver: "2.3.0 - 2.3.2", name: "Gingerbread", },
GINGERBREAD_MR1: { api: 10, ndk: 5, semver: "2.3.3 - 2.3.7", name: "Gingerbread", versionCode: "GINGERBREAD_MR1" }, GINGERBREAD_MR1: { api: 10, ndk: 5, semver: "2.3.3 - 2.3.7", name: "Gingerbread", },
HONEYCOMB: { api: 11, ndk: 5, semver: "3.0", name: "Honeycomb", versionCode: "HONEYCOMB" }, HONEYCOMB: { api: 11, ndk: 5, semver: "3.0", name: "Honeycomb", },
HONEYCOMB_MR1: { api: 12, ndk: 6, semver: "3.1", name: "Honeycomb", versionCode: "HONEYCOMB_MR1" }, HONEYCOMB_MR1: { api: 12, ndk: 6, semver: "3.1", name: "Honeycomb", },
HONEYCOMB_MR2: { api: 13, ndk: 6, semver: "3.2.x", name: "Honeycomb", versionCode: "HONEYCOMB_MR2" }, HONEYCOMB_MR2: { api: 13, ndk: 6, semver: "3.2.x", name: "Honeycomb", },
ICE_CREAM_SANDWICH: { api: 14, ndk: 7, semver: "4.0.1 - 4.0.2", name: "Ice Cream Sandwich", versionCode: "ICE_CREAM_SANDWICH" }, ICE_CREAM_SANDWICH: { api: 14, ndk: 7, semver: "4.0.1 - 4.0.2", name: "Ice Cream Sandwich", },
ICE_CREAM_SANDWICH_MR1: { api: 15, ndk: 8, semver: "4.0.3 - 4.0.4", name: "Ice Cream Sandwich", versionCode: "ICE_CREAM_SANDWICH_MR1" }, ICE_CREAM_SANDWICH_MR1: { api: 15, ndk: 8, semver: "4.0.3 - 4.0.4", name: "Ice Cream Sandwich", },
JELLY_BEAN: { api: 16, ndk: 8, semver: "4.1.x", name: "Jellybean", versionCode: "JELLY_BEAN" }, JELLY_BEAN: { api: 16, ndk: 8, semver: "4.1.x", name: "Jellybean", },
JELLY_BEAN_MR1: { api: 17, ndk: 8, semver: "4.2.x", name: "Jellybean", versionCode: "JELLY_BEAN_MR1" }, JELLY_BEAN_MR1: { api: 17, ndk: 8, semver: "4.2.x", name: "Jellybean", },
JELLY_BEAN_MR2: { api: 18, ndk: 8, semver: "4.3.x", name: "Jellybean", versionCode: "JELLY_BEAN_MR2" }, JELLY_BEAN_MR2: { api: 18, ndk: 8, semver: "4.3.x", name: "Jellybean", },
KITKAT: { api: 19, ndk: 8, semver: "4.4.0 - 4.4.4", name: "KitKat", versionCode: "KITKAT" }, KITKAT: { api: 19, ndk: 8, semver: "4.4.0 - 4.4.4", name: "KitKat", },
KITKAT_WATCH: { api: 20, ndk: 8, semver: "4.4", name: "KitKat Watch", versionCode: "KITKAT_WATCH" }, KITKAT_WATCH: { api: 20, ndk: 8, semver: "4.4", name: "KitKat Watch", },
LOLLIPOP: { api: 21, ndk: 8, semver: "5.0", name: "Lollipop", versionCode: "LOLLIPOP" }, LOLLIPOP: { api: 21, ndk: 8, semver: "5.0", name: "Lollipop", },
LOLLIPOP_MR1: { api: 22, ndk: 8, semver: "5.1", name: "Lollipop", versionCode: "LOLLIPOP_MR1" }, LOLLIPOP_MR1: { api: 22, ndk: 8, semver: "5.1", name: "Lollipop", },
M: { api: 23, ndk: 8, semver: "6.0", name: "Marshmallow", versionCode: "M" }, M: { api: 23, ndk: 8, semver: "6.0", name: "Marshmallow", },
N: { api: 24, ndk: 8, semver: "7.0", name: "Nougat", versionCode: "N" }, N: { api: 24, ndk: 8, semver: "7.0", name: "Nougat", },
N_MR1: { api: 25, ndk: 8, semver: "7.1", name: "Nougat", versionCode: "N_MR1" }, N_MR1: { api: 25, ndk: 8, semver: "7.1", name: "Nougat", },
O: { api: 26, ndk: 8, semver: "8.0.0", name: "Oreo", versionCode: "O" }, O: { api: 26, ndk: 8, semver: "8.0.0", name: "Oreo", },
O_MR1: { api: 27, ndk: 8, semver: "8.1.0", name: "Oreo", versionCode: "O_MR1" } O_MR1: { api: 27, ndk: 8, semver: "8.1.0", name: "Oreo", },
P: { api: 28, ndk: 8, semver: "9", name: "Pie", }
} }
// Add a key to each version of Android for the "versionCode".
// This is the same key we use in the VERSIONS map above.
Object.keys(VERSIONS).forEach(function(version) {
VERSIONS[version].versionCode = version
})
var semver = require('semver'); var semver = require('semver');
// semver format requires <major>.<minor>.<patch> but we allow just <major>.<minor> format. // semver format requires <major>.<minor>.<patch> but we allow just <major>.<minor> format.
@ -82,8 +89,8 @@ function getFromDefaultPredicate(arg) {
return true return true
} }
let argSemver = formatSemver(arg); var argSemver = formatSemver(arg)
let versionSemver = formatSemver(version.semver); var versionSemver = formatSemver(version.semver)
if (semver.valid(argSemver) && semver.satisfies(argSemver, versionSemver)) { if (semver.valid(argSemver) && semver.satisfies(argSemver, versionSemver)) {
return true return true

View File

@ -1,26 +1,27 @@
{ {
"_from": "android-versions@1.3.0", "_from": "android-versions@1",
"_id": "android-versions@1.3.0", "_id": "android-versions@1.4.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-d/i1G16Oaw/T1EvskUA7Oo1vIQVK/0ZlpQgZfYVBwg6v/9FBE3QV66g5N1/bTHpRml8tFLxh+KoTw5DokK9c+A==", "_integrity": "sha512-GnomfYsBq+nZh3c3UH/4r9Jt6FuTxdhUJbeHIdYOH5xBhQ8I0ZzC2/RM5IFFIjrzuNWSHb8JWP1lPK0/a26jrg==",
"_location": "/android-versions", "_location": "/android-versions",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "android-versions@1.3.0", "raw": "android-versions@1",
"name": "android-versions", "name": "android-versions",
"escapedName": "android-versions", "escapedName": "android-versions",
"rawSpec": "1.3.0", "rawSpec": "1",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "1.3.0" "fetchSpec": "1"
}, },
"_requiredBy": [ "_requiredBy": [
"#USER",
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.3.0.tgz", "_resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.4.0.tgz",
"_shasum": "ce6f3eae2e165ce4ed49b89beb68014741093044", "_shasum": "807ea2941d7e5780e6dd61c5d9b7b6f3c0706e09",
"_spec": "android-versions@1.3.0", "_spec": "android-versions@1",
"_where": "/Users/brodybits/Documents/cordova/cordova-android", "_where": "/Users/brodybits/Documents/cordova/cordova-android",
"author": { "author": {
"name": "dvoiss" "name": "dvoiss"
@ -63,5 +64,5 @@
"jshint": "jshint .", "jshint": "jshint .",
"test": "tape tests/**/*.js" "test": "tape tests/**/*.js"
}, },
"version": "1.3.0" "version": "1.4.0"
} }

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
var test = require('tape') const test = require('tape')
var android = require('..') const android = require('..')
test('get specific version by API level', (t) => { test('get specific version by API level', (t) => {
t.plan(1) t.plan(1)
@ -16,7 +16,7 @@ test('getAll versions by API level', (t) => {
test('get specific version by predicate', (t) => { test('get specific version by predicate', (t) => {
t.plan(2) t.plan(2)
var actual = android.get((version) => { let actual = android.get((version) => {
return version.name.indexOf("on") !== -1 return version.name.indexOf("on") !== -1
}) })
t.equal(actual.name, "Donut") t.equal(actual.name, "Donut")
@ -30,7 +30,7 @@ test('get specific version by predicate', (t) => {
test('getAll versions by predicate', (t) => { test('getAll versions by predicate', (t) => {
t.plan(3) t.plan(3)
var actual = android.getAll((version) => { let actual = android.getAll((version) => {
return version.name.indexOf("on") !== -1 return version.name.indexOf("on") !== -1
}).map((version) => version.name) }).map((version) => version.name)
t.deepEqual(actual, ["Donut", "Honeycomb", "Honeycomb", "Honeycomb"]) t.deepEqual(actual, ["Donut", "Honeycomb", "Honeycomb", "Honeycomb"])
@ -43,7 +43,7 @@ test('getAll versions by predicate', (t) => {
actual = android.getAll((version) => { actual = android.getAll((version) => {
return version.api > 22 return version.api > 22
}).map((version) => version.versionCode) }).map((version) => version.versionCode)
t.deepEqual(actual, ["M", "N", "N_MR1", "O", "O_MR1"]) t.deepEqual(actual, ["M", "N", "N_MR1", "O", "O_MR1", "P"])
}) })
test('get version by semantic version', (t) => { test('get version by semantic version', (t) => {
@ -54,32 +54,31 @@ test('get version by semantic version', (t) => {
t.equal(android.get("2.3.3").versionCode, android.GINGERBREAD_MR1.versionCode) t.equal(android.get("2.3.3").versionCode, android.GINGERBREAD_MR1.versionCode)
}) })
test('support major version only', (t) => {
t.plan(2)
t.equal(android.get("9.0").versionCode, android.P.versionCode)
t.equal(android.get("9.0.0").versionCode, android.P.versionCode)
})
test('support version ranges', (t) => { test('support version ranges', (t) => {
t.plan(7); t.plan(7)
t.equal(android.get("4.4").versionCode, android.KITKAT.versionCode); let tests = [ "4.4", "4.4.0", "4.4.1", "4.4.2", "4.4.3", "4.4.4" ]
t.equal(android.get("4.4.0").versionCode, android.KITKAT.versionCode); tests.forEach((versionCode) => {
t.equal(android.get("4.4.1").versionCode, android.KITKAT.versionCode); t.equal(android.get(versionCode).versionCode, android.KITKAT.versionCode)
t.equal(android.get("4.4.2").versionCode, android.KITKAT.versionCode); })
t.equal(android.get("4.4.3").versionCode, android.KITKAT.versionCode); t.equal(android.get("4.4.5"), null)
t.equal(android.get("4.4.4").versionCode, android.KITKAT.versionCode);
t.equal(android.get("4.4.5"), null);
}) })
test('support x-ranges', (t) => { test('support x-ranges', (t) => {
t.plan(12); t.plan(12)
t.equal(android.get("4.1").versionCode, android.JELLY_BEAN.versionCode); let tests = [
t.equal(android.get("4.1.0").versionCode, android.JELLY_BEAN.versionCode); "4.1", "4.1.0", "4.1.1", "4.1.2", "4.1.3", "4.1.4",
t.equal(android.get("4.1.1").versionCode, android.JELLY_BEAN.versionCode); "4.1.5", "4.1.6", "4.1.7", "4.1.8", "4.1.9", "4.1.10"
t.equal(android.get("4.1.2").versionCode, android.JELLY_BEAN.versionCode); ]
t.equal(android.get("4.1.3").versionCode, android.JELLY_BEAN.versionCode); tests.forEach((versionCode) => {
t.equal(android.get("4.1.4").versionCode, android.JELLY_BEAN.versionCode); t.equal(android.get(versionCode).versionCode, android.JELLY_BEAN.versionCode)
t.equal(android.get("4.1.5").versionCode, android.JELLY_BEAN.versionCode); })
t.equal(android.get("4.1.6").versionCode, android.JELLY_BEAN.versionCode); })
t.equal(android.get("4.1.7").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.8").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.9").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.10").versionCode, android.JELLY_BEAN.versionCode);
});
test('access version codes object', (t) => { test('access version codes object', (t) => {
t.plan(1) t.plan(1)
@ -87,7 +86,7 @@ test('access version codes object', (t) => {
}) })
test('access specific versions directly', (t) => { test('access specific versions directly', (t) => {
t.plan(27) t.plan(28)
t.ok(android.BASE) t.ok(android.BASE)
t.ok(android.BASE_1_1) t.ok(android.BASE_1_1)
t.ok(android.CUPCAKE) t.ok(android.CUPCAKE)
@ -115,4 +114,5 @@ test('access specific versions directly', (t) => {
t.ok(android.N_MR1) t.ok(android.N_MR1)
t.ok(android.O) t.ok(android.O)
t.ok(android.O_MR1) t.ok(android.O_MR1)
t.ok(android.P)
}) })

10
node_modules/base64-js/README.md generated vendored
View File

@ -15,13 +15,15 @@ Sometimes encoding/decoding binary data in the browser is useful, and that is wh
With [npm](https://npmjs.org) do: With [npm](https://npmjs.org) do:
`npm install base64-js` `npm install base64-js` and `var base64js = require('base64-js')`
For use in web browsers do:
`<script src="base64js.min.js"></script>`
## methods ## methods
`var base64 = require('base64-js')` `base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
`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 * `byteLength` - Takes a base64 string and returns length of byte array
* `toByteArray` - Takes a base64 string and returns a byte array * `toByteArray` - Takes a base64 string and returns a byte array

View File

@ -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,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("")}},{}]},{},[])("/")}); (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("")}},{}]},{},[])("/")});

121
node_modules/base64-js/index.js generated vendored
View File

@ -14,68 +14,102 @@ for (var i = 0, len = code.length; i < len; ++i) {
revLookup[code.charCodeAt(i)] = 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)] = 62
revLookup['_'.charCodeAt(0)] = 63 revLookup['_'.charCodeAt(0)] = 63
function placeHoldersCount (b64) { function getLens (b64) {
var len = b64.length var len = b64.length
if (len % 4 > 0) { if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4') throw new Error('Invalid string. Length must be a multiple of 4')
} }
// the number of equal signs (place holders) // Trim off extra bytes after placeholder bytes are found
// if there are two placeholders, than the two characters before it // See: https://github.com/beatgammit/base64-js/issues/42
// represent one byte var validLen = b64.indexOf('=')
// if there is only one, then the three characters before it represent 2 bytes if (validLen === -1) validLen = len
// this is just a cheap hack to not do indexOf twice
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 var placeHoldersLen = validLen === len
? 0
: 4 - (validLen % 4)
return [validLen, placeHoldersLen]
} }
// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) { function byteLength (b64) {
// base64 is 4/3 + up to two characters of the original data var lens = getLens(b64)
return b64.length * 3 / 4 - placeHoldersCount(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
} }
function toByteArray (b64) { function toByteArray (b64) {
var i, j, l, tmp, placeHolders, arr var tmp
var len = b64.length var lens = getLens(b64)
placeHolders = placeHoldersCount(b64) var validLen = lens[0]
var placeHoldersLen = lens[1]
arr = new Arr(len * 3 / 4 - placeHolders) var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
var curByte = 0
// if there are placeholders, only get up to the last complete 4 chars // if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? len - 4 : len var len = placeHoldersLen > 0
? validLen - 4
: validLen
var L = 0 for (var i = 0; i < len; i += 4) {
tmp =
for (i = 0, j = 0; i < l; i += 4, j += 3) { (revLookup[b64.charCodeAt(i)] << 18) |
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] (revLookup[b64.charCodeAt(i + 1)] << 12) |
arr[L++] = (tmp >> 16) & 0xFF (revLookup[b64.charCodeAt(i + 2)] << 6) |
arr[L++] = (tmp >> 8) & 0xFF revLookup[b64.charCodeAt(i + 3)]
arr[L++] = tmp & 0xFF arr[curByte++] = (tmp >> 16) & 0xFF
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
} }
if (placeHolders === 2) { if (placeHoldersLen === 2) {
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) tmp =
arr[L++] = tmp & 0xFF (revLookup[b64.charCodeAt(i)] << 2) |
} else if (placeHolders === 1) { (revLookup[b64.charCodeAt(i + 1)] >> 4)
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = tmp & 0xFF
arr[L++] = (tmp >> 8) & 0xFF }
arr[L++] = 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
} }
return arr return arr
} }
function tripletToBase64 (num) { 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) { function encodeChunk (uint8, start, end) {
var tmp var tmp
var output = [] var output = []
for (var i = start; i < end; i += 3) { for (var i = start; i < end; i += 3) {
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) tmp =
((uint8[i] << 16) & 0xFF0000) +
((uint8[i + 1] << 8) & 0xFF00) +
(uint8[i + 2] & 0xFF)
output.push(tripletToBase64(tmp)) output.push(tripletToBase64(tmp))
} }
return output.join('') return output.join('')
@ -85,30 +119,33 @@ function fromByteArray (uint8) {
var tmp var tmp
var len = uint8.length var len = uint8.length
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
var output = ''
var parts = [] var parts = []
var maxChunkLength = 16383 // must be multiple of 3 var maxChunkLength = 16383 // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later // 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) { 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 // pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) { if (extraBytes === 1) {
tmp = uint8[len - 1] tmp = uint8[len - 1]
output += lookup[tmp >> 2] parts.push(
output += lookup[(tmp << 4) & 0x3F] lookup[tmp >> 2] +
output += '==' lookup[(tmp << 4) & 0x3F] +
'=='
)
} else if (extraBytes === 2) { } else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) tmp = (uint8[len - 2] << 8) + uint8[len - 1]
output += lookup[tmp >> 10] parts.push(
output += lookup[(tmp >> 4) & 0x3F] lookup[tmp >> 10] +
output += lookup[(tmp << 2) & 0x3F] lookup[(tmp >> 4) & 0x3F] +
output += '=' lookup[(tmp << 2) & 0x3F] +
'='
)
} }
parts.push(output)
return parts.join('') return parts.join('')
} }

33
node_modules/base64-js/package.json generated vendored
View File

@ -1,27 +1,28 @@
{ {
"_from": "base64-js@1.2.0", "_from": "base64-js@1",
"_id": "base64-js@1.2.0", "_id": "base64-js@1.3.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-o5mS1yNYSBGYK+XikLtqU9hnAPE=", "_integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==",
"_location": "/base64-js", "_location": "/base64-js",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "base64-js@1.2.0", "raw": "base64-js@1",
"name": "base64-js", "name": "base64-js",
"escapedName": "base64-js", "escapedName": "base64-js",
"rawSpec": "1.2.0", "rawSpec": "1",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "1.2.0" "fetchSpec": "1"
}, },
"_requiredBy": [ "_requiredBy": [
"/plist" "#USER",
"/"
], ],
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.0.tgz", "_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
"_shasum": "a39992d723584811982be5e290bb6a53d86700f1", "_shasum": "cab1e6118f051095e58b5281aea8c1cd22bfc0e3",
"_spec": "base64-js@1.2.0", "_spec": "base64-js@1",
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/plist", "_where": "/Users/brodybits/Documents/cordova/cordova-android",
"author": { "author": {
"name": "T. Jameson Little", "name": "T. Jameson Little",
"email": "t.jameson.little@gmail.com" "email": "t.jameson.little@gmail.com"
@ -33,11 +34,11 @@
"deprecated": false, "deprecated": false,
"description": "Base64 encoding/decoding in pure JS", "description": "Base64 encoding/decoding in pure JS",
"devDependencies": { "devDependencies": {
"benchmark": "^2.1.0", "benchmark": "^2.1.4",
"browserify": "^13.0.0", "browserify": "^14.0.0",
"standard": "*", "standard": "*",
"tape": "4.x", "tape": "4.x",
"uglify-js": "^2.6.2" "uglify-js": "^2.8.29"
}, },
"files": [ "files": [
"test", "test",
@ -61,5 +62,5 @@
"test": "npm run lint && npm run unit", "test": "npm run lint && npm run unit",
"unit": "tape test/*.js" "unit": "tape test/*.js"
}, },
"version": "1.2.0" "version": "1.3.0"
} }

View File

@ -10,6 +10,7 @@ test('convert big data to base64', function (t) {
b64str = b64.fromByteArray(big) b64str = b64.fromByteArray(big)
arr = b64.toByteArray(b64str) arr = b64.toByteArray(b64str)
t.ok(equal(arr, big)) t.ok(equal(arr, big))
t.equal(b64.byteLength(b64str), arr.length)
t.end() t.end()
}) })

View File

@ -29,6 +29,46 @@ 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) { function map (arr, callback) {
var res = [] var res = []
var kValue, mappedValue var kValue, mappedValue

10
node_modules/base64-js/test/corrupt.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
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()
})

View File

@ -4,15 +4,21 @@ var b64 = require('../')
test('decode url-safe style base64 strings', function (t) { test('decode url-safe style base64 strings', function (t) {
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff] var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]
var actual = b64.toByteArray('//++/++/++//') var str = '//++/++/++//'
var actual = b64.toByteArray(str)
for (var i = 0; i < actual.length; i++) { for (var i = 0; i < actual.length; i++) {
t.equal(actual[i], expected[i]) t.equal(actual[i], expected[i])
} }
actual = b64.toByteArray('__--_--_--__') t.equal(b64.byteLength(str), actual.length)
str = '__--_--_--__'
actual = b64.toByteArray(str)
for (i = 0; i < actual.length; i++) { for (i = 0; i < actual.length; i++) {
t.equal(actual[i], expected[i]) t.equal(actual[i], expected[i])
} }
t.equal(b64.byteLength(str), actual.length)
t.end() t.end()
}) })

View File

@ -785,29 +785,44 @@ var bigInt = (function (undefined) {
if (n.isUnit()) return false; if (n.isUnit()) return false;
if (n.equals(2) || n.equals(3) || n.equals(5)) return true; 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.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
if (n.lesser(25)) return true; if (n.lesser(49)) return true;
// we don't know if it's prime: let the other functions figure it out // we don't know if it's prime: let the other functions figure it out
} }
BigInteger.prototype.isPrime = function () { function millerRabinTest(n, a) {
var isPrime = isBasicPrime(this); var nPrev = n.prev(),
if (isPrime !== undefined) return isPrime;
var n = this.abs(),
nPrev = n.prev();
var a = [2, 3, 5, 7, 11, 13, 17, 19],
b = nPrev, b = nPrev,
r = 0,
d, t, i, x; d, t, i, x;
while (b.isEven()) b = b.divide(2); while (b.isEven()) b = b.divide(2), r++;
for (i = 0; i < a.length; i++) { next : for (i = 0; i < a.length; i++) {
if (n.lesser(a[i])) continue;
x = bigInt(a[i]).modPow(b, n); x = bigInt(a[i]).modPow(b, n);
if (x.equals(Integer[1]) || x.equals(nPrev)) continue; if (x.equals(Integer[1]) || x.equals(nPrev)) continue;
for (t = true, d = b; t && d.lesser(nPrev); d = d.multiply(2)) { for (d = r - 1; d != 0; d--) {
x = x.square().mod(n); x = x.square().mod(n);
if (x.equals(nPrev)) t = false; if (x.isUnit()) return false;
if (x.equals(nPrev)) continue next;
} }
if (t) return false; return false;
} }
return true; return true;
}
// Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2
BigInteger.prototype.isPrime = function (strict) {
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));
}
return millerRabinTest(n, a);
}; };
SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime; SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
@ -816,12 +831,10 @@ var bigInt = (function (undefined) {
if (isPrime !== undefined) return isPrime; if (isPrime !== undefined) return isPrime;
var n = this.abs(); var n = this.abs();
var t = iterations === undefined ? 5 : iterations; var t = iterations === undefined ? 5 : iterations;
// use the Fermat primality test for (var a = [], i = 0; i < t; i++) {
for (var i = 0; i < t; i++) { a.push(bigInt.randBetween(2, n.minus(2)));
var a = bigInt.randBetween(2, n.minus(2));
if (!a.modPow(n.prev(), n).isUnit()) return false; // definitely composite
} }
return true; // large chance of being prime return millerRabinTest(n, a);
}; };
SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;

File diff suppressed because one or more lines are too long

10
node_modules/big-integer/README.md generated vendored
View File

@ -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. 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. 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 [Fermat primality test](https://en.wikipedia.org/wiki/Fermat_primality_test). This uses the [Miller Rabin test](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test).
- `bigInt(5).isProbablePrime()` => `true` - `bigInt(5).isProbablePrime()` => `true`
- `bigInt(49).isProbablePrime()` => `false` - `bigInt(49).isProbablePrime()` => `false`
- `bigInt(1729).isProbablePrime(50)` => `false` - `bigInt(1729).isProbablePrime()` => `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. [Carmichael numbers](https://en.wikipedia.org/wiki/Carmichael_number) are particularly prone to give unreliable results. 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 MillerRabin primality test declares the number probably prime with a probability at most `4` to the power `iterations`.
For example, `bigInt(1729).isProbablePrime()` returns `false` about 76% of the time and `true` about 24% of the time. The correct result is `false`. If the number is prime, this function always returns `true`.
#### `isUnit()` #### `isUnit()`

View File

@ -1,27 +1,29 @@
{ {
"_from": "big-integer@^1.6.7", "_from": "big-integer@1",
"_id": "big-integer@1.6.32", "_id": "big-integer@1.6.36",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-ljKJdR3wk9thHfLj4DtrNiOSTxvGFaMjWrG4pW75juXC4j7+XuKJVFdg4kgFMYp85PVkO05dFMj2dk2xVsH4xw==", "_integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==",
"_location": "/big-integer", "_location": "/big-integer",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "range", "type": "range",
"registry": true, "registry": true,
"raw": "big-integer@^1.6.7", "raw": "big-integer@1",
"name": "big-integer", "name": "big-integer",
"escapedName": "big-integer", "escapedName": "big-integer",
"rawSpec": "^1.6.7", "rawSpec": "1",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "^1.6.7" "fetchSpec": "1"
}, },
"_requiredBy": [ "_requiredBy": [
"#USER",
"/",
"/bplist-parser" "/bplist-parser"
], ],
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.32.tgz", "_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz",
"_shasum": "5867458b25ecd5bcb36b627c30bb501a13c07e89", "_shasum": "78631076265d4ae3555c04f85e7d9d2f3a071a36",
"_spec": "big-integer@^1.6.7", "_spec": "big-integer@1",
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/bplist-parser", "_where": "/Users/brodybits/Documents/cordova/cordova-android",
"author": { "author": {
"name": "Peter Olson", "name": "Peter Olson",
"email": "peter.e.c.olson+npm@gmail.com" "email": "peter.e.c.olson+npm@gmail.com"
@ -76,5 +78,5 @@
"test": "tsc && karma start my.conf.js && node spec/tsDefinitions.js" "test": "tsc && karma start my.conf.js && node spec/tsDefinitions.js"
}, },
"typings": "./BigInteger.d.ts", "typings": "./BigInteger.d.ts",
"version": "1.6.32" "version": "1.6.36"
} }

View File

@ -1,5 +1,5 @@
{ {
"_from": "path-is-absolute@^1.0.0", "_from": "path-is-absolute@1",
"_id": "path-is-absolute@1.0.1", "_id": "path-is-absolute@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
@ -8,24 +8,25 @@
"_requested": { "_requested": {
"type": "range", "type": "range",
"registry": true, "registry": true,
"raw": "path-is-absolute@^1.0.0", "raw": "path-is-absolute@1",
"name": "path-is-absolute", "name": "path-is-absolute",
"escapedName": "path-is-absolute", "escapedName": "path-is-absolute",
"rawSpec": "^1.0.0", "rawSpec": "1",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "^1.0.0" "fetchSpec": "1"
}, },
"_requiredBy": [ "_requiredBy": [
"#USER",
"/",
"/eslint/glob", "/eslint/glob",
"/glob", "/glob",
"/globby/glob",
"/jasmine/glob", "/jasmine/glob",
"/rimraf/glob" "/rimraf/glob"
], ],
"_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "_resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", "_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
"_spec": "path-is-absolute@^1.0.0", "_spec": "path-is-absolute@1",
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/glob", "_where": "/Users/brodybits/Documents/cordova/cordova-android",
"author": { "author": {
"name": "Sindre Sorhus", "name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com", "email": "sindresorhus@gmail.com",

23
node_modules/semver/README.md generated vendored
View File

@ -29,8 +29,6 @@ As a command-line utility:
``` ```
$ semver -h $ semver -h
SemVer 5.3.0
A JavaScript implementation of the http://semver.org/ specification A JavaScript implementation of the http://semver.org/ specification
Copyright Isaac Z. Schlueter Copyright Isaac Z. Schlueter
@ -54,6 +52,9 @@ Options:
-l --loose -l --loose
Interpret versions and ranges loosely Interpret versions and ranges loosely
-p --include-prerelease
Always include prerelease versions in range matching
-c --coerce -c --coerce
Coerce a string into SemVer if possible Coerce a string into SemVer if possible
(does not imply --loose) (does not imply --loose)
@ -274,7 +275,7 @@ logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | '' range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
@ -289,9 +290,19 @@ part ::= nr | [-0-9A-Za-z]+
## Functions ## Functions
All methods and classes take a final `loose` boolean argument that, if All methods and classes take a final `options` object argument. All
true, will be more forgiving about not-quite-valid semver strings. options in this object are `false` by default. The options supported
The resulting output will always be 100% strict, of course. 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.
Strict-mode Comparators and Ranges will be strict about the SemVer Strict-mode Comparators and Ranges will be strict about the SemVer
strings that they parse. strings that they parse.

18
node_modules/semver/bin/semver generated vendored
View File

@ -12,10 +12,12 @@ var argv = process.argv.slice(2)
, inc = null , inc = null
, version = require("../package.json").version , version = require("../package.json").version
, loose = false , loose = false
, includePrerelease = false
, coerce = false , coerce = false
, identifier = undefined , identifier = undefined
, semver = require("../semver") , semver = require("../semver")
, reverse = false , reverse = false
, options = {}
main() main()
@ -35,6 +37,9 @@ function main () {
case "-l": case "--loose": case "-l": case "--loose":
loose = true loose = true
break break
case "-p": case "--include-prerelease":
includePrerelease = true
break
case "-v": case "--version": case "-v": case "--version":
versions.push(argv.shift()) versions.push(argv.shift())
break break
@ -66,6 +71,8 @@ function main () {
} }
} }
var options = { loose: loose, includePrerelease: includePrerelease }
versions = versions.map(function (v) { versions = versions.map(function (v) {
return coerce ? (semver.coerce(v) || {version: v}).version : v return coerce ? (semver.coerce(v) || {version: v}).version : v
}).filter(function (v) { }).filter(function (v) {
@ -77,7 +84,7 @@ function main () {
for (var i = 0, l = range.length; i < l ; i ++) { for (var i = 0, l = range.length; i < l ; i ++) {
versions = versions.filter(function (v) { versions = versions.filter(function (v) {
return semver.satisfies(v, range[i], loose) return semver.satisfies(v, range[i], options)
}) })
if (!versions.length) return fail() if (!versions.length) return fail()
} }
@ -94,11 +101,11 @@ function fail () { process.exit(1) }
function success () { function success () {
var compare = reverse ? "rcompare" : "compare" var compare = reverse ? "rcompare" : "compare"
versions.sort(function (a, b) { versions.sort(function (a, b) {
return semver[compare](a, b, loose) return semver[compare](a, b, options)
}).map(function (v) { }).map(function (v) {
return semver.clean(v, loose) return semver.clean(v, options)
}).map(function (v) { }).map(function (v) {
return inc ? semver.inc(v, inc, loose, identifier) : v return inc ? semver.inc(v, inc, options, identifier) : v
}).forEach(function (v,i,_) { console.log(v) }) }).forEach(function (v,i,_) { console.log(v) })
} }
@ -128,6 +135,9 @@ function help () {
,"-l --loose" ,"-l --loose"
," Interpret versions and ranges loosely" ," Interpret versions and ranges loosely"
,"" ,""
,"-p --include-prerelease"
," Always include prerelease versions in range matching"
,""
,"-c --coerce" ,"-c --coerce"
," Coerce a string into SemVer if possible" ," Coerce a string into SemVer if possible"
," (does not imply --loose)" ," (does not imply --loose)"

26
node_modules/semver/package.json generated vendored
View File

@ -1,28 +1,30 @@
{ {
"_from": "semver@^5.4.1", "_from": "semver@5",
"_id": "semver@5.5.0", "_id": "semver@5.6.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "_integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==",
"_location": "/semver", "_location": "/semver",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "range", "type": "range",
"registry": true, "registry": true,
"raw": "semver@^5.4.1", "raw": "semver@5",
"name": "semver", "name": "semver",
"escapedName": "semver", "escapedName": "semver",
"rawSpec": "^5.4.1", "rawSpec": "5",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "^5.4.1" "fetchSpec": "5"
}, },
"_requiredBy": [ "_requiredBy": [
"#USER",
"/",
"/android-versions", "/android-versions",
"/normalize-package-data" "/normalize-package-data"
], ],
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", "_resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
"_shasum": "dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab", "_shasum": "7e74256fbaa49c75aa7c7a205cc22799cac80004",
"_spec": "semver@^5.4.1", "_spec": "semver@5",
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/android-versions", "_where": "/Users/brodybits/Documents/cordova/cordova-android",
"bin": { "bin": {
"semver": "./bin/semver" "semver": "./bin/semver"
}, },
@ -33,7 +35,7 @@
"deprecated": false, "deprecated": false,
"description": "The semantic version parser used by npm.", "description": "The semantic version parser used by npm.",
"devDependencies": { "devDependencies": {
"tap": "^10.7.0" "tap": "^12.0.1"
}, },
"files": [ "files": [
"bin", "bin",
@ -51,5 +53,5 @@
"scripts": { "scripts": {
"test": "tap test/*.js --cov -J" "test": "tap test/*.js --cov -J"
}, },
"version": "5.5.0" "version": "5.6.0"
} }

236
node_modules/semver/semver.js generated vendored
View File

@ -245,7 +245,10 @@ for (var i = 0; i < R; i++) {
} }
exports.parse = parse; exports.parse = parse;
function parse(version, loose) { function parse(version, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (version instanceof SemVer) if (version instanceof SemVer)
return version; return version;
@ -255,35 +258,37 @@ function parse(version, loose) {
if (version.length > MAX_LENGTH) if (version.length > MAX_LENGTH)
return null; return null;
var r = loose ? re[LOOSE] : re[FULL]; var r = options.loose ? re[LOOSE] : re[FULL];
if (!r.test(version)) if (!r.test(version))
return null; return null;
try { try {
return new SemVer(version, loose); return new SemVer(version, options);
} catch (er) { } catch (er) {
return null; return null;
} }
} }
exports.valid = valid; exports.valid = valid;
function valid(version, loose) { function valid(version, options) {
var v = parse(version, loose); var v = parse(version, options);
return v ? v.version : null; return v ? v.version : null;
} }
exports.clean = clean; exports.clean = clean;
function clean(version, loose) { function clean(version, options) {
var s = parse(version.trim().replace(/^[=v]+/, ''), loose); var s = parse(version.trim().replace(/^[=v]+/, ''), options);
return s ? s.version : null; return s ? s.version : null;
} }
exports.SemVer = SemVer; exports.SemVer = SemVer;
function SemVer(version, loose) { function SemVer(version, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (version instanceof SemVer) { if (version instanceof SemVer) {
if (version.loose === loose) if (version.loose === options.loose)
return version; return version;
else else
version = version.version; version = version.version;
@ -295,11 +300,13 @@ function SemVer(version, loose) {
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
if (!(this instanceof SemVer)) if (!(this instanceof SemVer))
return new SemVer(version, loose); return new SemVer(version, options);
debug('SemVer', version, loose); debug('SemVer', version, options);
this.loose = loose; this.options = options;
var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); this.loose = !!options.loose;
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
if (!m) if (!m)
throw new TypeError('Invalid Version: ' + version); throw new TypeError('Invalid Version: ' + version);
@ -349,16 +356,16 @@ SemVer.prototype.toString = function() {
}; };
SemVer.prototype.compare = function(other) { SemVer.prototype.compare = function(other) {
debug('SemVer.compare', this.version, this.loose, other); debug('SemVer.compare', this.version, this.options, other);
if (!(other instanceof SemVer)) if (!(other instanceof SemVer))
other = new SemVer(other, this.loose); other = new SemVer(other, this.options);
return this.compareMain(other) || this.comparePre(other); return this.compareMain(other) || this.comparePre(other);
}; };
SemVer.prototype.compareMain = function(other) { SemVer.prototype.compareMain = function(other) {
if (!(other instanceof SemVer)) if (!(other instanceof SemVer))
other = new SemVer(other, this.loose); other = new SemVer(other, this.options);
return compareIdentifiers(this.major, other.major) || return compareIdentifiers(this.major, other.major) ||
compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.minor, other.minor) ||
@ -367,7 +374,7 @@ SemVer.prototype.compareMain = function(other) {
SemVer.prototype.comparePre = function(other) { SemVer.prototype.comparePre = function(other) {
if (!(other instanceof SemVer)) if (!(other instanceof SemVer))
other = new SemVer(other, this.loose); other = new SemVer(other, this.options);
// NOT having a prerelease is > having one // NOT having a prerelease is > having one
if (this.prerelease.length && !other.prerelease.length) if (this.prerelease.length && !other.prerelease.length)
@ -658,19 +665,23 @@ function cmp(a, op, b, loose) {
} }
exports.Comparator = Comparator; exports.Comparator = Comparator;
function Comparator(comp, loose) { function Comparator(comp, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (comp instanceof Comparator) { if (comp instanceof Comparator) {
if (comp.loose === loose) if (comp.loose === !!options.loose)
return comp; return comp;
else else
comp = comp.value; comp = comp.value;
} }
if (!(this instanceof Comparator)) if (!(this instanceof Comparator))
return new Comparator(comp, loose); return new Comparator(comp, options);
debug('comparator', comp, loose); debug('comparator', comp, options);
this.loose = loose; this.options = options;
this.loose = !!options.loose;
this.parse(comp); this.parse(comp);
if (this.semver === ANY) if (this.semver === ANY)
@ -683,7 +694,7 @@ function Comparator(comp, loose) {
var ANY = {}; var ANY = {};
Comparator.prototype.parse = function(comp) { Comparator.prototype.parse = function(comp) {
var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
var m = comp.match(r); var m = comp.match(r);
if (!m) if (!m)
@ -697,7 +708,7 @@ Comparator.prototype.parse = function(comp) {
if (!m[2]) if (!m[2])
this.semver = ANY; this.semver = ANY;
else else
this.semver = new SemVer(m[2], this.loose); this.semver = new SemVer(m[2], this.options.loose);
}; };
Comparator.prototype.toString = function() { Comparator.prototype.toString = function() {
@ -705,30 +716,33 @@ Comparator.prototype.toString = function() {
}; };
Comparator.prototype.test = function(version) { Comparator.prototype.test = function(version) {
debug('Comparator.test', version, this.loose); debug('Comparator.test', version, this.options.loose);
if (this.semver === ANY) if (this.semver === ANY)
return true; return true;
if (typeof version === 'string') if (typeof version === 'string')
version = new SemVer(version, this.loose); version = new SemVer(version, this.options);
return cmp(version, this.operator, this.semver, this.loose); return cmp(version, this.operator, this.semver, this.options);
}; };
Comparator.prototype.intersects = function(comp, loose) { Comparator.prototype.intersects = function(comp, options) {
if (!(comp instanceof Comparator)) { if (!(comp instanceof Comparator)) {
throw new TypeError('a Comparator is required'); throw new TypeError('a Comparator is required');
} }
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var rangeTmp; var rangeTmp;
if (this.operator === '') { if (this.operator === '') {
rangeTmp = new Range(comp.value, loose); rangeTmp = new Range(comp.value, options);
return satisfies(this.value, rangeTmp, loose); return satisfies(this.value, rangeTmp, options);
} else if (comp.operator === '') { } else if (comp.operator === '') {
rangeTmp = new Range(this.value, loose); rangeTmp = new Range(this.value, options);
return satisfies(comp.semver, rangeTmp, loose); return satisfies(comp.semver, rangeTmp, options);
} }
var sameDirectionIncreasing = var sameDirectionIncreasing =
@ -742,11 +756,11 @@ Comparator.prototype.intersects = function(comp, loose) {
(this.operator === '>=' || this.operator === '<=') && (this.operator === '>=' || this.operator === '<=') &&
(comp.operator === '>=' || comp.operator === '<='); (comp.operator === '>=' || comp.operator === '<=');
var oppositeDirectionsLessThan = var oppositeDirectionsLessThan =
cmp(this.semver, '<', comp.semver, loose) && cmp(this.semver, '<', comp.semver, options) &&
((this.operator === '>=' || this.operator === '>') && ((this.operator === '>=' || this.operator === '>') &&
(comp.operator === '<=' || comp.operator === '<')); (comp.operator === '<=' || comp.operator === '<'));
var oppositeDirectionsGreaterThan = var oppositeDirectionsGreaterThan =
cmp(this.semver, '>', comp.semver, loose) && cmp(this.semver, '>', comp.semver, options) &&
((this.operator === '<=' || this.operator === '<') && ((this.operator === '<=' || this.operator === '<') &&
(comp.operator === '>=' || comp.operator === '>')); (comp.operator === '>=' || comp.operator === '>'));
@ -757,23 +771,29 @@ Comparator.prototype.intersects = function(comp, loose) {
exports.Range = Range; exports.Range = Range;
function Range(range, loose) { function Range(range, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (range instanceof Range) { if (range instanceof Range) {
if (range.loose === loose) { if (range.loose === !!options.loose &&
range.includePrerelease === !!options.includePrerelease) {
return range; return range;
} else { } else {
return new Range(range.raw, loose); return new Range(range.raw, options);
} }
} }
if (range instanceof Comparator) { if (range instanceof Comparator) {
return new Range(range.value, loose); return new Range(range.value, options);
} }
if (!(this instanceof Range)) if (!(this instanceof Range))
return new Range(range, loose); return new Range(range, options);
this.loose = loose; this.options = options;
this.loose = !!options.loose;
this.includePrerelease = !!options.includePrerelease
// First, split based on boolean or || // First, split based on boolean or ||
this.raw = range; this.raw = range;
@ -803,9 +823,8 @@ Range.prototype.toString = function() {
}; };
Range.prototype.parseRange = function(range) { Range.prototype.parseRange = function(range) {
var loose = this.loose; var loose = this.options.loose;
range = range.trim(); range = range.trim();
debug('range', range, loose);
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
range = range.replace(hr, hyphenReplace); range = range.replace(hr, hyphenReplace);
@ -828,22 +847,22 @@ Range.prototype.parseRange = function(range) {
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
var set = range.split(' ').map(function(comp) { var set = range.split(' ').map(function(comp) {
return parseComparator(comp, loose); return parseComparator(comp, this.options);
}).join(' ').split(/\s+/); }, this).join(' ').split(/\s+/);
if (this.loose) { if (this.options.loose) {
// in loose mode, throw out any that are not valid comparators // in loose mode, throw out any that are not valid comparators
set = set.filter(function(comp) { set = set.filter(function(comp) {
return !!comp.match(compRe); return !!comp.match(compRe);
}); });
} }
set = set.map(function(comp) { set = set.map(function(comp) {
return new Comparator(comp, loose); return new Comparator(comp, this.options);
}); }, this);
return set; return set;
}; };
Range.prototype.intersects = function(range, loose) { Range.prototype.intersects = function(range, options) {
if (!(range instanceof Range)) { if (!(range instanceof Range)) {
throw new TypeError('a Range is required'); throw new TypeError('a Range is required');
} }
@ -852,7 +871,7 @@ Range.prototype.intersects = function(range, loose) {
return thisComparators.every(function(thisComparator) { return thisComparators.every(function(thisComparator) {
return range.set.some(function(rangeComparators) { return range.set.some(function(rangeComparators) {
return rangeComparators.every(function(rangeComparator) { return rangeComparators.every(function(rangeComparator) {
return thisComparator.intersects(rangeComparator, loose); return thisComparator.intersects(rangeComparator, options);
}); });
}); });
}); });
@ -861,8 +880,8 @@ Range.prototype.intersects = function(range, loose) {
// Mostly just for testing and legacy API reasons // Mostly just for testing and legacy API reasons
exports.toComparators = toComparators; exports.toComparators = toComparators;
function toComparators(range, loose) { function toComparators(range, options) {
return new Range(range, loose).set.map(function(comp) { return new Range(range, options).set.map(function(comp) {
return comp.map(function(c) { return comp.map(function(c) {
return c.value; return c.value;
}).join(' ').trim().split(' '); }).join(' ').trim().split(' ');
@ -872,15 +891,15 @@ function toComparators(range, loose) {
// comprised of xranges, tildes, stars, and gtlt's at this point. // comprised of xranges, tildes, stars, and gtlt's at this point.
// already replaced the hyphen ranges // already replaced the hyphen ranges
// turn into a set of JUST comparators. // turn into a set of JUST comparators.
function parseComparator(comp, loose) { function parseComparator(comp, options) {
debug('comp', comp); debug('comp', comp, options);
comp = replaceCarets(comp, loose); comp = replaceCarets(comp, options);
debug('caret', comp); debug('caret', comp);
comp = replaceTildes(comp, loose); comp = replaceTildes(comp, options);
debug('tildes', comp); debug('tildes', comp);
comp = replaceXRanges(comp, loose); comp = replaceXRanges(comp, options);
debug('xrange', comp); debug('xrange', comp);
comp = replaceStars(comp, loose); comp = replaceStars(comp, options);
debug('stars', comp); debug('stars', comp);
return comp; return comp;
} }
@ -895,14 +914,16 @@ function isX(id) {
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 // ~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.3, ~>1.2.3 --> >=1.2.3 <1.3.0
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
function replaceTildes(comp, loose) { function replaceTildes(comp, options) {
return comp.trim().split(/\s+/).map(function(comp) { return comp.trim().split(/\s+/).map(function(comp) {
return replaceTilde(comp, loose); return replaceTilde(comp, options);
}).join(' '); }).join(' ');
} }
function replaceTilde(comp, loose) { function replaceTilde(comp, options) {
var r = loose ? re[TILDELOOSE] : re[TILDE]; if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var r = options.loose ? re[TILDELOOSE] : re[TILDE];
return comp.replace(r, function(_, M, m, p, pr) { return comp.replace(r, function(_, M, m, p, pr) {
debug('tilde', comp, _, M, m, p, pr); debug('tilde', comp, _, M, m, p, pr);
var ret; var ret;
@ -936,15 +957,17 @@ function replaceTilde(comp, loose) {
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
// ^1.2.3 --> >=1.2.3 <2.0.0 // ^1.2.3 --> >=1.2.3 <2.0.0
// ^1.2.0 --> >=1.2.0 <2.0.0 // ^1.2.0 --> >=1.2.0 <2.0.0
function replaceCarets(comp, loose) { function replaceCarets(comp, options) {
return comp.trim().split(/\s+/).map(function(comp) { return comp.trim().split(/\s+/).map(function(comp) {
return replaceCaret(comp, loose); return replaceCaret(comp, options);
}).join(' '); }).join(' ');
} }
function replaceCaret(comp, loose) { function replaceCaret(comp, options) {
debug('caret', comp, loose); debug('caret', comp, options);
var r = loose ? re[CARETLOOSE] : re[CARET]; if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var r = options.loose ? re[CARETLOOSE] : re[CARET];
return comp.replace(r, function(_, M, m, p, pr) { return comp.replace(r, function(_, M, m, p, pr) {
debug('caret', comp, _, M, m, p, pr); debug('caret', comp, _, M, m, p, pr);
var ret; var ret;
@ -991,16 +1014,18 @@ function replaceCaret(comp, loose) {
}); });
} }
function replaceXRanges(comp, loose) { function replaceXRanges(comp, options) {
debug('replaceXRanges', comp, loose); debug('replaceXRanges', comp, options);
return comp.split(/\s+/).map(function(comp) { return comp.split(/\s+/).map(function(comp) {
return replaceXRange(comp, loose); return replaceXRange(comp, options);
}).join(' '); }).join(' ');
} }
function replaceXRange(comp, loose) { function replaceXRange(comp, options) {
comp = comp.trim(); comp = comp.trim();
var r = loose ? re[XRANGELOOSE] : re[XRANGE]; if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
return comp.replace(r, function(ret, gtlt, M, m, p, pr) { return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
debug('xRange', comp, ret, gtlt, M, m, p, pr); debug('xRange', comp, ret, gtlt, M, m, p, pr);
var xM = isX(M); var xM = isX(M);
@ -1064,8 +1089,8 @@ function replaceXRange(comp, loose) {
// Because * is AND-ed with everything else in the comparator, // Because * is AND-ed with everything else in the comparator,
// and '' means "any version", just remove the *s entirely. // and '' means "any version", just remove the *s entirely.
function replaceStars(comp, loose) { function replaceStars(comp, options) {
debug('replaceStars', comp, loose); debug('replaceStars', comp, options);
// Looseness is ignored here. star is always as loose as it gets! // Looseness is ignored here. star is always as loose as it gets!
return comp.trim().replace(re[STAR], ''); return comp.trim().replace(re[STAR], '');
} }
@ -1109,22 +1134,25 @@ Range.prototype.test = function(version) {
return false; return false;
if (typeof version === 'string') if (typeof version === 'string')
version = new SemVer(version, this.loose); version = new SemVer(version, this.options);
for (var i = 0; i < this.set.length; i++) { for (var i = 0; i < this.set.length; i++) {
if (testSet(this.set[i], version)) if (testSet(this.set[i], version, this.options))
return true; return true;
} }
return false; return false;
}; };
function testSet(set, version) { function testSet(set, version, options) {
for (var i = 0; i < set.length; i++) { for (var i = 0; i < set.length; i++) {
if (!set[i].test(version)) if (!set[i].test(version))
return false; return false;
} }
if (version.prerelease.length) { if (!options)
options = {}
if (version.prerelease.length && !options.includePrerelease) {
// Find the set of versions that are allowed to have prereleases // 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 // 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. // That should allow `1.2.3-pr.2` to pass.
@ -1152,9 +1180,9 @@ function testSet(set, version) {
} }
exports.satisfies = satisfies; exports.satisfies = satisfies;
function satisfies(version, range, loose) { function satisfies(version, range, options) {
try { try {
range = new Range(range, loose); range = new Range(range, options);
} catch (er) { } catch (er) {
return false; return false;
} }
@ -1162,19 +1190,19 @@ function satisfies(version, range, loose) {
} }
exports.maxSatisfying = maxSatisfying; exports.maxSatisfying = maxSatisfying;
function maxSatisfying(versions, range, loose) { function maxSatisfying(versions, range, options) {
var max = null; var max = null;
var maxSV = null; var maxSV = null;
try { try {
var rangeObj = new Range(range, loose); var rangeObj = new Range(range, options);
} catch (er) { } catch (er) {
return null; return null;
} }
versions.forEach(function (v) { versions.forEach(function (v) {
if (rangeObj.test(v)) { // satisfies(v, range, loose) if (rangeObj.test(v)) { // satisfies(v, range, options)
if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
max = v; max = v;
maxSV = new SemVer(max, loose); maxSV = new SemVer(max, options);
} }
} }
}) })
@ -1182,19 +1210,19 @@ function maxSatisfying(versions, range, loose) {
} }
exports.minSatisfying = minSatisfying; exports.minSatisfying = minSatisfying;
function minSatisfying(versions, range, loose) { function minSatisfying(versions, range, options) {
var min = null; var min = null;
var minSV = null; var minSV = null;
try { try {
var rangeObj = new Range(range, loose); var rangeObj = new Range(range, options);
} catch (er) { } catch (er) {
return null; return null;
} }
versions.forEach(function (v) { versions.forEach(function (v) {
if (rangeObj.test(v)) { // satisfies(v, range, loose) if (rangeObj.test(v)) { // satisfies(v, range, options)
if (!min || minSV.compare(v) === 1) { // compare(min, v, true) if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
min = v; min = v;
minSV = new SemVer(min, loose); minSV = new SemVer(min, options);
} }
} }
}) })
@ -1202,11 +1230,11 @@ function minSatisfying(versions, range, loose) {
} }
exports.validRange = validRange; exports.validRange = validRange;
function validRange(range, loose) { function validRange(range, options) {
try { try {
// Return '*' instead of '' so that truthiness works. // Return '*' instead of '' so that truthiness works.
// This will throw if it's invalid anyway // This will throw if it's invalid anyway
return new Range(range, loose).range || '*'; return new Range(range, options).range || '*';
} catch (er) { } catch (er) {
return null; return null;
} }
@ -1214,20 +1242,20 @@ function validRange(range, loose) {
// Determine if version is less than all the versions possible in the range // Determine if version is less than all the versions possible in the range
exports.ltr = ltr; exports.ltr = ltr;
function ltr(version, range, loose) { function ltr(version, range, options) {
return outside(version, range, '<', loose); return outside(version, range, '<', options);
} }
// Determine if version is greater than all the versions possible in the range. // Determine if version is greater than all the versions possible in the range.
exports.gtr = gtr; exports.gtr = gtr;
function gtr(version, range, loose) { function gtr(version, range, options) {
return outside(version, range, '>', loose); return outside(version, range, '>', options);
} }
exports.outside = outside; exports.outside = outside;
function outside(version, range, hilo, loose) { function outside(version, range, hilo, options) {
version = new SemVer(version, loose); version = new SemVer(version, options);
range = new Range(range, loose); range = new Range(range, options);
var gtfn, ltefn, ltfn, comp, ecomp; var gtfn, ltefn, ltfn, comp, ecomp;
switch (hilo) { switch (hilo) {
@ -1250,7 +1278,7 @@ function outside(version, range, hilo, loose) {
} }
// If it satisifes the range it is not outside // If it satisifes the range it is not outside
if (satisfies(version, range, loose)) { if (satisfies(version, range, options)) {
return false; return false;
} }
@ -1269,9 +1297,9 @@ function outside(version, range, hilo, loose) {
} }
high = high || comparator; high = high || comparator;
low = low || comparator; low = low || comparator;
if (gtfn(comparator.semver, high.semver, loose)) { if (gtfn(comparator.semver, high.semver, options)) {
high = comparator; high = comparator;
} else if (ltfn(comparator.semver, low.semver, loose)) { } else if (ltfn(comparator.semver, low.semver, options)) {
low = comparator; low = comparator;
} }
}); });
@ -1295,15 +1323,15 @@ function outside(version, range, hilo, loose) {
} }
exports.prerelease = prerelease; exports.prerelease = prerelease;
function prerelease(version, loose) { function prerelease(version, options) {
var parsed = parse(version, loose); var parsed = parse(version, options);
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
} }
exports.intersects = intersects; exports.intersects = intersects;
function intersects(r1, r2, loose) { function intersects(r1, r2, options) {
r1 = new Range(r1, loose) r1 = new Range(r1, options)
r2 = new Range(r2, loose) r2 = new Range(r2, options)
return r1.intersects(r2) return r1.intersects(r2)
} }

View File

@ -29,9 +29,9 @@
"author": "Apache Software Foundation", "author": "Apache Software Foundation",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"android-versions": "1.3.0", "android-versions": "1.4.0",
"base64-js": "1.2.0", "base64-js": "1.3.0",
"big-integer": "1.6.32", "big-integer": "1.6.36",
"cordova-common": "2.2.5", "cordova-common": "2.2.5",
"elementtree": "0.1.6", "elementtree": "0.1.6",
"glob": "5.0.15", "glob": "5.0.15",
@ -41,7 +41,7 @@
"properties-parser": "0.2.3", "properties-parser": "0.2.3",
"q": "1.4.1", "q": "1.4.1",
"sax": "0.3.5", "sax": "0.3.5",
"semver": "5.5.0", "semver": "5.6.0",
"shelljs": "0.5.3", "shelljs": "0.5.3",
"xmlbuilder": "8.2.2" "xmlbuilder": "8.2.2"
}, },

View File

@ -82,6 +82,8 @@
<source-file src="src/android/testaar2.aar" target-dir="libs" /> <source-file src="src/android/testaar2.aar" target-dir="libs" />
<source-file src="src/android/testjar2.jar" target-dir="libs" /> <source-file src="src/android/testjar2.jar" target-dir="libs" />
<source-file src="src/android/jniLibs/x86/libnative.so" target-dir="libs/x86" /> <source-file src="src/android/jniLibs/x86/libnative.so" target-dir="libs/x86" />
<source-file src="src/android/DummyPlugin2.java"
target-dir="src/com/appco" />
<lib-file src="src/android/TestLib.jar" /> <lib-file src="src/android/TestLib.jar" />
</platform> </platform>
</plugin> </plugin>

View File

@ -169,6 +169,12 @@ describe('android project handler', function () {
'src/android/jniLibs/x86/libnative.so', temp, 'src/android/jniLibs/x86/libnative.so', temp,
path.join('app/src/main/jniLibs/x86/libnative.so'), false); path.join('app/src/main/jniLibs/x86/libnative.so'), false);
}); });
it('Test#006j : should allow installing sources with target-dir that includes "app"', function () {
android['source-file'].install(valid_source[10], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy)
.toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin2.java', temp, path.join('app/src/main/java/com/appco/DummyPlugin2.java'), false);
});
}); });
describe('of <framework> elements', function () { describe('of <framework> elements', function () {
@ -378,6 +384,12 @@ describe('android project handler', function () {
android['source-file'].uninstall(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/jniLibs/x86/libnative.so')); expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/jniLibs/x86/libnative.so'));
}); });
it('Test#019j : should remove stuff by calling common.deleteJava for Android Studio projects, with target-dir that includes "app"', function () {
android['source-file'].install(valid_source[10], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[10], dummyPluginInfo, dummyProject, {android_studio: true});
expect(deleteJavaSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/java/com/appco/DummyPlugin2.java'));
});
}); });
describe('of <framework> elements', function () { describe('of <framework> elements', function () {